From d6b2fa274369d722f92edce7a1bd83b8fc4d20bb Mon Sep 17 00:00:00 2001 From: azure-powershell-bot <65331932+azure-powershell-bot@users.noreply.github.com> Date: Mon, 30 Jan 2023 07:48:16 +0000 Subject: [PATCH 1/2] Move Peering to feature/delete-peering-main --- src/Peering/Az.Peering.csproj | 8 + src/Peering/Az.Peering.format.ps1xml | 2289 +++++ src/Peering/Az.Peering.psd1 | 155 + src/Peering/Az.Peering.psm1 | 115 + src/Peering/Changelog.md | 24 + src/Peering/Peering.sln | 58 + src/Peering/Properties/AssemblyInfo.cs | 28 + src/Peering/README.md | 239 + src/Peering/build-module.ps1 | 161 + src/Peering/check-dependencies.ps1 | 65 + src/Peering/create-model-cmdlets.ps1 | 179 + src/Peering/custom/Az.Peering.custom.psm1 | 17 + src/Peering/custom/README.md | 41 + ...ServiceProviderAvailabilityInputObject.ps1 | 53 + .../New-AzPeeringContactDetailObject.ps1 | 60 + .../New-AzPeeringDirectConnectionObject.ps1 | 126 + .../New-AzPeeringExchangeConnectionObject.ps1 | 107 + src/Peering/examples/Get-AzPeering.md | 33 + src/Peering/examples/Get-AzPeeringAsn.md | 26 + .../examples/Get-AzPeeringCdnPrefix.md | 19 + .../Get-AzPeeringConnectionMonitorTest.md | 27 + src/Peering/examples/Get-AzPeeringLegacy.md | 15 + src/Peering/examples/Get-AzPeeringLocation.md | 21 + .../examples/Get-AzPeeringReceivedRoute.md | 46 + .../examples/Get-AzPeeringRegisteredAsn.md | 28 + .../examples/Get-AzPeeringRegisteredPrefix.md | 30 + .../examples/Get-AzPeeringRpUnbilledPrefix.md | 15 + src/Peering/examples/Get-AzPeeringService.md | 53 + .../examples/Get-AzPeeringServiceCountry.md | 27 + .../examples/Get-AzPeeringServiceLocation.md | 59 + .../examples/Get-AzPeeringServicePrefix.md | 27 + .../examples/Get-AzPeeringServiceProvider.md | 27 + ...alize-AzPeeringServiceConnectionMonitor.md | 7 + src/Peering/examples/New-AzPeering.md | 15 + src/Peering/examples/New-AzPeeringAsn.md | 15 + ...kServiceProviderAvailabilityInputObject.md | 12 + .../New-AzPeeringConnectionMonitorTest.md | 13 + .../New-AzPeeringContactDetailObject.md | 13 + .../New-AzPeeringDirectConnectionObject.md | 14 + .../New-AzPeeringExchangeConnectionObject.md | 13 + .../examples/New-AzPeeringRegisteredAsn.md | 12 + .../examples/New-AzPeeringRegisteredPrefix.md | 13 + src/Peering/examples/New-AzPeeringService.md | 12 + .../examples/New-AzPeeringServicePrefix.md | 13 + src/Peering/examples/Remove-AzPeering.md | 7 + src/Peering/examples/Remove-AzPeeringAsn.md | 7 + .../Remove-AzPeeringConnectionMonitorTest.md | 7 + .../examples/Remove-AzPeeringRegisteredAsn.md | 6 + .../Remove-AzPeeringRegisteredPrefix.md | 6 + .../examples/Remove-AzPeeringService.md | 7 + .../examples/Remove-AzPeeringServicePrefix.md | 7 + .../Start-AzPeeringInvokeLookingGlass.md | 13 + .../Test-AzPeeringRegisteredPrefix.md | 13 + ...st-AzPeeringServiceProviderAvailability.md | 11 + src/Peering/examples/Update-AzPeering.md | 14 + .../examples/Update-AzPeeringService.md | 13 + src/Peering/export-surface.ps1 | 41 + src/Peering/exports/Get-AzPeering.ps1 | 210 + src/Peering/exports/Get-AzPeeringAsn.ps1 | 201 + .../exports/Get-AzPeeringCdnPrefix.ps1 | 170 + .../Get-AzPeeringConnectionMonitorTest.ps1 | 215 + src/Peering/exports/Get-AzPeeringLegacy.ps1 | 190 + src/Peering/exports/Get-AzPeeringLocation.ps1 | 178 + .../exports/Get-AzPeeringReceivedRoute.ps1 | 208 + .../exports/Get-AzPeeringRegisteredAsn.ps1 | 215 + .../exports/Get-AzPeeringRegisteredPrefix.ps1 | 215 + .../exports/Get-AzPeeringRpUnbilledPrefix.ps1 | 182 + src/Peering/exports/Get-AzPeeringService.ps1 | 212 + .../exports/Get-AzPeeringServiceCountry.ps1 | 164 + .../exports/Get-AzPeeringServiceLocation.ps1 | 172 + .../exports/Get-AzPeeringServicePrefix.ps1 | 221 + .../exports/Get-AzPeeringServiceProvider.ps1 | 164 + ...lize-AzPeeringServiceConnectionMonitor.ps1 | 196 + src/Peering/exports/New-AzPeering.ps1 | 280 + src/Peering/exports/New-AzPeeringAsn.ps1 | 202 + ...ServiceProviderAvailabilityInputObject.ps1 | 119 + .../New-AzPeeringConnectionMonitorTest.ps1 | 207 + .../New-AzPeeringContactDetailObject.ps1 | 126 + .../New-AzPeeringDirectConnectionObject.ps1 | 192 + .../New-AzPeeringExchangeConnectionObject.ps1 | 173 + .../exports/New-AzPeeringRegisteredAsn.ps1 | 189 + .../exports/New-AzPeeringRegisteredPrefix.ps1 | 189 + src/Peering/exports/New-AzPeeringService.ps1 | 221 + .../exports/New-AzPeeringServicePrefix.ps1 | 195 + .../exports/ProxyCmdletDefinitions.ps1 | 7187 +++++++++++++++ src/Peering/exports/README.md | 20 + src/Peering/exports/Remove-AzPeering.ps1 | 209 + src/Peering/exports/Remove-AzPeeringAsn.ps1 | 203 + .../Remove-AzPeeringConnectionMonitorTest.ps1 | 215 + .../exports/Remove-AzPeeringRegisteredAsn.ps1 | 215 + .../Remove-AzPeeringRegisteredPrefix.ps1 | 215 + .../exports/Remove-AzPeeringService.ps1 | 209 + .../exports/Remove-AzPeeringServicePrefix.ps1 | 215 + .../Start-AzPeeringInvokeLookingGlass.ps1 | 216 + .../Test-AzPeeringRegisteredPrefix.ps1 | 209 + ...t-AzPeeringServiceProviderAvailability.ps1 | 223 + src/Peering/exports/Update-AzPeering.ps1 | 211 + .../exports/Update-AzPeeringService.ps1 | 211 + src/Peering/generate-help.ps1 | 74 + src/Peering/generate-info.json | 8 + src/Peering/generated/Module.cs | 181 + .../Api20221001/BgpSession.PowerShell.cs | 244 + .../Api20221001/BgpSession.TypeConverter.cs | 146 + .../api/Models/Api20221001/BgpSession.cs | 227 + .../api/Models/Api20221001/BgpSession.json.cs | 134 + .../CdnPeeringPrefix.PowerShell.cs | 228 + .../CdnPeeringPrefix.TypeConverter.cs | 147 + .../Models/Api20221001/CdnPeeringPrefix.cs | 180 + .../Api20221001/CdnPeeringPrefix.json.cs | 110 + .../CdnPeeringPrefixListResult.PowerShell.cs | 172 + ...dnPeeringPrefixListResult.TypeConverter.cs | 147 + .../Api20221001/CdnPeeringPrefixListResult.cs | 68 + .../CdnPeeringPrefixListResult.json.cs | 118 + .../CdnPeeringPrefixProperties.PowerShell.cs | 196 + ...dnPeeringPrefixProperties.TypeConverter.cs | 147 + .../Api20221001/CdnPeeringPrefixProperties.cs | 134 + .../CdnPeeringPrefixProperties.json.cs | 131 + ...iceProviderAvailabilityInput.PowerShell.cs | 177 + ...ProviderAvailabilityInput.TypeConverter.cs | 150 + .../CheckServiceProviderAvailabilityInput.cs | 68 + ...ckServiceProviderAvailabilityInput.json.cs | 111 + .../ConnectionMonitorTest.PowerShell.cs | 244 + .../ConnectionMonitorTest.TypeConverter.cs | 147 + .../Api20221001/ConnectionMonitorTest.cs | 197 + .../Api20221001/ConnectionMonitorTest.json.cs | 110 + ...nectionMonitorTestListResult.PowerShell.cs | 174 + ...tionMonitorTestListResult.TypeConverter.cs | 148 + .../ConnectionMonitorTestListResult.cs | 68 + .../ConnectionMonitorTestListResult.json.cs | 118 + ...nectionMonitorTestProperties.PowerShell.cs | 214 + ...tionMonitorTestProperties.TypeConverter.cs | 148 + .../ConnectionMonitorTestProperties.cs | 162 + .../ConnectionMonitorTestProperties.json.cs | 137 + .../Api20221001/ContactDetail.PowerShell.cs | 180 + .../ContactDetail.TypeConverter.cs | 147 + .../api/Models/Api20221001/ContactDetail.cs | 85 + .../Models/Api20221001/ContactDetail.json.cs | 112 + .../DirectConnection.PowerShell.cs | 324 + .../DirectConnection.TypeConverter.cs | 147 + .../Models/Api20221001/DirectConnection.cs | 383 + .../Api20221001/DirectConnection.json.cs | 138 + .../DirectPeeringFacility.PowerShell.cs | 188 + .../DirectPeeringFacility.TypeConverter.cs | 147 + .../Api20221001/DirectPeeringFacility.cs | 102 + .../Api20221001/DirectPeeringFacility.json.cs | 114 + .../Api20221001/ErrorDetail.PowerShell.cs | 172 + .../Api20221001/ErrorDetail.TypeConverter.cs | 147 + .../api/Models/Api20221001/ErrorDetail.cs | 74 + .../Models/Api20221001/ErrorDetail.json.cs | 116 + .../Api20221001/ErrorResponse.PowerShell.cs | 180 + .../ErrorResponse.TypeConverter.cs | 147 + .../api/Models/Api20221001/ErrorResponse.cs | 80 + .../Models/Api20221001/ErrorResponse.json.cs | 108 + .../ExchangeConnection.PowerShell.cs | 284 + .../ExchangeConnection.TypeConverter.cs | 147 + .../Models/Api20221001/ExchangeConnection.cs | 280 + .../Api20221001/ExchangeConnection.json.cs | 122 + .../ExchangePeeringFacility.PowerShell.cs | 220 + .../ExchangePeeringFacility.TypeConverter.cs | 147 + .../Api20221001/ExchangePeeringFacility.cs | 176 + .../ExchangePeeringFacility.json.cs | 122 + ...AnalyticsWorkspaceProperties.PowerShell.cs | 182 + ...lyticsWorkspaceProperties.TypeConverter.cs | 148 + .../LogAnalyticsWorkspaceProperties.cs | 94 + .../LogAnalyticsWorkspaceProperties.json.cs | 129 + .../LookingGlassOutput.PowerShell.cs | 172 + .../LookingGlassOutput.TypeConverter.cs | 147 + .../Models/Api20221001/LookingGlassOutput.cs | 68 + .../Api20221001/LookingGlassOutput.json.cs | 110 + .../Api20221001/MetricDimension.PowerShell.cs | 172 + .../MetricDimension.TypeConverter.cs | 147 + .../api/Models/Api20221001/MetricDimension.cs | 74 + .../Api20221001/MetricDimension.json.cs | 116 + .../MetricSpecification.PowerShell.cs | 212 + .../MetricSpecification.TypeConverter.cs | 147 + .../Models/Api20221001/MetricSpecification.cs | 180 + .../Api20221001/MetricSpecification.json.cs | 157 + .../Api20221001/Operation.PowerShell.cs | 236 + .../Api20221001/Operation.TypeConverter.cs | 146 + .../api/Models/Api20221001/Operation.cs | 188 + .../api/Models/Api20221001/Operation.json.cs | 126 + .../OperationDisplayInfo.PowerShell.cs | 188 + .../OperationDisplayInfo.TypeConverter.cs | 147 + .../Api20221001/OperationDisplayInfo.cs | 114 + .../Api20221001/OperationDisplayInfo.json.cs | 126 + .../OperationListResult.PowerShell.cs | 172 + .../OperationListResult.TypeConverter.cs | 147 + .../Models/Api20221001/OperationListResult.cs | 68 + .../Api20221001/OperationListResult.json.cs | 118 + .../OperationProperties.PowerShell.cs | 172 + .../OperationProperties.TypeConverter.cs | 147 + .../Models/Api20221001/OperationProperties.cs | 63 + .../Api20221001/OperationProperties.json.cs | 111 + .../Models/Api20221001/PeerAsn.PowerShell.cs | 228 + .../Api20221001/PeerAsn.TypeConverter.cs | 146 + .../api/Models/Api20221001/PeerAsn.cs | 176 + .../api/Models/Api20221001/PeerAsn.json.cs | 110 + .../PeerAsnListResult.PowerShell.cs | 172 + .../PeerAsnListResult.TypeConverter.cs | 147 + .../Models/Api20221001/PeerAsnListResult.cs | 68 + .../Api20221001/PeerAsnListResult.json.cs | 118 + .../PeerAsnProperties.PowerShell.cs | 196 + .../PeerAsnProperties.TypeConverter.cs | 147 + .../Models/Api20221001/PeerAsnProperties.cs | 125 + .../Api20221001/PeerAsnProperties.json.cs | 130 + .../Models/Api20221001/Peering.PowerShell.cs | 350 + .../Api20221001/Peering.TypeConverter.cs | 146 + .../api/Models/Api20221001/Peering.cs | 379 + .../api/Models/Api20221001/Peering.json.cs | 120 + .../PeeringBandwidthOffer.PowerShell.cs | 172 + .../PeeringBandwidthOffer.TypeConverter.cs | 147 + .../Api20221001/PeeringBandwidthOffer.cs | 68 + .../Api20221001/PeeringBandwidthOffer.json.cs | 110 + .../PeeringListResult.PowerShell.cs | 172 + .../PeeringListResult.TypeConverter.cs | 147 + .../Models/Api20221001/PeeringListResult.cs | 68 + .../Api20221001/PeeringListResult.json.cs | 118 + .../Api20221001/PeeringLocation.PowerShell.cs | 262 + .../PeeringLocation.TypeConverter.cs | 147 + .../api/Models/Api20221001/PeeringLocation.cs | 210 + .../Api20221001/PeeringLocation.json.cs | 114 + .../PeeringLocationListResult.PowerShell.cs | 172 + ...PeeringLocationListResult.TypeConverter.cs | 147 + .../Api20221001/PeeringLocationListResult.cs | 68 + .../PeeringLocationListResult.json.cs | 118 + .../PeeringLocationProperties.PowerShell.cs | 220 + ...PeeringLocationProperties.TypeConverter.cs | 147 + .../Api20221001/PeeringLocationProperties.cs | 151 + .../PeeringLocationProperties.json.cs | 116 + ...ringLocationPropertiesDirect.PowerShell.cs | 174 + ...gLocationPropertiesDirect.TypeConverter.cs | 148 + .../PeeringLocationPropertiesDirect.cs | 68 + .../PeeringLocationPropertiesDirect.json.cs | 126 + ...ngLocationPropertiesExchange.PowerShell.cs | 168 + ...ocationPropertiesExchange.TypeConverter.cs | 148 + .../PeeringLocationPropertiesExchange.cs | 51 + .../PeeringLocationPropertiesExchange.json.cs | 116 + .../PeeringProperties.PowerShell.cs | 252 + .../PeeringProperties.TypeConverter.cs | 147 + .../Models/Api20221001/PeeringProperties.cs | 192 + .../Api20221001/PeeringProperties.json.cs | 117 + .../PeeringPropertiesDirect.PowerShell.cs | 196 + .../PeeringPropertiesDirect.TypeConverter.cs | 147 + .../Api20221001/PeeringPropertiesDirect.cs | 114 + .../PeeringPropertiesDirect.json.cs | 125 + .../PeeringPropertiesExchange.PowerShell.cs | 180 + ...PeeringPropertiesExchange.TypeConverter.cs | 147 + .../Api20221001/PeeringPropertiesExchange.cs | 77 + .../PeeringPropertiesExchange.json.cs | 118 + .../PeeringReceivedRoute.PowerShell.cs | 212 + .../PeeringReceivedRoute.TypeConverter.cs | 147 + .../Api20221001/PeeringReceivedRoute.cs | 186 + .../Api20221001/PeeringReceivedRoute.json.cs | 141 + ...eringReceivedRouteListResult.PowerShell.cs | 174 + ...ngReceivedRouteListResult.TypeConverter.cs | 148 + .../PeeringReceivedRouteListResult.cs | 68 + .../PeeringReceivedRouteListResult.json.cs | 118 + .../PeeringRegisteredAsn.PowerShell.cs | 212 + .../PeeringRegisteredAsn.TypeConverter.cs | 147 + .../Api20221001/PeeringRegisteredAsn.cs | 146 + .../Api20221001/PeeringRegisteredAsn.json.cs | 110 + ...eringRegisteredAsnListResult.PowerShell.cs | 174 + ...ngRegisteredAsnListResult.TypeConverter.cs | 148 + .../PeeringRegisteredAsnListResult.cs | 68 + .../PeeringRegisteredAsnListResult.json.cs | 118 + ...eringRegisteredAsnProperties.PowerShell.cs | 182 + ...ngRegisteredAsnProperties.TypeConverter.cs | 148 + .../PeeringRegisteredAsnProperties.cs | 91 + .../PeeringRegisteredAsnProperties.json.cs | 118 + .../PeeringRegisteredPrefix.PowerShell.cs | 228 + .../PeeringRegisteredPrefix.TypeConverter.cs | 147 + .../Api20221001/PeeringRegisteredPrefix.cs | 182 + .../PeeringRegisteredPrefix.json.cs | 110 + ...ngRegisteredPrefixListResult.PowerShell.cs | 176 + ...egisteredPrefixListResult.TypeConverter.cs | 148 + .../PeeringRegisteredPrefixListResult.cs | 68 + .../PeeringRegisteredPrefixListResult.json.cs | 118 + ...ngRegisteredPrefixProperties.PowerShell.cs | 200 + ...egisteredPrefixProperties.TypeConverter.cs | 148 + .../PeeringRegisteredPrefixProperties.cs | 131 + .../PeeringRegisteredPrefixProperties.json.cs | 128 + .../Api20221001/PeeringService.PowerShell.cs | 292 + .../PeeringService.TypeConverter.cs | 147 + .../api/Models/Api20221001/PeeringService.cs | 308 + .../Models/Api20221001/PeeringService.json.cs | 116 + .../PeeringServiceCountry.PowerShell.cs | 180 + .../PeeringServiceCountry.TypeConverter.cs | 147 + .../Api20221001/PeeringServiceCountry.cs | 74 + .../Api20221001/PeeringServiceCountry.json.cs | 108 + ...ringServiceCountryListResult.PowerShell.cs | 174 + ...gServiceCountryListResult.TypeConverter.cs | 148 + .../PeeringServiceCountryListResult.cs | 68 + .../PeeringServiceCountryListResult.json.cs | 118 + .../PeeringServiceListResult.PowerShell.cs | 172 + .../PeeringServiceListResult.TypeConverter.cs | 147 + .../Api20221001/PeeringServiceListResult.cs | 68 + .../PeeringServiceListResult.json.cs | 118 + .../PeeringServiceLocation.PowerShell.cs | 212 + .../PeeringServiceLocation.TypeConverter.cs | 147 + .../Api20221001/PeeringServiceLocation.cs | 135 + .../PeeringServiceLocation.json.cs | 110 + ...ingServiceLocationListResult.PowerShell.cs | 174 + ...ServiceLocationListResult.TypeConverter.cs | 148 + .../PeeringServiceLocationListResult.cs | 68 + .../PeeringServiceLocationListResult.json.cs | 118 + ...ingServiceLocationProperties.PowerShell.cs | 182 + ...ServiceLocationProperties.TypeConverter.cs | 148 + .../PeeringServiceLocationProperties.cs | 85 + .../PeeringServiceLocationProperties.json.cs | 112 + .../PeeringServicePrefix.PowerShell.cs | 244 + .../PeeringServicePrefix.TypeConverter.cs | 147 + .../Api20221001/PeeringServicePrefix.cs | 215 + .../Api20221001/PeeringServicePrefix.json.cs | 110 + .../PeeringServicePrefixEvent.PowerShell.cs | 196 + ...PeeringServicePrefixEvent.TypeConverter.cs | 147 + .../Api20221001/PeeringServicePrefixEvent.cs | 134 + .../PeeringServicePrefixEvent.json.cs | 131 + ...eringServicePrefixListResult.PowerShell.cs | 174 + ...ngServicePrefixListResult.TypeConverter.cs | 148 + .../PeeringServicePrefixListResult.cs | 68 + .../PeeringServicePrefixListResult.json.cs | 118 + ...eringServicePrefixProperties.PowerShell.cs | 214 + ...ngServicePrefixProperties.TypeConverter.cs | 148 + .../PeeringServicePrefixProperties.cs | 168 + .../PeeringServicePrefixProperties.json.cs | 143 + .../PeeringServiceProperties.PowerShell.cs | 228 + .../PeeringServiceProperties.TypeConverter.cs | 147 + .../Api20221001/PeeringServiceProperties.cs | 197 + .../PeeringServiceProperties.json.cs | 121 + .../PeeringServiceProvider.PowerShell.cs | 204 + .../PeeringServiceProvider.TypeConverter.cs | 147 + .../Api20221001/PeeringServiceProvider.cs | 120 + .../PeeringServiceProvider.json.cs | 110 + ...ingServiceProviderListResult.PowerShell.cs | 174 + ...ServiceProviderListResult.TypeConverter.cs | 148 + .../PeeringServiceProviderListResult.cs | 68 + .../PeeringServiceProviderListResult.json.cs | 118 + ...ingServiceProviderProperties.PowerShell.cs | 174 + ...ServiceProviderProperties.TypeConverter.cs | 148 + .../PeeringServiceProviderProperties.cs | 68 + .../PeeringServiceProviderProperties.json.cs | 118 + .../PeeringServiceSku.PowerShell.cs | 164 + .../PeeringServiceSku.TypeConverter.cs | 147 + .../Models/Api20221001/PeeringServiceSku.cs | 51 + .../Api20221001/PeeringServiceSku.json.cs | 108 + .../PeeringServiceTags.PowerShell.cs | 160 + .../PeeringServiceTags.TypeConverter.cs | 147 + .../Models/Api20221001/PeeringServiceTags.cs | 35 + .../PeeringServiceTags.dictionary.cs | 75 + .../Api20221001/PeeringServiceTags.json.cs | 109 + .../Api20221001/PeeringSku.PowerShell.cs | 188 + .../Api20221001/PeeringSku.TypeConverter.cs | 146 + .../api/Models/Api20221001/PeeringSku.cs | 111 + .../api/Models/Api20221001/PeeringSku.json.cs | 123 + .../Api20221001/PeeringTags.PowerShell.cs | 160 + .../Api20221001/PeeringTags.TypeConverter.cs | 147 + .../api/Models/Api20221001/PeeringTags.cs | 35 + .../Api20221001/PeeringTags.dictionary.cs | 75 + .../Models/Api20221001/PeeringTags.json.cs | 109 + .../Models/Api20221001/Resource.PowerShell.cs | 180 + .../Api20221001/Resource.TypeConverter.cs | 146 + .../api/Models/Api20221001/Resource.cs | 94 + .../api/Models/Api20221001/Resource.json.cs | 121 + .../Api20221001/ResourceTags.PowerShell.cs | 160 + .../Api20221001/ResourceTags.TypeConverter.cs | 147 + .../api/Models/Api20221001/ResourceTags.cs | 35 + .../Api20221001/ResourceTags.dictionary.cs | 75 + .../Models/Api20221001/ResourceTags.json.cs | 109 + .../Api20221001/ResourceTags1.PowerShell.cs | 164 + .../ResourceTags1.TypeConverter.cs | 147 + .../api/Models/Api20221001/ResourceTags1.cs | 51 + .../Models/Api20221001/ResourceTags1.json.cs | 108 + .../RpUnbilledPrefix.PowerShell.cs | 180 + .../RpUnbilledPrefix.TypeConverter.cs | 147 + .../Models/Api20221001/RpUnbilledPrefix.cs | 97 + .../Api20221001/RpUnbilledPrefix.json.cs | 121 + .../RpUnbilledPrefixListResult.PowerShell.cs | 172 + ...pUnbilledPrefixListResult.TypeConverter.cs | 147 + .../Api20221001/RpUnbilledPrefixListResult.cs | 68 + .../RpUnbilledPrefixListResult.json.cs | 118 + .../ServiceSpecification.PowerShell.cs | 164 + .../ServiceSpecification.TypeConverter.cs | 147 + .../Api20221001/ServiceSpecification.cs | 54 + .../Api20221001/ServiceSpecification.json.cs | 119 + .../Api20221001/SubResource.PowerShell.cs | 164 + .../Api20221001/SubResource.TypeConverter.cs | 147 + .../api/Models/Api20221001/SubResource.cs | 51 + .../Models/Api20221001/SubResource.json.cs | 108 + .../api/Models/PeeringIdentity.PowerShell.cs | 234 + .../Models/PeeringIdentity.TypeConverter.cs | 157 + .../generated/api/Models/PeeringIdentity.cs | 201 + .../api/Models/PeeringIdentity.json.cs | 125 + src/Peering/generated/api/Peering.cs | 7944 +++++++++++++++++ .../api/Support/Command.Completer.cs | 43 + .../api/Support/Command.TypeConverter.cs | 59 + src/Peering/generated/api/Support/Command.cs | 100 + .../api/Support/ConnectionState.Completer.cs | 71 + .../Support/ConnectionState.TypeConverter.cs | 59 + .../generated/api/Support/ConnectionState.cs | 114 + .../Support/DirectPeeringType.Completer.cs | 63 + .../DirectPeeringType.TypeConverter.cs | 59 + .../api/Support/DirectPeeringType.cs | 110 + .../generated/api/Support/Family.Completer.cs | 39 + .../api/Support/Family.TypeConverter.cs | 59 + src/Peering/generated/api/Support/Family.cs | 98 + .../generated/api/Support/Kind.Completer.cs | 39 + .../api/Support/Kind.TypeConverter.cs | 59 + src/Peering/generated/api/Support/Kind.cs | 98 + .../api/Support/LearnedType.Completer.cs | 43 + .../api/Support/LearnedType.TypeConverter.cs | 59 + .../generated/api/Support/LearnedType.cs | 100 + .../Support/LegacyPeeringsKind.Completer.cs | 39 + .../LegacyPeeringsKind.TypeConverter.cs | 59 + .../api/Support/LegacyPeeringsKind.cs | 97 + .../Support/LookingGlassCommand.Completer.cs | 43 + .../LookingGlassCommand.TypeConverter.cs | 59 + .../api/Support/LookingGlassCommand.cs | 99 + .../LookingGlassSourceType.Completer.cs | 39 + .../LookingGlassSourceType.TypeConverter.cs | 59 + .../api/Support/LookingGlassSourceType.cs | 97 + ...ingLocationsDirectPeeringType.Completer.cs | 63 + ...ocationsDirectPeeringType.TypeConverter.cs | 59 + .../PeeringLocationsDirectPeeringType.cs | 115 + .../Support/PeeringLocationsKind.Completer.cs | 39 + .../PeeringLocationsKind.TypeConverter.cs | 59 + .../api/Support/PeeringLocationsKind.cs | 97 + .../PrefixValidationState.Completer.cs | 59 + .../PrefixValidationState.TypeConverter.cs | 59 + .../api/Support/PrefixValidationState.cs | 108 + .../Support/ProvisioningState.Completer.cs | 47 + .../ProvisioningState.TypeConverter.cs | 59 + .../api/Support/ProvisioningState.cs | 102 + .../generated/api/Support/Role.Completer.cs | 55 + .../api/Support/Role.TypeConverter.cs | 59 + src/Peering/generated/api/Support/Role.cs | 106 + .../SessionAddressProvider.Completer.cs | 39 + .../SessionAddressProvider.TypeConverter.cs | 59 + .../api/Support/SessionAddressProvider.cs | 98 + .../api/Support/SessionStateV4.Completer.cs | 75 + .../Support/SessionStateV4.TypeConverter.cs | 59 + .../generated/api/Support/SessionStateV4.cs | 116 + .../api/Support/SessionStateV6.Completer.cs | 75 + .../Support/SessionStateV6.TypeConverter.cs | 59 + .../generated/api/Support/SessionStateV6.cs | 116 + .../generated/api/Support/Size.Completer.cs | 43 + .../api/Support/Size.TypeConverter.cs | 59 + src/Peering/generated/api/Support/Size.cs | 100 + .../generated/api/Support/Tier.Completer.cs | 39 + .../api/Support/Tier.TypeConverter.cs | 59 + src/Peering/generated/api/Support/Tier.cs | 98 + .../api/Support/ValidationState.Completer.cs | 47 + .../Support/ValidationState.TypeConverter.cs | 59 + .../generated/api/Support/ValidationState.cs | 102 + .../generated/cmdlets/GetAzPeeringAsn_Get.cs | 390 + .../cmdlets/GetAzPeeringAsn_GetViaIdentity.cs | 378 + .../generated/cmdlets/GetAzPeeringAsn_List.cs | 397 + .../cmdlets/GetAzPeeringCdnPrefix_List.cs | 411 + .../GetAzPeeringConnectionMonitorTest_Get.cs | 421 + ...ingConnectionMonitorTest_GetViaIdentity.cs | 389 + .../GetAzPeeringConnectionMonitorTest_List.cs | 427 + .../cmdlets/GetAzPeeringLegacy_List.cs | 457 + .../cmdlets/GetAzPeeringLocation_List.cs | 427 + .../cmdlets/GetAzPeeringOperation_List.cs | 377 + .../cmdlets/GetAzPeeringReceivedRoute_List.cs | 499 ++ .../cmdlets/GetAzPeeringRegisteredAsn_Get.cs | 420 + ...etAzPeeringRegisteredAsn_GetViaIdentity.cs | 388 + .../cmdlets/GetAzPeeringRegisteredAsn_List.cs | 427 + .../GetAzPeeringRegisteredPrefix_Get.cs | 420 + ...zPeeringRegisteredPrefix_GetViaIdentity.cs | 388 + .../GetAzPeeringRegisteredPrefix_List.cs | 427 + .../GetAzPeeringRpUnbilledPrefix_List.cs | 439 + .../GetAzPeeringServiceCountry_List.cs | 397 + .../GetAzPeeringServiceLocation_List.cs | 411 + .../cmdlets/GetAzPeeringServicePrefix_Get.cs | 434 + ...etAzPeeringServicePrefix_GetViaIdentity.cs | 402 + .../cmdlets/GetAzPeeringServicePrefix_List.cs | 441 + .../GetAzPeeringServiceProvider_List.cs | 399 + .../cmdlets/GetAzPeeringService_Get.cs | 406 + .../GetAzPeeringService_GetViaIdentity.cs | 384 + .../cmdlets/GetAzPeeringService_List.cs | 413 + .../cmdlets/GetAzPeeringService_List1.cs | 397 + .../generated/cmdlets/GetAzPeering_Get.cs | 404 + .../cmdlets/GetAzPeering_GetViaIdentity.cs | 384 + .../generated/cmdlets/GetAzPeering_List.cs | 409 + .../generated/cmdlets/GetAzPeering_List1.cs | 397 + ...ringServiceConnectionMonitor_Initialize.cs | 380 + ...ConnectionMonitor_InitializeViaIdentity.cs | 383 + .../cmdlets/NewAzPeeringAsn_CreateExpanded.cs | 465 + ...ingConnectionMonitorTest_CreateExpanded.cs | 504 ++ ...ewAzPeeringRegisteredAsn_CreateExpanded.cs | 470 + ...zPeeringRegisteredPrefix_CreateExpanded.cs | 470 + ...ewAzPeeringServicePrefix_CreateExpanded.cs | 481 + .../NewAzPeeringService_CreateExpanded.cs | 529 ++ .../cmdlets/NewAzPeering_CreateExpanded.cs | 564 ++ .../cmdlets/RemoveAzPeeringAsn_Delete.cs | 431 + .../RemoveAzPeeringAsn_DeleteViaIdentity.cs | 422 + ...veAzPeeringConnectionMonitorTest_Delete.cs | 460 + ...ConnectionMonitorTest_DeleteViaIdentity.cs | 431 + .../RemoveAzPeeringRegisteredAsn_Delete.cs | 459 + ...zPeeringRegisteredAsn_DeleteViaIdentity.cs | 430 + .../RemoveAzPeeringRegisteredPrefix_Delete.cs | 459 + ...eringRegisteredPrefix_DeleteViaIdentity.cs | 430 + .../RemoveAzPeeringServicePrefix_Delete.cs | 459 + ...zPeeringServicePrefix_DeleteViaIdentity.cs | 430 + .../cmdlets/RemoveAzPeeringService_Delete.cs | 445 + ...emoveAzPeeringService_DeleteViaIdentity.cs | 426 + .../cmdlets/RemoveAzPeering_Delete.cs | 445 + .../RemoveAzPeering_DeleteViaIdentity.cs | 426 + ...StartAzPeeringInvokeLookingGlass_Invoke.cs | 433 + ...ingInvokeLookingGlass_InvokeViaIdentity.cs | 435 + .../TestAzPeeringRegisteredPrefix_Validate.cs | 420 + ...ingRegisteredPrefix_ValidateViaIdentity.cs | 391 + ...eeringServiceProviderAvailability_Check.cs | 390 + ...rviceProviderAvailability_CheckExpanded.cs | 400 + ...ceProviderAvailability_CheckViaIdentity.cs | 392 + ...erAvailability_CheckViaIdentityExpanded.cs | 403 + .../UpdateAzPeeringService_UpdateExpanded.cs | 421 + ...eeringService_UpdateViaIdentityExpanded.cs | 402 + .../cmdlets/UpdateAzPeering_UpdateExpanded.cs | 421 + ...dateAzPeering_UpdateViaIdentityExpanded.cs | 402 + .../generated/runtime/AsyncCommandRuntime.cs | 832 ++ src/Peering/generated/runtime/AsyncJob.cs | 270 + .../runtime/AsyncOperationResponse.cs | 176 + .../BuildTime/Cmdlets/ExportCmdletSurface.cs | 113 + .../BuildTime/Cmdlets/ExportExampleStub.cs | 74 + .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 101 + .../BuildTime/Cmdlets/ExportHelpMarkdown.cs | 53 + .../BuildTime/Cmdlets/ExportModelSurface.cs | 117 + .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 177 + .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 191 + .../BuildTime/Cmdlets/ExportTestStub.cs | 148 + .../BuildTime/Cmdlets/GetCommonParameter.cs | 52 + .../BuildTime/Cmdlets/GetModuleGuid.cs | 31 + .../BuildTime/Cmdlets/GetScriptCmdlet.cs | 54 + .../runtime/BuildTime/CollectionExtensions.cs | 20 + .../runtime/BuildTime/MarkdownRenderer.cs | 114 + .../runtime/BuildTime/Models/PsFormatTypes.cs | 138 + .../BuildTime/Models/PsHelpMarkdownOutputs.cs | 199 + .../runtime/BuildTime/Models/PsHelpTypes.cs | 202 + .../BuildTime/Models/PsMarkdownTypes.cs | 294 + .../BuildTime/Models/PsProxyOutputs.cs | 611 ++ .../runtime/BuildTime/Models/PsProxyTypes.cs | 514 ++ .../runtime/BuildTime/PsAttributes.cs | 114 + .../runtime/BuildTime/PsExtensions.cs | 169 + .../generated/runtime/BuildTime/PsHelpers.cs | 105 + .../runtime/BuildTime/StringExtensions.cs | 24 + .../runtime/BuildTime/XmlExtensions.cs | 28 + .../generated/runtime/CmdInfoHandler.cs | 40 + .../Conversions/ConversionException.cs | 17 + .../runtime/Conversions/IJsonConverter.cs | 13 + .../Conversions/Instances/BinaryConverter.cs | 24 + .../Conversions/Instances/BooleanConverter.cs | 13 + .../Instances/DateTimeConverter.cs | 18 + .../Instances/DateTimeOffsetConverter.cs | 15 + .../Conversions/Instances/DecimalConverter.cs | 16 + .../Conversions/Instances/DoubleConverter.cs | 13 + .../Conversions/Instances/EnumConverter.cs | 30 + .../Conversions/Instances/GuidConverter.cs | 15 + .../Instances/HashSet'1Converter.cs | 27 + .../Conversions/Instances/Int16Converter.cs | 13 + .../Conversions/Instances/Int32Converter.cs | 13 + .../Conversions/Instances/Int64Converter.cs | 13 + .../Instances/JsonArrayConverter.cs | 13 + .../Instances/JsonObjectConverter.cs | 13 + .../Conversions/Instances/SingleConverter.cs | 13 + .../Conversions/Instances/StringConverter.cs | 13 + .../Instances/TimeSpanConverter.cs | 15 + .../Conversions/Instances/UInt16Converter.cs | 13 + .../Conversions/Instances/UInt32Converter.cs | 13 + .../Conversions/Instances/UInt64Converter.cs | 13 + .../Conversions/Instances/UriConverter.cs | 15 + .../runtime/Conversions/JsonConverter.cs | 21 + .../Conversions/JsonConverterAttribute.cs | 18 + .../Conversions/JsonConverterFactory.cs | 91 + .../Conversions/StringLikeConverter.cs | 45 + .../Customizations/IJsonSerializable.cs | 263 + .../runtime/Customizations/JsonArray.cs | 13 + .../runtime/Customizations/JsonBoolean.cs | 16 + .../runtime/Customizations/JsonNode.cs | 21 + .../runtime/Customizations/JsonNumber.cs | 78 + .../runtime/Customizations/JsonObject.cs | 183 + .../runtime/Customizations/JsonString.cs | 34 + .../runtime/Customizations/XNodeArray.cs | 44 + src/Peering/generated/runtime/Debugging.cs | 28 + .../generated/runtime/DictionaryExtensions.cs | 33 + src/Peering/generated/runtime/EventData.cs | 78 + .../generated/runtime/EventDataExtensions.cs | 94 + .../generated/runtime/EventListener.cs | 247 + src/Peering/generated/runtime/Events.cs | 27 + .../generated/runtime/EventsExtensions.cs | 27 + src/Peering/generated/runtime/Extensions.cs | 117 + .../Extensions/StringBuilderExtensions.cs | 23 + .../Helpers/Extensions/TypeExtensions.cs | 61 + .../generated/runtime/Helpers/Seperator.cs | 11 + .../generated/runtime/Helpers/TypeDetails.cs | 116 + .../generated/runtime/Helpers/XHelper.cs | 75 + src/Peering/generated/runtime/HttpPipeline.cs | 88 + .../generated/runtime/HttpPipelineMocking.ps1 | 110 + .../generated/runtime/IAssociativeArray.cs | 24 + .../generated/runtime/IHeaderSerializable.cs | 14 + src/Peering/generated/runtime/ISendAsync.cs | 300 + .../generated/runtime/InfoAttribute.cs | 34 + src/Peering/generated/runtime/Iso/IsoDate.cs | 214 + src/Peering/generated/runtime/JsonType.cs | 18 + .../generated/runtime/MessageAttribute.cs | 360 + .../runtime/MessageAttributeHelper.cs | 161 + src/Peering/generated/runtime/Method.cs | 19 + .../generated/runtime/Models/JsonMember.cs | 83 + .../generated/runtime/Models/JsonModel.cs | 89 + .../runtime/Models/JsonModelCache.cs | 19 + .../runtime/Nodes/Collections/JsonArray.cs | 65 + .../Nodes/Collections/XImmutableArray.cs | 62 + .../runtime/Nodes/Collections/XList.cs | 64 + .../runtime/Nodes/Collections/XNodeArray.cs | 68 + .../runtime/Nodes/Collections/XSet.cs | 60 + .../generated/runtime/Nodes/JsonBoolean.cs | 42 + .../generated/runtime/Nodes/JsonDate.cs | 173 + .../generated/runtime/Nodes/JsonNode.cs | 250 + .../generated/runtime/Nodes/JsonNumber.cs | 109 + .../generated/runtime/Nodes/JsonObject.cs | 172 + .../generated/runtime/Nodes/JsonString.cs | 42 + .../generated/runtime/Nodes/XBinary.cs | 40 + src/Peering/generated/runtime/Nodes/XNull.cs | 15 + .../Parser/Exceptions/ParseException.cs | 24 + .../generated/runtime/Parser/JsonParser.cs | 180 + .../generated/runtime/Parser/JsonToken.cs | 66 + .../generated/runtime/Parser/JsonTokenizer.cs | 177 + .../generated/runtime/Parser/Location.cs | 43 + .../runtime/Parser/Readers/SourceReader.cs | 130 + .../generated/runtime/Parser/TokenReader.cs | 39 + .../generated/runtime/PipelineMocking.cs | 262 + .../runtime/Properties/Resources.Designer.cs | 5633 ++++++++++++ .../runtime/Properties/Resources.resx | 1741 ++++ src/Peering/generated/runtime/Response.cs | 27 + .../runtime/Serialization/JsonSerializer.cs | 350 + .../Serialization/PropertyTransformation.cs | 21 + .../Serialization/SerializationOptions.cs | 65 + .../generated/runtime/SerializationMode.cs | 16 + .../runtime/TypeConverterExtensions.cs | 211 + .../runtime/UndeclaredResponseException.cs | 112 + .../generated/runtime/Writers/JsonWriter.cs | 223 + src/Peering/generated/runtime/delegates.cs | 23 + src/Peering/help/Az.Peering.md | 130 + src/Peering/help/Get-AzPeering.md | 186 + src/Peering/help/Get-AzPeeringAsn.md | 158 + src/Peering/help/Get-AzPeeringCdnPrefix.md | 106 + .../Get-AzPeeringConnectionMonitorTest.md | 191 + src/Peering/help/Get-AzPeeringLegacy.md | 146 + src/Peering/help/Get-AzPeeringLocation.md | 123 + .../help/Get-AzPeeringReceivedRoute.md | 224 + .../help/Get-AzPeeringRegisteredAsn.md | 191 + .../help/Get-AzPeeringRegisteredPrefix.md | 194 + .../help/Get-AzPeeringRpUnbilledPrefix.md | 131 + src/Peering/help/Get-AzPeeringService.md | 206 + .../help/Get-AzPeeringServiceCountry.md | 98 + .../help/Get-AzPeeringServiceLocation.md | 145 + .../help/Get-AzPeeringServicePrefix.md | 206 + .../help/Get-AzPeeringServiceProvider.md | 98 + ...alize-AzPeeringServiceConnectionMonitor.md | 166 + src/Peering/help/New-AzPeering.md | 336 + src/Peering/help/New-AzPeeringAsn.md | 189 + ...kServiceProviderAvailabilityInputObject.md | 84 + .../New-AzPeeringConnectionMonitorTest.md | 221 + .../help/New-AzPeeringContactDetailObject.md | 98 + .../New-AzPeeringDirectConnectionObject.md | 270 + .../New-AzPeeringExchangeConnectionObject.md | 223 + .../help/New-AzPeeringRegisteredAsn.md | 176 + .../help/New-AzPeeringRegisteredPrefix.md | 176 + src/Peering/help/New-AzPeeringService.md | 252 + .../help/New-AzPeeringServicePrefix.md | 191 + src/Peering/help/Remove-AzPeering.md | 196 + src/Peering/help/Remove-AzPeeringAsn.md | 181 + .../Remove-AzPeeringConnectionMonitorTest.md | 211 + .../help/Remove-AzPeeringRegisteredAsn.md | 211 + .../help/Remove-AzPeeringRegisteredPrefix.md | 211 + src/Peering/help/Remove-AzPeeringService.md | 196 + .../help/Remove-AzPeeringServicePrefix.md | 211 + .../help/Start-AzPeeringInvokeLookingGlass.md | 219 + .../help/Test-AzPeeringRegisteredPrefix.md | 202 + ...st-AzPeeringServiceProviderAvailability.md | 222 + src/Peering/help/Update-AzPeering.md | 203 + src/Peering/help/Update-AzPeeringService.md | 203 + src/Peering/how-to.md | 58 + src/Peering/internal/Az.Peering.internal.psm1 | 38 + .../internal/Get-AzPeeringOperation.ps1 | 124 + .../internal/ProxyCmdletDefinitions.ps1 | 124 + src/Peering/internal/README.md | 14 + src/Peering/pack-module.ps1 | 17 + src/Peering/run-module.ps1 | 62 + src/Peering/test-module.ps1 | 94 + src/Peering/test/Get-AzPeering.Recording.json | 124 + src/Peering/test/Get-AzPeering.Tests.ps1 | 38 + .../test/Get-AzPeeringAsn.Recording.json | 162 + src/Peering/test/Get-AzPeeringAsn.Tests.ps1 | 39 + .../Get-AzPeeringCdnPrefix.Recording.json | 42 + .../test/Get-AzPeeringCdnPrefix.Tests.ps1 | 24 + ...t-AzPeeringConnectionMonitorTest.Tests.ps1 | 29 + .../test/Get-AzPeeringLegacy.Tests.ps1 | 21 + .../test/Get-AzPeeringLocation.Recording.json | 42 + .../test/Get-AzPeeringLocation.Tests.ps1 | 24 + .../Get-AzPeeringReceivedRoute.Recording.json | 42 + .../test/Get-AzPeeringReceivedRoute.Tests.ps1 | 24 + .../Get-AzPeeringRegisteredAsn.Recording.json | 82 + .../test/Get-AzPeeringRegisteredAsn.Tests.ps1 | 31 + ...t-AzPeeringRegisteredPrefix.Recording.json | 82 + .../Get-AzPeeringRegisteredPrefix.Tests.ps1 | 32 + ...t-AzPeeringRpUnbilledPrefix.Recording.json | 44 + .../Get-AzPeeringRpUnbilledPrefix.Tests.ps1 | 26 + .../test/Get-AzPeeringService.Recording.json | 124 + .../test/Get-AzPeeringService.Tests.ps1 | 39 + ...Get-AzPeeringServiceCountry.Recording.json | 42 + .../Get-AzPeeringServiceCountry.Tests.ps1 | 24 + ...et-AzPeeringServiceLocation.Recording.json | 82 + .../Get-AzPeeringServiceLocation.Tests.ps1 | 27 + .../Get-AzPeeringServicePrefix.Recording.json | 82 + .../test/Get-AzPeeringServicePrefix.Tests.ps1 | 31 + ...et-AzPeeringServiceProvider.Recording.json | 42 + .../Get-AzPeeringServiceProvider.Tests.ps1 | 24 + ...zPeeringServiceConnectionMonitor.Tests.ps1 | 25 + src/Peering/test/New-AzPeering.Recording.json | 37 + src/Peering/test/New-AzPeering.Tests.ps1 | 27 + .../test/New-AzPeeringAsn.Recording.json | 37 + src/Peering/test/New-AzPeeringAsn.Tests.ps1 | 26 + ...eProviderAvailabilityInputObject.Tests.ps1 | 24 + ...w-AzPeeringConnectionMonitorTest.Tests.ps1 | 21 + ...New-AzPeeringContactDetailObject.Tests.ps1 | 24 + ...-AzPeeringDirectConnectionObject.Tests.ps1 | 24 + ...zPeeringExchangeConnectionObject.Tests.ps1 | 24 + .../New-AzPeeringRegisteredAsn.Recording.json | 37 + .../test/New-AzPeeringRegisteredAsn.Tests.ps1 | 24 + .../New-AzPeeringRegisteredPrefix.Tests.ps1 | 21 + .../test/New-AzPeeringService.Recording.json | 37 + .../test/New-AzPeeringService.Tests.ps1 | 24 + .../test/New-AzPeeringServicePrefix.Tests.ps1 | 21 + src/Peering/test/README.md | 17 + .../test/Remove-AzPeering.Recording.json | 41 + src/Peering/test/Remove-AzPeering.Tests.ps1 | 23 + .../test/Remove-AzPeeringAsn.Recording.json | 41 + .../test/Remove-AzPeeringAsn.Tests.ps1 | 23 + ...e-AzPeeringConnectionMonitorTest.Tests.ps1 | 25 + ...move-AzPeeringRegisteredAsn.Recording.json | 41 + .../Remove-AzPeeringRegisteredAsn.Tests.ps1 | 23 + ...e-AzPeeringRegisteredPrefix.Recording.json | 40 + ...Remove-AzPeeringRegisteredPrefix.Tests.ps1 | 23 + .../Remove-AzPeeringService.Recording.json | 41 + .../test/Remove-AzPeeringService.Tests.ps1 | 23 + ...move-AzPeeringServicePrefix.Recording.json | 40 + .../Remove-AzPeeringServicePrefix.Tests.ps1 | 23 + ...AzPeeringInvokeLookingGlass.Recording.json | 42 + ...tart-AzPeeringInvokeLookingGlass.Tests.ps1 | 24 + ...t-AzPeeringRegisteredPrefix.Recording.json | 42 + .../Test-AzPeeringRegisteredPrefix.Tests.ps1 | 24 + ...ServiceProviderAvailability.Recording.json | 37 + ...eringServiceProviderAvailability.Tests.ps1 | 26 + .../test/Update-AzPeering.Recording.json | 37 + src/Peering/test/Update-AzPeering.Tests.ps1 | 25 + .../Update-AzPeeringService.Recording.json | 37 + .../test/Update-AzPeeringService.Tests.ps1 | 25 + src/Peering/test/env.json | 4 + src/Peering/test/envDogfood.json | 4 + src/Peering/test/loadEnv.ps1 | 29 + src/Peering/test/loadEnvDogfood.ps1 | 29 + src/Peering/test/utils.ps1 | 31 + src/Peering/utils/Unprotect-SecureString.ps1 | 16 + 764 files changed, 132388 insertions(+) create mode 100644 src/Peering/Az.Peering.csproj create mode 100644 src/Peering/Az.Peering.format.ps1xml create mode 100644 src/Peering/Az.Peering.psd1 create mode 100644 src/Peering/Az.Peering.psm1 create mode 100644 src/Peering/Changelog.md create mode 100644 src/Peering/Peering.sln create mode 100644 src/Peering/Properties/AssemblyInfo.cs create mode 100644 src/Peering/README.md create mode 100644 src/Peering/build-module.ps1 create mode 100644 src/Peering/check-dependencies.ps1 create mode 100644 src/Peering/create-model-cmdlets.ps1 create mode 100644 src/Peering/custom/Az.Peering.custom.psm1 create mode 100644 src/Peering/custom/README.md create mode 100644 src/Peering/custom/autogen-model-cmdlets/New-AzPeeringCheckServiceProviderAvailabilityInputObject.ps1 create mode 100644 src/Peering/custom/autogen-model-cmdlets/New-AzPeeringContactDetailObject.ps1 create mode 100644 src/Peering/custom/autogen-model-cmdlets/New-AzPeeringDirectConnectionObject.ps1 create mode 100644 src/Peering/custom/autogen-model-cmdlets/New-AzPeeringExchangeConnectionObject.ps1 create mode 100644 src/Peering/examples/Get-AzPeering.md create mode 100644 src/Peering/examples/Get-AzPeeringAsn.md create mode 100644 src/Peering/examples/Get-AzPeeringCdnPrefix.md create mode 100644 src/Peering/examples/Get-AzPeeringConnectionMonitorTest.md create mode 100644 src/Peering/examples/Get-AzPeeringLegacy.md create mode 100644 src/Peering/examples/Get-AzPeeringLocation.md create mode 100644 src/Peering/examples/Get-AzPeeringReceivedRoute.md create mode 100644 src/Peering/examples/Get-AzPeeringRegisteredAsn.md create mode 100644 src/Peering/examples/Get-AzPeeringRegisteredPrefix.md create mode 100644 src/Peering/examples/Get-AzPeeringRpUnbilledPrefix.md create mode 100644 src/Peering/examples/Get-AzPeeringService.md create mode 100644 src/Peering/examples/Get-AzPeeringServiceCountry.md create mode 100644 src/Peering/examples/Get-AzPeeringServiceLocation.md create mode 100644 src/Peering/examples/Get-AzPeeringServicePrefix.md create mode 100644 src/Peering/examples/Get-AzPeeringServiceProvider.md create mode 100644 src/Peering/examples/Initialize-AzPeeringServiceConnectionMonitor.md create mode 100644 src/Peering/examples/New-AzPeering.md create mode 100644 src/Peering/examples/New-AzPeeringAsn.md create mode 100644 src/Peering/examples/New-AzPeeringCheckServiceProviderAvailabilityInputObject.md create mode 100644 src/Peering/examples/New-AzPeeringConnectionMonitorTest.md create mode 100644 src/Peering/examples/New-AzPeeringContactDetailObject.md create mode 100644 src/Peering/examples/New-AzPeeringDirectConnectionObject.md create mode 100644 src/Peering/examples/New-AzPeeringExchangeConnectionObject.md create mode 100644 src/Peering/examples/New-AzPeeringRegisteredAsn.md create mode 100644 src/Peering/examples/New-AzPeeringRegisteredPrefix.md create mode 100644 src/Peering/examples/New-AzPeeringService.md create mode 100644 src/Peering/examples/New-AzPeeringServicePrefix.md create mode 100644 src/Peering/examples/Remove-AzPeering.md create mode 100644 src/Peering/examples/Remove-AzPeeringAsn.md create mode 100644 src/Peering/examples/Remove-AzPeeringConnectionMonitorTest.md create mode 100644 src/Peering/examples/Remove-AzPeeringRegisteredAsn.md create mode 100644 src/Peering/examples/Remove-AzPeeringRegisteredPrefix.md create mode 100644 src/Peering/examples/Remove-AzPeeringService.md create mode 100644 src/Peering/examples/Remove-AzPeeringServicePrefix.md create mode 100644 src/Peering/examples/Start-AzPeeringInvokeLookingGlass.md create mode 100644 src/Peering/examples/Test-AzPeeringRegisteredPrefix.md create mode 100644 src/Peering/examples/Test-AzPeeringServiceProviderAvailability.md create mode 100644 src/Peering/examples/Update-AzPeering.md create mode 100644 src/Peering/examples/Update-AzPeeringService.md create mode 100644 src/Peering/export-surface.ps1 create mode 100644 src/Peering/exports/Get-AzPeering.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringAsn.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringCdnPrefix.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringConnectionMonitorTest.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringLegacy.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringLocation.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringReceivedRoute.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringRegisteredAsn.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringRegisteredPrefix.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringRpUnbilledPrefix.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringService.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringServiceCountry.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringServiceLocation.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringServicePrefix.ps1 create mode 100644 src/Peering/exports/Get-AzPeeringServiceProvider.ps1 create mode 100644 src/Peering/exports/Initialize-AzPeeringServiceConnectionMonitor.ps1 create mode 100644 src/Peering/exports/New-AzPeering.ps1 create mode 100644 src/Peering/exports/New-AzPeeringAsn.ps1 create mode 100644 src/Peering/exports/New-AzPeeringCheckServiceProviderAvailabilityInputObject.ps1 create mode 100644 src/Peering/exports/New-AzPeeringConnectionMonitorTest.ps1 create mode 100644 src/Peering/exports/New-AzPeeringContactDetailObject.ps1 create mode 100644 src/Peering/exports/New-AzPeeringDirectConnectionObject.ps1 create mode 100644 src/Peering/exports/New-AzPeeringExchangeConnectionObject.ps1 create mode 100644 src/Peering/exports/New-AzPeeringRegisteredAsn.ps1 create mode 100644 src/Peering/exports/New-AzPeeringRegisteredPrefix.ps1 create mode 100644 src/Peering/exports/New-AzPeeringService.ps1 create mode 100644 src/Peering/exports/New-AzPeeringServicePrefix.ps1 create mode 100644 src/Peering/exports/ProxyCmdletDefinitions.ps1 create mode 100644 src/Peering/exports/README.md create mode 100644 src/Peering/exports/Remove-AzPeering.ps1 create mode 100644 src/Peering/exports/Remove-AzPeeringAsn.ps1 create mode 100644 src/Peering/exports/Remove-AzPeeringConnectionMonitorTest.ps1 create mode 100644 src/Peering/exports/Remove-AzPeeringRegisteredAsn.ps1 create mode 100644 src/Peering/exports/Remove-AzPeeringRegisteredPrefix.ps1 create mode 100644 src/Peering/exports/Remove-AzPeeringService.ps1 create mode 100644 src/Peering/exports/Remove-AzPeeringServicePrefix.ps1 create mode 100644 src/Peering/exports/Start-AzPeeringInvokeLookingGlass.ps1 create mode 100644 src/Peering/exports/Test-AzPeeringRegisteredPrefix.ps1 create mode 100644 src/Peering/exports/Test-AzPeeringServiceProviderAvailability.ps1 create mode 100644 src/Peering/exports/Update-AzPeering.ps1 create mode 100644 src/Peering/exports/Update-AzPeeringService.ps1 create mode 100644 src/Peering/generate-help.ps1 create mode 100644 src/Peering/generate-info.json create mode 100644 src/Peering/generated/Module.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/BgpSession.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/BgpSession.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/BgpSession.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/BgpSession.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ContactDetail.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ContactDetail.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ContactDetail.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ContactDetail.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/DirectConnection.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/DirectConnection.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/DirectConnection.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/DirectConnection.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ErrorDetail.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ErrorDetail.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ErrorDetail.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ErrorDetail.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ErrorResponse.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ErrorResponse.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ErrorResponse.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ErrorResponse.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ExchangeConnection.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ExchangeConnection.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ExchangeConnection.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ExchangeConnection.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/MetricDimension.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/MetricDimension.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/MetricDimension.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/MetricDimension.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/MetricSpecification.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/MetricSpecification.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/MetricSpecification.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/MetricSpecification.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Operation.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Operation.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Operation.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Operation.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/OperationProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsn.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsn.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsn.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsn.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Peering.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Peering.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Peering.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Peering.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocation.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocation.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocation.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocation.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringService.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringService.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringService.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringService.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.dictionary.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringSku.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringSku.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringSku.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringSku.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringTags.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringTags.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringTags.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringTags.dictionary.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/PeeringTags.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Resource.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Resource.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Resource.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/Resource.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ResourceTags.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ResourceTags.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ResourceTags.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ResourceTags.dictionary.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ResourceTags.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ResourceTags1.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ResourceTags1.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ResourceTags1.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ResourceTags1.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ServiceSpecification.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ServiceSpecification.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ServiceSpecification.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/ServiceSpecification.json.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/SubResource.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/SubResource.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/SubResource.cs create mode 100644 src/Peering/generated/api/Models/Api20221001/SubResource.json.cs create mode 100644 src/Peering/generated/api/Models/PeeringIdentity.PowerShell.cs create mode 100644 src/Peering/generated/api/Models/PeeringIdentity.TypeConverter.cs create mode 100644 src/Peering/generated/api/Models/PeeringIdentity.cs create mode 100644 src/Peering/generated/api/Models/PeeringIdentity.json.cs create mode 100644 src/Peering/generated/api/Peering.cs create mode 100644 src/Peering/generated/api/Support/Command.Completer.cs create mode 100644 src/Peering/generated/api/Support/Command.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/Command.cs create mode 100644 src/Peering/generated/api/Support/ConnectionState.Completer.cs create mode 100644 src/Peering/generated/api/Support/ConnectionState.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/ConnectionState.cs create mode 100644 src/Peering/generated/api/Support/DirectPeeringType.Completer.cs create mode 100644 src/Peering/generated/api/Support/DirectPeeringType.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/DirectPeeringType.cs create mode 100644 src/Peering/generated/api/Support/Family.Completer.cs create mode 100644 src/Peering/generated/api/Support/Family.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/Family.cs create mode 100644 src/Peering/generated/api/Support/Kind.Completer.cs create mode 100644 src/Peering/generated/api/Support/Kind.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/Kind.cs create mode 100644 src/Peering/generated/api/Support/LearnedType.Completer.cs create mode 100644 src/Peering/generated/api/Support/LearnedType.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/LearnedType.cs create mode 100644 src/Peering/generated/api/Support/LegacyPeeringsKind.Completer.cs create mode 100644 src/Peering/generated/api/Support/LegacyPeeringsKind.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/LegacyPeeringsKind.cs create mode 100644 src/Peering/generated/api/Support/LookingGlassCommand.Completer.cs create mode 100644 src/Peering/generated/api/Support/LookingGlassCommand.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/LookingGlassCommand.cs create mode 100644 src/Peering/generated/api/Support/LookingGlassSourceType.Completer.cs create mode 100644 src/Peering/generated/api/Support/LookingGlassSourceType.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/LookingGlassSourceType.cs create mode 100644 src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.Completer.cs create mode 100644 src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.cs create mode 100644 src/Peering/generated/api/Support/PeeringLocationsKind.Completer.cs create mode 100644 src/Peering/generated/api/Support/PeeringLocationsKind.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/PeeringLocationsKind.cs create mode 100644 src/Peering/generated/api/Support/PrefixValidationState.Completer.cs create mode 100644 src/Peering/generated/api/Support/PrefixValidationState.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/PrefixValidationState.cs create mode 100644 src/Peering/generated/api/Support/ProvisioningState.Completer.cs create mode 100644 src/Peering/generated/api/Support/ProvisioningState.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/ProvisioningState.cs create mode 100644 src/Peering/generated/api/Support/Role.Completer.cs create mode 100644 src/Peering/generated/api/Support/Role.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/Role.cs create mode 100644 src/Peering/generated/api/Support/SessionAddressProvider.Completer.cs create mode 100644 src/Peering/generated/api/Support/SessionAddressProvider.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/SessionAddressProvider.cs create mode 100644 src/Peering/generated/api/Support/SessionStateV4.Completer.cs create mode 100644 src/Peering/generated/api/Support/SessionStateV4.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/SessionStateV4.cs create mode 100644 src/Peering/generated/api/Support/SessionStateV6.Completer.cs create mode 100644 src/Peering/generated/api/Support/SessionStateV6.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/SessionStateV6.cs create mode 100644 src/Peering/generated/api/Support/Size.Completer.cs create mode 100644 src/Peering/generated/api/Support/Size.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/Size.cs create mode 100644 src/Peering/generated/api/Support/Tier.Completer.cs create mode 100644 src/Peering/generated/api/Support/Tier.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/Tier.cs create mode 100644 src/Peering/generated/api/Support/ValidationState.Completer.cs create mode 100644 src/Peering/generated/api/Support/ValidationState.TypeConverter.cs create mode 100644 src/Peering/generated/api/Support/ValidationState.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringAsn_Get.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringAsn_GetViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringAsn_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringCdnPrefix_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_Get.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_GetViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringLegacy_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringLocation_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringOperation_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringReceivedRoute_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_Get.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_GetViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_Get.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_GetViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringRpUnbilledPrefix_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringServiceCountry_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringServiceLocation_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_Get.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_GetViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringServiceProvider_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringService_Get.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringService_GetViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringService_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeeringService_List1.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeering_Get.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeering_GetViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeering_List.cs create mode 100644 src/Peering/generated/cmdlets/GetAzPeering_List1.cs create mode 100644 src/Peering/generated/cmdlets/InitializeAzPeeringServiceConnectionMonitor_Initialize.cs create mode 100644 src/Peering/generated/cmdlets/InitializeAzPeeringServiceConnectionMonitor_InitializeViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/NewAzPeeringAsn_CreateExpanded.cs create mode 100644 src/Peering/generated/cmdlets/NewAzPeeringConnectionMonitorTest_CreateExpanded.cs create mode 100644 src/Peering/generated/cmdlets/NewAzPeeringRegisteredAsn_CreateExpanded.cs create mode 100644 src/Peering/generated/cmdlets/NewAzPeeringRegisteredPrefix_CreateExpanded.cs create mode 100644 src/Peering/generated/cmdlets/NewAzPeeringServicePrefix_CreateExpanded.cs create mode 100644 src/Peering/generated/cmdlets/NewAzPeeringService_CreateExpanded.cs create mode 100644 src/Peering/generated/cmdlets/NewAzPeering_CreateExpanded.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringAsn_Delete.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringAsn_DeleteViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringConnectionMonitorTest_Delete.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringConnectionMonitorTest_DeleteViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredAsn_Delete.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredAsn_DeleteViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredPrefix_Delete.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredPrefix_DeleteViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringServicePrefix_Delete.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringServicePrefix_DeleteViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringService_Delete.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeeringService_DeleteViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeering_Delete.cs create mode 100644 src/Peering/generated/cmdlets/RemoveAzPeering_DeleteViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/StartAzPeeringInvokeLookingGlass_Invoke.cs create mode 100644 src/Peering/generated/cmdlets/StartAzPeeringInvokeLookingGlass_InvokeViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/TestAzPeeringRegisteredPrefix_Validate.cs create mode 100644 src/Peering/generated/cmdlets/TestAzPeeringRegisteredPrefix_ValidateViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_Check.cs create mode 100644 src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckExpanded.cs create mode 100644 src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckViaIdentity.cs create mode 100644 src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckViaIdentityExpanded.cs create mode 100644 src/Peering/generated/cmdlets/UpdateAzPeeringService_UpdateExpanded.cs create mode 100644 src/Peering/generated/cmdlets/UpdateAzPeeringService_UpdateViaIdentityExpanded.cs create mode 100644 src/Peering/generated/cmdlets/UpdateAzPeering_UpdateExpanded.cs create mode 100644 src/Peering/generated/cmdlets/UpdateAzPeering_UpdateViaIdentityExpanded.cs create mode 100644 src/Peering/generated/runtime/AsyncCommandRuntime.cs create mode 100644 src/Peering/generated/runtime/AsyncJob.cs create mode 100644 src/Peering/generated/runtime/AsyncOperationResponse.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs create mode 100644 src/Peering/generated/runtime/BuildTime/CollectionExtensions.cs create mode 100644 src/Peering/generated/runtime/BuildTime/MarkdownRenderer.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Models/PsFormatTypes.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Models/PsHelpTypes.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Models/PsProxyOutputs.cs create mode 100644 src/Peering/generated/runtime/BuildTime/Models/PsProxyTypes.cs create mode 100644 src/Peering/generated/runtime/BuildTime/PsAttributes.cs create mode 100644 src/Peering/generated/runtime/BuildTime/PsExtensions.cs create mode 100644 src/Peering/generated/runtime/BuildTime/PsHelpers.cs create mode 100644 src/Peering/generated/runtime/BuildTime/StringExtensions.cs create mode 100644 src/Peering/generated/runtime/BuildTime/XmlExtensions.cs create mode 100644 src/Peering/generated/runtime/CmdInfoHandler.cs create mode 100644 src/Peering/generated/runtime/Conversions/ConversionException.cs create mode 100644 src/Peering/generated/runtime/Conversions/IJsonConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/BinaryConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/BooleanConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/DateTimeConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/DecimalConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/DoubleConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/EnumConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/GuidConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/HashSet'1Converter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/Int16Converter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/Int32Converter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/Int64Converter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/JsonArrayConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/JsonObjectConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/SingleConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/StringConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/TimeSpanConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/UInt16Converter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/UInt32Converter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/UInt64Converter.cs create mode 100644 src/Peering/generated/runtime/Conversions/Instances/UriConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/JsonConverter.cs create mode 100644 src/Peering/generated/runtime/Conversions/JsonConverterAttribute.cs create mode 100644 src/Peering/generated/runtime/Conversions/JsonConverterFactory.cs create mode 100644 src/Peering/generated/runtime/Conversions/StringLikeConverter.cs create mode 100644 src/Peering/generated/runtime/Customizations/IJsonSerializable.cs create mode 100644 src/Peering/generated/runtime/Customizations/JsonArray.cs create mode 100644 src/Peering/generated/runtime/Customizations/JsonBoolean.cs create mode 100644 src/Peering/generated/runtime/Customizations/JsonNode.cs create mode 100644 src/Peering/generated/runtime/Customizations/JsonNumber.cs create mode 100644 src/Peering/generated/runtime/Customizations/JsonObject.cs create mode 100644 src/Peering/generated/runtime/Customizations/JsonString.cs create mode 100644 src/Peering/generated/runtime/Customizations/XNodeArray.cs create mode 100644 src/Peering/generated/runtime/Debugging.cs create mode 100644 src/Peering/generated/runtime/DictionaryExtensions.cs create mode 100644 src/Peering/generated/runtime/EventData.cs create mode 100644 src/Peering/generated/runtime/EventDataExtensions.cs create mode 100644 src/Peering/generated/runtime/EventListener.cs create mode 100644 src/Peering/generated/runtime/Events.cs create mode 100644 src/Peering/generated/runtime/EventsExtensions.cs create mode 100644 src/Peering/generated/runtime/Extensions.cs create mode 100644 src/Peering/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs create mode 100644 src/Peering/generated/runtime/Helpers/Extensions/TypeExtensions.cs create mode 100644 src/Peering/generated/runtime/Helpers/Seperator.cs create mode 100644 src/Peering/generated/runtime/Helpers/TypeDetails.cs create mode 100644 src/Peering/generated/runtime/Helpers/XHelper.cs create mode 100644 src/Peering/generated/runtime/HttpPipeline.cs create mode 100644 src/Peering/generated/runtime/HttpPipelineMocking.ps1 create mode 100644 src/Peering/generated/runtime/IAssociativeArray.cs create mode 100644 src/Peering/generated/runtime/IHeaderSerializable.cs create mode 100644 src/Peering/generated/runtime/ISendAsync.cs create mode 100644 src/Peering/generated/runtime/InfoAttribute.cs create mode 100644 src/Peering/generated/runtime/Iso/IsoDate.cs create mode 100644 src/Peering/generated/runtime/JsonType.cs create mode 100644 src/Peering/generated/runtime/MessageAttribute.cs create mode 100644 src/Peering/generated/runtime/MessageAttributeHelper.cs create mode 100644 src/Peering/generated/runtime/Method.cs create mode 100644 src/Peering/generated/runtime/Models/JsonMember.cs create mode 100644 src/Peering/generated/runtime/Models/JsonModel.cs create mode 100644 src/Peering/generated/runtime/Models/JsonModelCache.cs create mode 100644 src/Peering/generated/runtime/Nodes/Collections/JsonArray.cs create mode 100644 src/Peering/generated/runtime/Nodes/Collections/XImmutableArray.cs create mode 100644 src/Peering/generated/runtime/Nodes/Collections/XList.cs create mode 100644 src/Peering/generated/runtime/Nodes/Collections/XNodeArray.cs create mode 100644 src/Peering/generated/runtime/Nodes/Collections/XSet.cs create mode 100644 src/Peering/generated/runtime/Nodes/JsonBoolean.cs create mode 100644 src/Peering/generated/runtime/Nodes/JsonDate.cs create mode 100644 src/Peering/generated/runtime/Nodes/JsonNode.cs create mode 100644 src/Peering/generated/runtime/Nodes/JsonNumber.cs create mode 100644 src/Peering/generated/runtime/Nodes/JsonObject.cs create mode 100644 src/Peering/generated/runtime/Nodes/JsonString.cs create mode 100644 src/Peering/generated/runtime/Nodes/XBinary.cs create mode 100644 src/Peering/generated/runtime/Nodes/XNull.cs create mode 100644 src/Peering/generated/runtime/Parser/Exceptions/ParseException.cs create mode 100644 src/Peering/generated/runtime/Parser/JsonParser.cs create mode 100644 src/Peering/generated/runtime/Parser/JsonToken.cs create mode 100644 src/Peering/generated/runtime/Parser/JsonTokenizer.cs create mode 100644 src/Peering/generated/runtime/Parser/Location.cs create mode 100644 src/Peering/generated/runtime/Parser/Readers/SourceReader.cs create mode 100644 src/Peering/generated/runtime/Parser/TokenReader.cs create mode 100644 src/Peering/generated/runtime/PipelineMocking.cs create mode 100644 src/Peering/generated/runtime/Properties/Resources.Designer.cs create mode 100644 src/Peering/generated/runtime/Properties/Resources.resx create mode 100644 src/Peering/generated/runtime/Response.cs create mode 100644 src/Peering/generated/runtime/Serialization/JsonSerializer.cs create mode 100644 src/Peering/generated/runtime/Serialization/PropertyTransformation.cs create mode 100644 src/Peering/generated/runtime/Serialization/SerializationOptions.cs create mode 100644 src/Peering/generated/runtime/SerializationMode.cs create mode 100644 src/Peering/generated/runtime/TypeConverterExtensions.cs create mode 100644 src/Peering/generated/runtime/UndeclaredResponseException.cs create mode 100644 src/Peering/generated/runtime/Writers/JsonWriter.cs create mode 100644 src/Peering/generated/runtime/delegates.cs create mode 100644 src/Peering/help/Az.Peering.md create mode 100644 src/Peering/help/Get-AzPeering.md create mode 100644 src/Peering/help/Get-AzPeeringAsn.md create mode 100644 src/Peering/help/Get-AzPeeringCdnPrefix.md create mode 100644 src/Peering/help/Get-AzPeeringConnectionMonitorTest.md create mode 100644 src/Peering/help/Get-AzPeeringLegacy.md create mode 100644 src/Peering/help/Get-AzPeeringLocation.md create mode 100644 src/Peering/help/Get-AzPeeringReceivedRoute.md create mode 100644 src/Peering/help/Get-AzPeeringRegisteredAsn.md create mode 100644 src/Peering/help/Get-AzPeeringRegisteredPrefix.md create mode 100644 src/Peering/help/Get-AzPeeringRpUnbilledPrefix.md create mode 100644 src/Peering/help/Get-AzPeeringService.md create mode 100644 src/Peering/help/Get-AzPeeringServiceCountry.md create mode 100644 src/Peering/help/Get-AzPeeringServiceLocation.md create mode 100644 src/Peering/help/Get-AzPeeringServicePrefix.md create mode 100644 src/Peering/help/Get-AzPeeringServiceProvider.md create mode 100644 src/Peering/help/Initialize-AzPeeringServiceConnectionMonitor.md create mode 100644 src/Peering/help/New-AzPeering.md create mode 100644 src/Peering/help/New-AzPeeringAsn.md create mode 100644 src/Peering/help/New-AzPeeringCheckServiceProviderAvailabilityInputObject.md create mode 100644 src/Peering/help/New-AzPeeringConnectionMonitorTest.md create mode 100644 src/Peering/help/New-AzPeeringContactDetailObject.md create mode 100644 src/Peering/help/New-AzPeeringDirectConnectionObject.md create mode 100644 src/Peering/help/New-AzPeeringExchangeConnectionObject.md create mode 100644 src/Peering/help/New-AzPeeringRegisteredAsn.md create mode 100644 src/Peering/help/New-AzPeeringRegisteredPrefix.md create mode 100644 src/Peering/help/New-AzPeeringService.md create mode 100644 src/Peering/help/New-AzPeeringServicePrefix.md create mode 100644 src/Peering/help/Remove-AzPeering.md create mode 100644 src/Peering/help/Remove-AzPeeringAsn.md create mode 100644 src/Peering/help/Remove-AzPeeringConnectionMonitorTest.md create mode 100644 src/Peering/help/Remove-AzPeeringRegisteredAsn.md create mode 100644 src/Peering/help/Remove-AzPeeringRegisteredPrefix.md create mode 100644 src/Peering/help/Remove-AzPeeringService.md create mode 100644 src/Peering/help/Remove-AzPeeringServicePrefix.md create mode 100644 src/Peering/help/Start-AzPeeringInvokeLookingGlass.md create mode 100644 src/Peering/help/Test-AzPeeringRegisteredPrefix.md create mode 100644 src/Peering/help/Test-AzPeeringServiceProviderAvailability.md create mode 100644 src/Peering/help/Update-AzPeering.md create mode 100644 src/Peering/help/Update-AzPeeringService.md create mode 100644 src/Peering/how-to.md create mode 100644 src/Peering/internal/Az.Peering.internal.psm1 create mode 100644 src/Peering/internal/Get-AzPeeringOperation.ps1 create mode 100644 src/Peering/internal/ProxyCmdletDefinitions.ps1 create mode 100644 src/Peering/internal/README.md create mode 100644 src/Peering/pack-module.ps1 create mode 100644 src/Peering/run-module.ps1 create mode 100644 src/Peering/test-module.ps1 create mode 100644 src/Peering/test/Get-AzPeering.Recording.json create mode 100644 src/Peering/test/Get-AzPeering.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringAsn.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringAsn.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringCdnPrefix.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringCdnPrefix.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringConnectionMonitorTest.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringLegacy.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringLocation.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringLocation.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringReceivedRoute.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringReceivedRoute.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringRegisteredAsn.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringRegisteredAsn.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringRegisteredPrefix.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringRegisteredPrefix.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringRpUnbilledPrefix.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringRpUnbilledPrefix.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringService.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringService.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringServiceCountry.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringServiceCountry.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringServiceLocation.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringServiceLocation.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringServicePrefix.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringServicePrefix.Tests.ps1 create mode 100644 src/Peering/test/Get-AzPeeringServiceProvider.Recording.json create mode 100644 src/Peering/test/Get-AzPeeringServiceProvider.Tests.ps1 create mode 100644 src/Peering/test/Initialize-AzPeeringServiceConnectionMonitor.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeering.Recording.json create mode 100644 src/Peering/test/New-AzPeering.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringAsn.Recording.json create mode 100644 src/Peering/test/New-AzPeeringAsn.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringCheckServiceProviderAvailabilityInputObject.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringConnectionMonitorTest.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringContactDetailObject.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringDirectConnectionObject.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringExchangeConnectionObject.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringRegisteredAsn.Recording.json create mode 100644 src/Peering/test/New-AzPeeringRegisteredAsn.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringRegisteredPrefix.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringService.Recording.json create mode 100644 src/Peering/test/New-AzPeeringService.Tests.ps1 create mode 100644 src/Peering/test/New-AzPeeringServicePrefix.Tests.ps1 create mode 100644 src/Peering/test/README.md create mode 100644 src/Peering/test/Remove-AzPeering.Recording.json create mode 100644 src/Peering/test/Remove-AzPeering.Tests.ps1 create mode 100644 src/Peering/test/Remove-AzPeeringAsn.Recording.json create mode 100644 src/Peering/test/Remove-AzPeeringAsn.Tests.ps1 create mode 100644 src/Peering/test/Remove-AzPeeringConnectionMonitorTest.Tests.ps1 create mode 100644 src/Peering/test/Remove-AzPeeringRegisteredAsn.Recording.json create mode 100644 src/Peering/test/Remove-AzPeeringRegisteredAsn.Tests.ps1 create mode 100644 src/Peering/test/Remove-AzPeeringRegisteredPrefix.Recording.json create mode 100644 src/Peering/test/Remove-AzPeeringRegisteredPrefix.Tests.ps1 create mode 100644 src/Peering/test/Remove-AzPeeringService.Recording.json create mode 100644 src/Peering/test/Remove-AzPeeringService.Tests.ps1 create mode 100644 src/Peering/test/Remove-AzPeeringServicePrefix.Recording.json create mode 100644 src/Peering/test/Remove-AzPeeringServicePrefix.Tests.ps1 create mode 100644 src/Peering/test/Start-AzPeeringInvokeLookingGlass.Recording.json create mode 100644 src/Peering/test/Start-AzPeeringInvokeLookingGlass.Tests.ps1 create mode 100644 src/Peering/test/Test-AzPeeringRegisteredPrefix.Recording.json create mode 100644 src/Peering/test/Test-AzPeeringRegisteredPrefix.Tests.ps1 create mode 100644 src/Peering/test/Test-AzPeeringServiceProviderAvailability.Recording.json create mode 100644 src/Peering/test/Test-AzPeeringServiceProviderAvailability.Tests.ps1 create mode 100644 src/Peering/test/Update-AzPeering.Recording.json create mode 100644 src/Peering/test/Update-AzPeering.Tests.ps1 create mode 100644 src/Peering/test/Update-AzPeeringService.Recording.json create mode 100644 src/Peering/test/Update-AzPeeringService.Tests.ps1 create mode 100644 src/Peering/test/env.json create mode 100644 src/Peering/test/envDogfood.json create mode 100644 src/Peering/test/loadEnv.ps1 create mode 100644 src/Peering/test/loadEnvDogfood.ps1 create mode 100644 src/Peering/test/utils.ps1 create mode 100644 src/Peering/utils/Unprotect-SecureString.ps1 diff --git a/src/Peering/Az.Peering.csproj b/src/Peering/Az.Peering.csproj new file mode 100644 index 000000000000..f109277f49e1 --- /dev/null +++ b/src/Peering/Az.Peering.csproj @@ -0,0 +1,8 @@ + + + Peering + + + + + diff --git a/src/Peering/Az.Peering.format.ps1xml b/src/Peering/Az.Peering.format.ps1xml new file mode 100644 index 000000000000..028aa8b9260e --- /dev/null +++ b/src/Peering/Az.Peering.format.ps1xml @@ -0,0 +1,2289 @@ + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.PeeringIdentity + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.PeeringIdentity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ConnectionMonitorTestName + + + PeerAsnName + + + PeeringName + + + PeeringServiceName + + + PrefixName + + + RegisteredAsnName + + + RegisteredPrefixName + + + ResourceGroupName + + + SubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSession + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSession + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MaxPrefixesAdvertisedV4 + + + MaxPrefixesAdvertisedV6 + + + Md5AuthenticationKey + + + MicrosoftSessionIPv4Address + + + MicrosoftSessionIPv6Address + + + PeerSessionIPv4Address + + + PeerSessionIPv6Address + + + SessionPrefixV4 + + + SessionPrefixV6 + + + SessionStateV4 + + + SessionStateV6 + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefix + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefix + + + + + + + + + + + + + + + + + + + + + + + + Prefix + + + AzureRegion + + + AzureService + + + IsPrimaryRegion + + + BgpCommunity + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixProperties + + + + + + + + + + + + + + + + + + + + + + + + AzureRegion + + + AzureService + + + BgpCommunity + + + IsPrimaryRegion + + + Prefix + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput + + + + + + + + + + + + + + + PeeringServiceLocation + + + PeeringServiceProvider + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTest + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTest + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Destination + + + DestinationPort + + + IsTestSuccessful + + + Path + + + ProvisioningState + + + SourceAgent + + + TestFrequencyInSec + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail + + + + + + + + + + + + + + + + + + Email + + + Phone + + + Role + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BandwidthInMbps + + + ConnectionIdentifier + + + ConnectionState + + + ErrorMessage + + + MicrosoftTrackingId + + + PeeringDbFacilityId + + + ProvisionedBandwidthInMbps + + + SessionAddressProvider + + + UseForPeeringService + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectPeeringFacility + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectPeeringFacility + + + + + + + + + + + + + + + + + + + + + Address + + + DirectPeeringType + + + PeeringDbFacilityId + + + PeeringDbFacilityLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorDetail + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorDetail + + + + + + + + + + + + + + + Code + + + Message + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection + + + + + + + + + + + + + + + + + + + + + ConnectionIdentifier + + + ConnectionState + + + ErrorMessage + + + PeeringDbFacilityId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangePeeringFacility + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangePeeringFacility + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BandwidthInMbps + + + ExchangeName + + + FacilityIPv4Prefix + + + FacilityIPv6Prefix + + + MicrosoftIPv4Address + + + MicrosoftIPv6Address + + + PeeringDbFacilityId + + + PeeringDbFacilityLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LogAnalyticsWorkspaceProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LogAnalyticsWorkspaceProperties + + + + + + + + + + + + + + + + + + ConnectedAgent + + + Key + + + WorkspaceId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LookingGlassOutput + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LookingGlassOutput + + + + + + + + + + + + + + + Command + + + Output + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricDimension + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricDimension + + + + + + + + + + + + + + + DisplayName + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricSpecification + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricSpecification + + + + + + + + + + + + + + + + + + + + + + + + + + + AggregationType + + + DisplayDescription + + + DisplayName + + + Name + + + SupportedTimeGrainType + + + Unit + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Operation + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Operation + + + + + + + + + + + + + + + IsDataAction + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationDisplayInfo + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationDisplayInfo + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsn + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsn + + + + + + + + + + + + + + + + + + + + + + + + Name + + + PeerName + + + PropertiesPeerAsn + + + ValidationState + + + PeerContactDetail + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnProperties + + + + + + + + + + + + + + + + + + + + + ErrorMessage + + + PeerAsn + + + PeerName + + + ValidationState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Peering + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Peering + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + SkuName + + + Kind + + + PeeringLocation + + + ProvisioningState + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringBandwidthOffer + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringBandwidthOffer + + + + + + + + + + + + + + + OfferName + + + ValueInMbps + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocation + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocation + + + + + + + + + + + + + + + + + + + + + Name + + + Country + + + AzureRegion + + + Kind + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationProperties + + + + + + + + + + + + + + + + + + AzureRegion + + + Country + + + PeeringLocation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringProperties + + + + + + + + + + + + + + + PeeringLocation + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesDirect + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesDirect + + + + + + + + + + + + + + + DirectPeeringType + + + UseForPeeringService + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringReceivedRoute + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringReceivedRoute + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AsPath + + + NextHop + + + OriginAsValidationState + + + Prefix + + + ReceivedTimestamp + + + RpkiValidationState + + + TrustAnchor + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringReceivedRouteListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringReceivedRouteListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsn + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsn + + + + + + + + + + + + + + + + + + + + + Name + + + Asn + + + PeeringServicePrefixKey + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnProperties + + + + + + + + + + + + + + + + + + Asn + + + PeeringServicePrefixKey + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefix + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefix + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Prefix + + + PeeringServicePrefixKey + + + PrefixValidationState + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixProperties + + + + + + + + + + + + + + + + + + + + + + + + ErrorMessage + + + PeeringServicePrefixKey + + + Prefix + + + PrefixValidationState + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringService + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringService + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + ResourceGroupName + + + PeeringServiceLocation + + + Provider + + + ProvisioningState + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceCountry + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceCountry + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceCountryListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceCountryListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocation + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocation + + + + + + + + + + + + + + + + + + + + + Name + + + State + + + Country + + + AzureRegion + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationProperties + + + + + + + + + + + + + + + + + + AzureRegion + + + Country + + + State + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefix + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefix + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Prefix + + + Key + + + PrefixValidationState + + + LearnedType + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixEvent + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixEvent + + + + + + + + + + + + + + + + + + + + + + + + EventDescription + + + EventLevel + + + EventSummary + + + EventTimestamp + + + EventType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + ErrorMessage + + + LearnedType + + + PeeringServicePrefixKey + + + Prefix + + + PrefixValidationState + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProperties + + + + + + + + + + + + + + + + + + + + + + + + PeeringServiceLocation + + + PeeringServiceProvider + + + ProviderBackupPeeringLocation + + + ProviderPrimaryPeeringLocation + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProvider + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProvider + + + + + + + + + + + + + + + + + + Name + + + PeeringLocation + + + ServiceProviderName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderProperties + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderProperties + + + + + + + + + + + + + + + PeeringLocation + + + ServiceProviderName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceSku + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceSku + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceTags + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringSku + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringSku + + + + + + + + + + + + + + + + + + + + + Family + + + Name + + + Size + + + Tier + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringTags + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTags + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.RpUnbilledPrefix + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.RpUnbilledPrefix + + + + + + + + + + + + + + + + + + Prefix + + + AzureRegion + + + PeerAsn + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.RpUnbilledPrefixListResult + + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.RpUnbilledPrefixListResult + + + + + + + + + + + + NextLink + + + + + + + + \ No newline at end of file diff --git a/src/Peering/Az.Peering.psd1 b/src/Peering/Az.Peering.psd1 new file mode 100644 index 000000000000..3024d5d46938 --- /dev/null +++ b/src/Peering/Az.Peering.psd1 @@ -0,0 +1,155 @@ +# +# Module manifest for module 'Az.Peering' +# +# Generated by: Microsoft Corporation +# +# Generated on: 1/30/2023 +# + +@{ + +# Script module or binary module file associated with this manifest. +RootModule = './Az.Peering.psm1' + +# Version number of this module. +ModuleVersion = '0.1.0' + +# Supported PSEditions +CompatiblePSEditions = 'Core', 'Desktop' + +# ID used to uniquely identify this module +GUID = '78c6a853-5ea3-4374-9c5f-5b532d62c892' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = 'Microsoft Corporation. All rights reserved.' + +# Description of the functionality provided by this module +Description = 'Microsoft Azure PowerShell: Peering cmdlets' + +# Minimum version of the PowerShell engine required by this module +PowerShellVersion = '5.1' + +# Name of the PowerShell host required by this module +# PowerShellHostName = '' + +# Minimum version of the PowerShell host required by this module +# PowerShellHostVersion = '' + +# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +DotNetFrameworkVersion = '4.7.2' + +# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# ClrVersion = '' + +# Processor architecture (None, X86, Amd64) required by this module +# ProcessorArchitecture = '' + +# Modules that must be imported into the global environment prior to importing this module +RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.11.1'; }) + +# Assemblies that must be loaded prior to importing this module +RequiredAssemblies = './bin/Az.Peering.private.dll' + +# Script files (.ps1) that are run in the caller's environment prior to importing this module. +# ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +# TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +FormatsToProcess = './Az.Peering.format.ps1xml' + +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess +# NestedModules = @() + +# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. +FunctionsToExport = 'Get-AzPeering', 'Get-AzPeeringAsn', 'Get-AzPeeringCdnPrefix', + 'Get-AzPeeringConnectionMonitorTest', 'Get-AzPeeringLegacy', + 'Get-AzPeeringLocation', 'Get-AzPeeringReceivedRoute', + 'Get-AzPeeringRegisteredAsn', 'Get-AzPeeringRegisteredPrefix', + 'Get-AzPeeringRpUnbilledPrefix', 'Get-AzPeeringService', + 'Get-AzPeeringServiceCountry', 'Get-AzPeeringServiceLocation', + 'Get-AzPeeringServicePrefix', 'Get-AzPeeringServiceProvider', + 'Initialize-AzPeeringServiceConnectionMonitor', 'New-AzPeering', + 'New-AzPeeringAsn', + 'New-AzPeeringCheckServiceProviderAvailabilityInputObject', + 'New-AzPeeringConnectionMonitorTest', + 'New-AzPeeringContactDetailObject', + 'New-AzPeeringDirectConnectionObject', + 'New-AzPeeringExchangeConnectionObject', + 'New-AzPeeringRegisteredAsn', 'New-AzPeeringRegisteredPrefix', + 'New-AzPeeringService', 'New-AzPeeringServicePrefix', + 'Remove-AzPeering', 'Remove-AzPeeringAsn', + 'Remove-AzPeeringConnectionMonitorTest', + 'Remove-AzPeeringRegisteredAsn', 'Remove-AzPeeringRegisteredPrefix', + 'Remove-AzPeeringService', 'Remove-AzPeeringServicePrefix', + 'Start-AzPeeringInvokeLookingGlass', + 'Test-AzPeeringRegisteredPrefix', + 'Test-AzPeeringServiceProviderAvailability', 'Update-AzPeering', + 'Update-AzPeeringService' + +# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. +CmdletsToExport = @() + +# Variables to export from this module +# VariablesToExport = @() + +# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. +AliasesToExport = '*' + +# DSC resources to export from this module +# DscResourcesToExport = @() + +# List of all modules packaged with this module +# ModuleList = @() + +# List of all files packaged with this module +# FileList = @() + +# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. +PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = 'Azure','ResourceManager','ARM','PSModule','Peering' + + # A URL to the license for this module. + LicenseUri = 'https://aka.ms/azps-license' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/Azure/azure-powershell' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + # Prerelease string of this module + # Prerelease = '' + + # Flag to indicate whether the module requires explicit user acceptance for install/update/save + # RequireLicenseAcceptance = $false + + # External dependent modules of this module + # ExternalModuleDependencies = @() + + } # End of PSData hashtable + + } # End of PrivateData hashtable + +# HelpInfo URI of this module +# HelpInfoURI = '' + +# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. +# DefaultCommandPrefix = '' + +} + diff --git a/src/Peering/Az.Peering.psm1 b/src/Peering/Az.Peering.psm1 new file mode 100644 index 000000000000..f3db634a5816 --- /dev/null +++ b/src/Peering/Az.Peering.psm1 @@ -0,0 +1,115 @@ +# region Generated + # ---------------------------------------------------------------------------------- + # 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. + # ---------------------------------------------------------------------------------- + # Load required Az.Accounts module + $accountsName = 'Az.Accounts' + $accountsModule = Get-Module -Name $accountsName + if(-not $accountsModule) { + $localAccountsPath = Join-Path $PSScriptRoot 'generated\modules' + if(Test-Path -Path $localAccountsPath) { + $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1 + if($localAccounts) { + $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru + } + } + if(-not $accountsModule) { + $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0 + if($hasAdequateVersion) { + $accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru + } + } + } + + if(-not $accountsModule) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://docs.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop + } elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop + } + Write-Information "Loaded Module '$($accountsModule.Name)'" + + # Load the private module dll + $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.Peering.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Module]::Instance + + # Ask for the shared functionality table + $VTable = Register-AzModule + + # Tweaks the pipeline on module load + $instance.OnModuleLoad = $VTable.OnModuleLoad + + # Following two delegates are added for telemetry + $instance.GetTelemetryId = $VTable.GetTelemetryId + $instance.Telemetry = $VTable.Telemetry + + + # Tweaks the pipeline per call + $instance.OnNewRequest = $VTable.OnNewRequest + + # Gets shared parameter values + $instance.GetParameterValue = $VTable.GetParameterValue + + # Allows shared module to listen to events from this module + $instance.EventListener = $VTable.EventListener + + # Gets shared argument completers + $instance.ArgumentCompleter = $VTable.ArgumentCompleter + + # The name of the currently selected Azure profile + $instance.ProfileName = $VTable.ProfileName + + + # Load the custom module + $customModulePath = Join-Path $PSScriptRoot './custom/Az.Peering.custom.psm1' + if(Test-Path $customModulePath) { + $null = Import-Module -Name $customModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = Join-Path $PSScriptRoot './exports' + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } + + # Finalize initialization of this module + $instance.Init(); + Write-Information "Loaded Module '$($instance.Name)'" +# endregion diff --git a/src/Peering/Changelog.md b/src/Peering/Changelog.md new file mode 100644 index 000000000000..a5bb0f5ac385 --- /dev/null +++ b/src/Peering/Changelog.md @@ -0,0 +1,24 @@ + +## Upcoming Release + +## Version 0.1.0 +* First preview release for module Az.Peering + diff --git a/src/Peering/Peering.sln b/src/Peering/Peering.sln new file mode 100644 index 000000000000..bc344934ca58 --- /dev/null +++ b/src/Peering/Peering.sln @@ -0,0 +1,58 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{F667231F-2E61-4073-A344-089AA1143A4D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{2561C9D5-C26A-445A-BEF5-6C3D14AAB943}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{4D83F5AB-8C90-44BB-8472-9BB102AC1FDD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{B16E67AF-2829-4A77-991E-9E68E3BFFD44}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{A7492AB5-BD93-41D1-A087-0491E53F36DF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{E707E9BE-792F-4505-8835-4891A0C24919}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Peering", "Az.Peering.csproj", "{2792EF2D-6752-4768-BD06-56D8ADE95E98}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F667231F-2E61-4073-A344-089AA1143A4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F667231F-2E61-4073-A344-089AA1143A4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F667231F-2E61-4073-A344-089AA1143A4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F667231F-2E61-4073-A344-089AA1143A4D}.Release|Any CPU.Build.0 = Release|Any CPU + {2561C9D5-C26A-445A-BEF5-6C3D14AAB943}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2561C9D5-C26A-445A-BEF5-6C3D14AAB943}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2561C9D5-C26A-445A-BEF5-6C3D14AAB943}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2561C9D5-C26A-445A-BEF5-6C3D14AAB943}.Release|Any CPU.Build.0 = Release|Any CPU + {4D83F5AB-8C90-44BB-8472-9BB102AC1FDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D83F5AB-8C90-44BB-8472-9BB102AC1FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D83F5AB-8C90-44BB-8472-9BB102AC1FDD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D83F5AB-8C90-44BB-8472-9BB102AC1FDD}.Release|Any CPU.Build.0 = Release|Any CPU + {B16E67AF-2829-4A77-991E-9E68E3BFFD44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B16E67AF-2829-4A77-991E-9E68E3BFFD44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B16E67AF-2829-4A77-991E-9E68E3BFFD44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B16E67AF-2829-4A77-991E-9E68E3BFFD44}.Release|Any CPU.Build.0 = Release|Any CPU + {A7492AB5-BD93-41D1-A087-0491E53F36DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7492AB5-BD93-41D1-A087-0491E53F36DF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7492AB5-BD93-41D1-A087-0491E53F36DF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7492AB5-BD93-41D1-A087-0491E53F36DF}.Release|Any CPU.Build.0 = Release|Any CPU + {E707E9BE-792F-4505-8835-4891A0C24919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E707E9BE-792F-4505-8835-4891A0C24919}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E707E9BE-792F-4505-8835-4891A0C24919}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E707E9BE-792F-4505-8835-4891A0C24919}.Release|Any CPU.Build.0 = Release|Any CPU + {2792EF2D-6752-4768-BD06-56D8ADE95E98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2792EF2D-6752-4768-BD06-56D8ADE95E98}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2792EF2D-6752-4768-BD06-56D8ADE95E98}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2792EF2D-6752-4768-BD06-56D8ADE95E98}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/Peering/Properties/AssemblyInfo.cs b/src/Peering/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..ddacfaea526d --- /dev/null +++ b/src/Peering/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Peering")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] +[assembly: Guid("354e399e-5975-4d1d-9ad1-739c1259dd79")] +[assembly: AssemblyVersion("0.1.0")] +[assembly: AssemblyFileVersion("0.1.0")] diff --git a/src/Peering/README.md b/src/Peering/README.md new file mode 100644 index 000000000000..5164e13b7ccd --- /dev/null +++ b/src/Peering/README.md @@ -0,0 +1,239 @@ + +# Az.Peering +This directory contains the PowerShell module for the Peering service. + +--- +## Status +[![Az.Peering](https://img.shields.io/powershellgallery/v/Az.Peering.svg?style=flat-square&label=Az.Peering "Az.Peering")](https://www.powershellgallery.com/packages/Az.Peering/) + +## 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.7.5 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.Peering`, see [how-to.md](how-to.md). + + +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +# Please specify the commit id that includes your features to make sure generated codes stable. +branch: 5fc05d0f0b15cbf16de942cadce464b495c66a58 +require: +# readme.azure.noprofile.md is the common configuration file + - $(this-folder)/../readme.azure.noprofile.md +input-file: +# You need to specify your swagger files here. + - $(repo)/specification/peering/resource-manager/Microsoft.Peering/stable/2022-10-01/peering.json +# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally +# - (this-folder)/relative-path-to-your-swagger + +# For new RP, the version is 0.1.0 +module-version: 0.1.0 +# Normally, title is the service name +title: Peering +subject-prefix: $(service-name) + +# If there are post APIs for some kinds of actions in the RP, you may need to +# uncomment following line to support viaIdentity for these post APIs +resourcegroup-append: true +identity-correction-for-post: true +nested-object-to-string: true + +directive: + # 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 + # Change cmdlet verb: Invoke-AzPeeringInvokeLookingGlass -> Start-AzPeeringInvokeLookingGlass + - where: + verb: Invoke + subject: ^InvokeLookingGlass$ + set: + verb: Start + # Change cmdlet subject: *-AzPeeringPeerAsn -> *-AzPeeringAsn + - where: + subject-prefix: Peering + subject: PeerAsn + set: + subject: Asn + # Change cmdlet: *-AzPeeringLegacyPeering -> *-AzPeeringLegacy + - where: + subject-prefix: Peering + subject: LegacyPeering + set: + subject: Legacy + # Change cmdlet: *-AzPeeringCdnPeeringPrefix -> *-AzPeeringCdnPrefix + - where: + subject-prefix: Peering + subject: CdnPeeringPrefix + set: + subject: CdnPrefix + # Change cmdlet: *-AzPeeringPrefix -> *-AzPeeringServicePrefix + - where: + subject-prefix: Peering + subject: Prefix + set: + subject: ServicePrefix + + # Some parameter is Array, so we need to change it and custom it + # ExchangeConnection: New-AzPeeringExchangeConnectionObject + # DirectConnection: New-AzPeeringDirectConnectionObject + # ContactDetail: New-AzPeeringContactDetailObject + # CheckServiceProviderAvailabilityInput: New-AzPeeringCheckServiceProviderAvailabilityInputObject + # eg: + # New-AzPeering [-DirectConnection ] + # $directConnection = New-AzPeeringDirectConnectionObject ...... + # New-AzPeering -DirectConnection $directConnection ...... + - model-cmdlet: + - ExchangeConnection + - DirectConnection + - ContactDetail + - CheckServiceProviderAvailabilityInput + + # Change all parameters named SkuName(SkuName -> Sku) and add the alias SkuName to Sku + - where: + parameter-name: SkuName + set: + parameter-name: Sku + alias: SkuName + + # Parameter information to be displayed after the command is returned + # module-name source: .\azure-powershell\src\Peering\exports\Get-AzPeerAsn.ps1 Line 51 [IPeerAsn] + - where: + model-name: PeerAsn + set: + format-table: + properties: + - Name + - PeerName + - PropertiesPeerAsn + - ValidationState + - PeerContactDetail + resource: + - Id + - where: + model-name: CdnPeeringPrefix + set: + format-table: + properties: + - Prefix + - AzureRegion + - AzureService + - IsPrimaryRegion + - BgpCommunity + - where: + model-name: Peering + set: + format-table: + properties: + - Name + - SkuName + - Kind + - PeeringLocation + - ProvisioningState + - Location + - where: + model-name: PeeringLocation + set: + format-table: + properties: + - Name + - Country + - AzureRegion + - Kind + - where: + model-name: PeeringRegisteredAsn + set: + format-table: + properties: + - Name + - Asn + - PeeringServicePrefixKey + - ProvisioningState + - where: + model-name: PeeringRegisteredPrefix + set: + format-table: + properties: + - Name + - Prefix + - PeeringServicePrefixKey + - PrefixValidationState + - ProvisioningState + - where: + model-name: PeeringService + set: + format-table: + properties: + - Name + - ResourceGroupName + - PeeringServiceLocation + - Provider + - ProvisioningState + - Location + - where: + model-name: PeeringServiceLocation + set: + format-table: + properties: + - Name + - State + - Country + - AzureRegion + - where: + model-name: PeeringServicePrefix + set: + format-table: + properties: + - Name + - Prefix + - Key + - PrefixValidationState + - LearnedType + - ProvisioningState + - where: + model-name: PeeringServiceProvider + set: + format-table: + properties: + - Name + - PeeringLocation + - ServiceProviderName + - where: + model-name: PeeringExchangeConnectionObject + set: + format-table: + properties: + - Name + - PeeringLocation + - ServiceProviderName + - where: + model-name: RpUnbilledPrefix + set: + format-table: + properties: + - Prefix + - AzureRegion + - PeerAsn +``` diff --git a/src/Peering/build-module.ps1 b/src/Peering/build-module.ps1 new file mode 100644 index 000000000000..c27fdf1be568 --- /dev/null +++ b/src/Peering/build-module.ps1 @@ -0,0 +1,161 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs) +$ErrorActionPreference = 'Stop' + +if($PSEdition -ne 'Core') { + Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.' +} + +if(-not $Isolated -and -not $Debugger) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + + if($LastExitCode -ne 0) { + # Build failed. Don't attempt to run the module. + return + } + + if($Test) { + . (Join-Path $PSScriptRoot 'test-module.ps1') + if($LastExitCode -ne 0) { + # Tests failed. Don't attempt to run the module. + return + } + } + + if($Docs) { + . (Join-Path $PSScriptRoot 'generate-help.ps1') + if($LastExitCode -ne 0) { + # Docs generation failed. Don't attempt to run the module. + return + } + } + + if($Pack) { + . (Join-Path $PSScriptRoot 'pack-module.ps1') + if($LastExitCode -ne 0) { + # Packing failed. Don't attempt to run the module. + return + } + } + + $runModulePath = Join-Path $PSScriptRoot 'run-module.ps1' + if($Code) { + . $runModulePath -Code + } elseif($Run) { + . $runModulePath + } else { + Write-Host -ForegroundColor Cyan "To run this module in an isolated PowerShell session, run the 'run-module.ps1' script or provide the '-Run' parameter to this script." + } + return +} + +$binFolder = Join-Path $PSScriptRoot 'bin' +$objFolder = Join-Path $PSScriptRoot 'obj' + +if(-not $Debugger) { + Write-Host -ForegroundColor Green 'Cleaning build folders...' + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder + + if((Test-Path $binFolder) -or (Test-Path $objFolder)) { + Write-Host -ForegroundColor Cyan 'Did you forget to exit your isolated module session before rebuilding?' + Write-Error 'Unable to clean ''bin'' or ''obj'' folder. A process may have an open handle.' + } + + Write-Host -ForegroundColor Green 'Compiling module...' + $buildConfig = 'Debug' + if($Release) { + $buildConfig = 'Release' + } + dotnet publish $PSScriptRoot --verbosity quiet --configuration $buildConfig /nologo + if($LastExitCode -ne 0) { + Write-Error 'Compilation failed.' + } + + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release') +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.Peering.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} + +# Load DLL to use build-time cmdlets +$null = Import-Module -Name $dll + +$modulePaths = $dll +$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.Peering.custom.psm1' +if(Test-Path $customPsm1) { + $modulePaths = @($dll, $customPsm1) +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(Test-Path $exportsFolder) { + $null = Get-ChildItem -Path $exportsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $exportsFolder + +$internalFolder = Join-Path $PSScriptRoot 'internal' +if(Test-Path $internalFolder) { + $null = Get-ChildItem -Path $internalFolder -Recurse -Exclude '*.psm1', 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $internalFolder + +$psd1 = Join-Path $PSScriptRoot './Az.Peering.psd1' +$guid = Get-ModuleGuid -Psd1Path $psd1 +$moduleName = 'Az.Peering' +$examplesFolder = Join-Path $PSScriptRoot 'examples' +$null = New-Item -ItemType Directory -Force -Path $examplesFolder + +Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...' +$modelCmdlets = @('ExchangeConnection', 'DirectConnection', 'ContactDetail', 'CheckServiceProviderAvailabilityInput') +if ($modelCmdlets.Count -gt 0) { + . (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1') + CreateModelCmdlet($modelCmdlets) +} + +if($NoDocs) { + Write-Host -ForegroundColor Green 'Creating exports...' + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs -ExamplesFolder $examplesFolder +} else { + Write-Host -ForegroundColor Green 'Creating exports and docs...' + $moduleDescription = 'Microsoft Azure PowerShell: Peering cmdlets' + $docsFolder = Join-Path $PSScriptRoot 'docs' + if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue + } + $null = New-Item -ItemType Directory -Force -Path $docsFolder + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid +} + +Write-Host -ForegroundColor Green 'Creating format.ps1xml...' +$formatPs1xml = Join-Path $PSScriptRoot './Az.Peering.format.ps1xml' +Export-FormatPs1xml -FilePath $formatPs1xml + +Write-Host -ForegroundColor Green 'Creating psd1...' +$customFolder = Join-Path $PSScriptRoot 'custom' +Export-Psd1 -ExportsFolder $exportsFolder -CustomFolder $customFolder -Psd1Path $psd1 -ModuleGuid $guid + +Write-Host -ForegroundColor Green 'Creating test stubs...' +$testFolder = Join-Path $PSScriptRoot 'test' +$null = New-Item -ItemType Directory -Force -Path $testFolder +Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFolder $testFolder + +Write-Host -ForegroundColor Green 'Creating example stubs...' +Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder + +Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/src/Peering/check-dependencies.ps1 b/src/Peering/check-dependencies.ps1 new file mode 100644 index 000000000000..c29591c7bfe1 --- /dev/null +++ b/src/Peering/check-dependencies.ps1 @@ -0,0 +1,65 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) { + if($predicate) { + $module = Get-Module -ListAvailable -Name $moduleName + if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0) -or ($requiredVersion -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -eq [System.Version]$requiredVersion } | Measure-Object).Count -eq 0)) { + $null = New-Item -ItemType Directory -Force -Path $path + Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..." + if ($requiredVersion) { + Find-Module -Name $moduleName -RequiredVersion $requiredVersion -Repository PSGallery | Save-Module -Path $path + }elseif($versionMinimum) { + Find-Module -Name $moduleName -MinimumVersion $versionMinimum -Repository PSGallery | Save-Module -Path $path + } else { + Find-Module -Name $moduleName -Repository PSGallery | Save-Module -Path $path + } + } + } +} + +$ProgressPreference = 'SilentlyContinue' +$all = (@($Accounts.IsPresent, $Pester.IsPresent) | Select-Object -Unique | Measure-Object).Count -eq 1 + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.7.5' +DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1' + +$tools = Join-Path $PSScriptRoot 'tools' +$resourceDir = Join-Path $tools 'Resources' +$resourceModule = Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psm1' + +if ($Resources.IsPresent -and ((-not (Test-Path -Path $resourceModule)) -or $RegenerateSupportModule.IsPresent)) { + Write-Host -ForegroundColor Green "Building local Resource module used for test..." + Set-Location $resourceDir + $null = autorest .\README.md --use:@autorest/powershell@3.0.414 --output-folder=$HOME/.PSSharedModules/Resources + $null = Copy-Item custom/* $HOME/.PSSharedModules/Resources/custom/ + Set-Location $HOME/.PSSharedModules/Resources + $null = .\build-module.ps1 + Set-Location $PSScriptRoot +} diff --git a/src/Peering/create-model-cmdlets.ps1 b/src/Peering/create-model-cmdlets.ps1 new file mode 100644 index 000000000000..f8d864b4815d --- /dev/null +++ b/src/Peering/create-model-cmdlets.ps1 @@ -0,0 +1,179 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +function CreateModelCmdlet { + + param([string[]]$Models) + + if ($Models.Count -eq 0) + { + return + } + + $ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models' + $ModuleName = 'Peering' + $OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets' + $null = New-Item -ItemType Directory -Force -Path $OutputDir + + $CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs + $Content = '' + $null = $CsFiles | ForEach-Object -Process { if ($_.Name.Split('.').count -eq 2 ) + { $Content += get-content $_.fullname -raw + } } + + $Tree = [Microsoft.CodeAnalysis.CSharp.SyntaxFactory]::ParseCompilationUnit($Content) + $Nodes = $Tree.ChildNodes().ChildNodes() + foreach ($Model in $Models) + { + $InterfaceNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq "I$Model") } + if ($InterfaceNode.count -eq 0) { + continue + } + # through a queue, we iterate all the parent models. + $Queue = @($InterfaceNode) + $visited = @("I$Model") + $AllInterfaceNodes = @() + while ($Queue.count -ne 0) + { + $AllInterfaceNodes += $Queue[0] + # Baselist contains the direct parent models. + foreach ($parent in $Queue[0].BaseList.Types) + { + if (($parent.Type.Right.Identifier.Value -ne 'IJsonSerializable') -and (-not $visited.Contains($parent.Type.Right.Identifier.Value))) + { + $Queue = [Array]$Queue + ($Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq $parent.Type.Right.Identifier.Value) }) + $visited = [Array]$visited + $parent.Type.Right.Identifier.Value + } + } + $first, $Queue = $Queue + } + + $Namespace = $InterfaceNode.Parent.Name + $ObjectType = $Model + $ObjectTypeWithNamespace = "${Namespace}.${ObjectType}" + # remove duplicated module name + if ($ObjectType.StartsWith($ModuleName)) { + $ModulePrefix = '' + } else { + $ModulePrefix = $ModuleName + } + $OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir + + $ParameterDefineScriptList = New-Object System.Collections.Generic.List[string] + $ParameterAssignScriptList = New-Object System.Collections.Generic.List[string] + foreach ($Node in $AllInterfaceNodes) + { + foreach ($Member in $Node.Members) + { + $Arguments = $Member.AttributeLists.Attributes.ArgumentList.Arguments + $Required = $false + $Description = "" + $Readonly = $False + foreach ($Argument in $Arguments) + { + if ($Argument.NameEquals.Name.Identifier.Value -eq "Required") + { + $Required = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Description") + { + $Description = $Argument.Expression.Token.Value.Trim('.').replace('"', '`"') + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Readonly") + { + $Readonly = $Argument.Expression.Token.Value + } + } + if ($Readonly) + { + continue + } + $Identifier = $Member.Identifier.Value + $Type = $Member.Type.ToString().replace('?', '').Split("::")[-1] + $ParameterDefinePropertyList = New-Object System.Collections.Generic.List[string] + if ($Required) + { + $ParameterDefinePropertyList.Add("Mandatory") + } + if ($Description -ne "") + { + $ParameterDefinePropertyList.Add("HelpMessage=`"${Description}.`"") + } + $ParameterDefineProperty = [System.String]::Join(", ", $ParameterDefinePropertyList) + # check whether completer is needed + $completer = ''; + if($Type.Split('.').Split('.')[-2] -eq 'Support') { + # If Type is an array, need to strip [] + $strippedType = $Type.Replace('[]', '') + $completer += "`n [ArgumentCompleter([${strippedType}])]" + } + $ParameterDefineScript = " + [Parameter($ParameterDefineProperty)]${completer} + [${Type}] + `$${Identifier}" + $ParameterDefineScriptList.Add($ParameterDefineScript) + $ParameterAssignScriptList.Add(" + if (`$PSBoundParameters.ContainsKey('${Identifier}')) { + `$Object.${Identifier} = `$${Identifier} + }") + } + } + $ParameterDefineScript = $ParameterDefineScriptList | Join-String -Separator "," + $ParameterAssignScript = $ParameterAssignScriptList | Join-String -Separator "" + + $Script = " +# ---------------------------------------------------------------------------------- +# 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 ${ObjectType}. +.Description +Create an in-memory object for ${ObjectType}. + +.Outputs +${ObjectTypeWithNamespace} +.Link +https://learn.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object +#> +function New-Az${ModulePrefix}${ObjectType}Object { + [OutputType('${ObjectTypeWithNamespace}')] + [CmdletBinding(PositionalBinding=`$false)] + Param( +${ParameterDefineScript} + ) + + process { + `$Object = [${ObjectTypeWithNamespace}]::New() +${ParameterAssignScript} + return `$Object + } +} +" + Set-Content -Path $OutputPath -Value $Script + } +} diff --git a/src/Peering/custom/Az.Peering.custom.psm1 b/src/Peering/custom/Az.Peering.custom.psm1 new file mode 100644 index 000000000000..3cd45c5addb1 --- /dev/null +++ b/src/Peering/custom/Az.Peering.custom.psm1 @@ -0,0 +1,17 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Peering.private.dll') + + # Load the internal module + $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.Peering.internal.psm1' + if(Test-Path $internalModulePath) { + $null = Import-Module -Name $internalModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export script cmdlets + Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias) +# endregion diff --git a/src/Peering/custom/README.md b/src/Peering/custom/README.md new file mode 100644 index 000000000000..ec560a23208e --- /dev/null +++ b/src/Peering/custom/README.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.Peering` 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.Peering.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.Peering` 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.Peering.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.Peering.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.Peering`. 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.Peering.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.Peering.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.Peering`. +- `Microsoft.Azure.PowerShell.Cmdlets.Peering.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.Peering`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.Peering.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringCheckServiceProviderAvailabilityInputObject.ps1 b/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringCheckServiceProviderAvailabilityInputObject.ps1 new file mode 100644 index 000000000000..ed792154bf3d --- /dev/null +++ b/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringCheckServiceProviderAvailabilityInputObject.ps1 @@ -0,0 +1,53 @@ + +# ---------------------------------------------------------------------------------- +# 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 CheckServiceProviderAvailabilityInput. +.Description +Create an in-memory object for CheckServiceProviderAvailabilityInput. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringCheckServiceProviderAvailabilityInputObject +#> +function New-AzPeeringCheckServiceProviderAvailabilityInputObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="Gets or sets the peering service location.")] + [string] + $PeeringServiceLocation, + [Parameter(HelpMessage="Gets or sets the peering service provider.")] + [string] + $PeeringServiceProvider + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput]::New() + + if ($PSBoundParameters.ContainsKey('PeeringServiceLocation')) { + $Object.PeeringServiceLocation = $PeeringServiceLocation + } + if ($PSBoundParameters.ContainsKey('PeeringServiceProvider')) { + $Object.PeeringServiceProvider = $PeeringServiceProvider + } + return $Object + } +} + diff --git a/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringContactDetailObject.ps1 b/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringContactDetailObject.ps1 new file mode 100644 index 000000000000..a309c3283c2b --- /dev/null +++ b/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringContactDetailObject.ps1 @@ -0,0 +1,60 @@ + +# ---------------------------------------------------------------------------------- +# 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 ContactDetail. +.Description +Create an in-memory object for ContactDetail. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringContactDetailObject +#> +function New-AzPeeringContactDetailObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The e-mail address of the contact.")] + [string] + $Email, + [Parameter(HelpMessage="The phone number of the contact.")] + [string] + $Phone, + [Parameter(HelpMessage="The role of the contact.")] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role] + $Role + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail]::New() + + if ($PSBoundParameters.ContainsKey('Email')) { + $Object.Email = $Email + } + if ($PSBoundParameters.ContainsKey('Phone')) { + $Object.Phone = $Phone + } + if ($PSBoundParameters.ContainsKey('Role')) { + $Object.Role = $Role + } + return $Object + } +} + diff --git a/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringDirectConnectionObject.ps1 b/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringDirectConnectionObject.ps1 new file mode 100644 index 000000000000..bea2a10edfd0 --- /dev/null +++ b/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringDirectConnectionObject.ps1 @@ -0,0 +1,126 @@ + +# ---------------------------------------------------------------------------------- +# 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 DirectConnection. +.Description +Create an in-memory object for DirectConnection. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringDirectConnectionObject +#> +function New-AzPeeringDirectConnectionObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The bandwidth of the connection.")] + [int] + $BandwidthInMbps, + [Parameter(HelpMessage="The maximum number of prefixes advertised over the IPv4 session.")] + [int] + $BgpSessionMaxPrefixesAdvertisedV4, + [Parameter(HelpMessage="The maximum number of prefixes advertised over the IPv6 session.")] + [int] + $BgpSessionMaxPrefixesAdvertisedV6, + [Parameter(HelpMessage="The MD5 authentication key of the session.")] + [string] + $BgpSessionMd5AuthenticationKey, + [Parameter(HelpMessage="The IPv4 session address on Microsoft's end.")] + [string] + $BgpSessionMicrosoftSessionIPv4Address, + [Parameter(HelpMessage="The IPv6 session address on Microsoft's end.")] + [string] + $BgpSessionMicrosoftSessionIPv6Address, + [Parameter(HelpMessage="The IPv4 session address on peer's end.")] + [string] + $BgpSessionPeerSessionIPv4Address, + [Parameter(HelpMessage="The IPv6 session address on peer's end.")] + [string] + $BgpSessionPeerSessionIPv6Address, + [Parameter(HelpMessage="The IPv4 prefix that contains both ends' IPv4 addresses.")] + [string] + $BgpSessionPrefixV4, + [Parameter(HelpMessage="The IPv6 prefix that contains both ends' IPv6 addresses.")] + [string] + $BgpSessionPrefixV6, + [Parameter(HelpMessage="The unique identifier (GUID) for the connection.")] + [string] + $ConnectionIdentifier, + [Parameter(HelpMessage="The PeeringDB.com ID of the facility at which the connection has to be set up.")] + [int] + $PeeringDbFacilityId, + [Parameter(HelpMessage="The field indicating if Microsoft provides session ip addresses.")] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider] + $SessionAddressProvider, + [Parameter(HelpMessage="The flag that indicates whether or not the connection is used for peering service.")] + [bool] + $UseForPeeringService + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection]::New() + + if ($PSBoundParameters.ContainsKey('BandwidthInMbps')) { + $Object.BandwidthInMbps = $BandwidthInMbps + } + if ($PSBoundParameters.ContainsKey('BgpSessionMaxPrefixesAdvertisedV4')) { + $Object.BgpSessionMaxPrefixesAdvertisedV4 = $BgpSessionMaxPrefixesAdvertisedV4 + } + if ($PSBoundParameters.ContainsKey('BgpSessionMaxPrefixesAdvertisedV6')) { + $Object.BgpSessionMaxPrefixesAdvertisedV6 = $BgpSessionMaxPrefixesAdvertisedV6 + } + if ($PSBoundParameters.ContainsKey('BgpSessionMd5AuthenticationKey')) { + $Object.BgpSessionMd5AuthenticationKey = $BgpSessionMd5AuthenticationKey + } + if ($PSBoundParameters.ContainsKey('BgpSessionMicrosoftSessionIPv4Address')) { + $Object.BgpSessionMicrosoftSessionIPv4Address = $BgpSessionMicrosoftSessionIPv4Address + } + if ($PSBoundParameters.ContainsKey('BgpSessionMicrosoftSessionIPv6Address')) { + $Object.BgpSessionMicrosoftSessionIPv6Address = $BgpSessionMicrosoftSessionIPv6Address + } + if ($PSBoundParameters.ContainsKey('BgpSessionPeerSessionIPv4Address')) { + $Object.BgpSessionPeerSessionIPv4Address = $BgpSessionPeerSessionIPv4Address + } + if ($PSBoundParameters.ContainsKey('BgpSessionPeerSessionIPv6Address')) { + $Object.BgpSessionPeerSessionIPv6Address = $BgpSessionPeerSessionIPv6Address + } + if ($PSBoundParameters.ContainsKey('BgpSessionPrefixV4')) { + $Object.BgpSessionPrefixV4 = $BgpSessionPrefixV4 + } + if ($PSBoundParameters.ContainsKey('BgpSessionPrefixV6')) { + $Object.BgpSessionPrefixV6 = $BgpSessionPrefixV6 + } + if ($PSBoundParameters.ContainsKey('ConnectionIdentifier')) { + $Object.ConnectionIdentifier = $ConnectionIdentifier + } + if ($PSBoundParameters.ContainsKey('PeeringDbFacilityId')) { + $Object.PeeringDbFacilityId = $PeeringDbFacilityId + } + if ($PSBoundParameters.ContainsKey('SessionAddressProvider')) { + $Object.SessionAddressProvider = $SessionAddressProvider + } + if ($PSBoundParameters.ContainsKey('UseForPeeringService')) { + $Object.UseForPeeringService = $UseForPeeringService + } + return $Object + } +} + diff --git a/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringExchangeConnectionObject.ps1 b/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringExchangeConnectionObject.ps1 new file mode 100644 index 000000000000..49f4e41e3bba --- /dev/null +++ b/src/Peering/custom/autogen-model-cmdlets/New-AzPeeringExchangeConnectionObject.ps1 @@ -0,0 +1,107 @@ + +# ---------------------------------------------------------------------------------- +# 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 ExchangeConnection. +.Description +Create an in-memory object for ExchangeConnection. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringExchangeConnectionObject +#> +function New-AzPeeringExchangeConnectionObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection')] + [CmdletBinding(PositionalBinding=$false)] + Param( + + [Parameter(HelpMessage="The maximum number of prefixes advertised over the IPv4 session.")] + [int] + $BgpSessionMaxPrefixesAdvertisedV4, + [Parameter(HelpMessage="The maximum number of prefixes advertised over the IPv6 session.")] + [int] + $BgpSessionMaxPrefixesAdvertisedV6, + [Parameter(HelpMessage="The MD5 authentication key of the session.")] + [string] + $BgpSessionMd5AuthenticationKey, + [Parameter(HelpMessage="The IPv4 session address on Microsoft's end.")] + [string] + $BgpSessionMicrosoftSessionIPv4Address, + [Parameter(HelpMessage="The IPv6 session address on Microsoft's end.")] + [string] + $BgpSessionMicrosoftSessionIPv6Address, + [Parameter(HelpMessage="The IPv4 session address on peer's end.")] + [string] + $BgpSessionPeerSessionIPv4Address, + [Parameter(HelpMessage="The IPv6 session address on peer's end.")] + [string] + $BgpSessionPeerSessionIPv6Address, + [Parameter(HelpMessage="The IPv4 prefix that contains both ends' IPv4 addresses.")] + [string] + $BgpSessionPrefixV4, + [Parameter(HelpMessage="The IPv6 prefix that contains both ends' IPv6 addresses.")] + [string] + $BgpSessionPrefixV6, + [Parameter(HelpMessage="The unique identifier (GUID) for the connection.")] + [string] + $ConnectionIdentifier, + [Parameter(HelpMessage="The PeeringDB.com ID of the facility at which the connection has to be set up.")] + [int] + $PeeringDbFacilityId + ) + + process { + $Object = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection]::New() + + if ($PSBoundParameters.ContainsKey('BgpSessionMaxPrefixesAdvertisedV4')) { + $Object.BgpSessionMaxPrefixesAdvertisedV4 = $BgpSessionMaxPrefixesAdvertisedV4 + } + if ($PSBoundParameters.ContainsKey('BgpSessionMaxPrefixesAdvertisedV6')) { + $Object.BgpSessionMaxPrefixesAdvertisedV6 = $BgpSessionMaxPrefixesAdvertisedV6 + } + if ($PSBoundParameters.ContainsKey('BgpSessionMd5AuthenticationKey')) { + $Object.BgpSessionMd5AuthenticationKey = $BgpSessionMd5AuthenticationKey + } + if ($PSBoundParameters.ContainsKey('BgpSessionMicrosoftSessionIPv4Address')) { + $Object.BgpSessionMicrosoftSessionIPv4Address = $BgpSessionMicrosoftSessionIPv4Address + } + if ($PSBoundParameters.ContainsKey('BgpSessionMicrosoftSessionIPv6Address')) { + $Object.BgpSessionMicrosoftSessionIPv6Address = $BgpSessionMicrosoftSessionIPv6Address + } + if ($PSBoundParameters.ContainsKey('BgpSessionPeerSessionIPv4Address')) { + $Object.BgpSessionPeerSessionIPv4Address = $BgpSessionPeerSessionIPv4Address + } + if ($PSBoundParameters.ContainsKey('BgpSessionPeerSessionIPv6Address')) { + $Object.BgpSessionPeerSessionIPv6Address = $BgpSessionPeerSessionIPv6Address + } + if ($PSBoundParameters.ContainsKey('BgpSessionPrefixV4')) { + $Object.BgpSessionPrefixV4 = $BgpSessionPrefixV4 + } + if ($PSBoundParameters.ContainsKey('BgpSessionPrefixV6')) { + $Object.BgpSessionPrefixV6 = $BgpSessionPrefixV6 + } + if ($PSBoundParameters.ContainsKey('ConnectionIdentifier')) { + $Object.ConnectionIdentifier = $ConnectionIdentifier + } + if ($PSBoundParameters.ContainsKey('PeeringDbFacilityId')) { + $Object.PeeringDbFacilityId = $PeeringDbFacilityId + } + return $Object + } +} + diff --git a/src/Peering/examples/Get-AzPeering.md b/src/Peering/examples/Get-AzPeering.md new file mode 100644 index 000000000000..7605f1dade4d --- /dev/null +++ b/src/Peering/examples/Get-AzPeering.md @@ -0,0 +1,33 @@ +### Example 1: List all peerings +```powershell + Get-AzPeering +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +DemoComp1 Premium_Direct_Free Direct Dallas Succeeded South Central US +DemoPeering Premium_Direct_Free Direct Dallas Succeeded South Central US +TestEdgeZone Premium_Direct_Free Direct Atlanta Succeeded East US 2 +MapsIxRs Premium_Direct_Free Direct Ashburn Succeeded East US +DemoMapsConfig Premium_Direct_Free Direct Seattle Succeeded West US 2 +testexchange Basic_Exchange_Free Exchange Amsterdam Succeeded West Europe +TestPeer1 Basic_Direct_Free Direct Amsterdam Succeeded West Europe +test1 Basic_Direct_Free Direct Athens Succeeded France Central +``` + +List all peerings in subscription + +### Example 2: Get specific peering by name and resource group +```powershell +Get-AzPeering -Name DemoPeering -ResourceGroupName DemoRG +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +DemoPeering Premium_Direct_Free Direct Dallas Succeeded South Central US +``` + +Get a specific peering by resource group and name + diff --git a/src/Peering/examples/Get-AzPeeringAsn.md b/src/Peering/examples/Get-AzPeeringAsn.md new file mode 100644 index 000000000000..67d0cc680504 --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringAsn.md @@ -0,0 +1,26 @@ +### Example 1: List PeerAsns +```powershell +Get-AzPeeringAsn +``` + +```output +Name PeerName PropertiesPeerAsn ValidationState PeerContactDetail +---- -------- ----------------- --------------- ----------------- +ContosoEdgeTest Contoso 65000 Approved {{…}} + +``` + +List all the peer asns under subscription + +### Example 2: Get Specific PeerAsn +```powershell +Get-AzPeeringAsn -Name ContosoEdgeTest +``` + +```output +Name PeerName PropertiesPeerAsn ValidationState PeerContactDetail +---- -------- ----------------- --------------- ----------------- +ContosoEdgeTest Contoso 65000 Approved {{…}} +``` + +Get peer asn by name \ No newline at end of file diff --git a/src/Peering/examples/Get-AzPeeringCdnPrefix.md b/src/Peering/examples/Get-AzPeeringCdnPrefix.md new file mode 100644 index 000000000000..f3ed2b2e92a1 --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringCdnPrefix.md @@ -0,0 +1,19 @@ +### Example 1: Get Cdn prefixes +```powershell +Get-AzPeeringCdnPrefix -PeeringLocation Seattle +``` + +```output +Prefix AzureRegion AzureService IsPrimaryRegion BgpCommunity +------ ----------- ------------ --------------- ------------ +20.157.110.0/24 West US 2 AzureCompute True 8069:51026 +20.157.118.0/24 West US 2 AzureCompute True 8069:51026 +20.157.125.0/24 West US 2 AzureCompute True 8069:51026 +20.157.180.0/24 West US 2 AzureStorage True 8069:52026 +20.157.25.0/24 West US 2 AzureCompute True 8069:51026 +20.157.50.0/23 West US 2 AzureStorage True 8069:52026 +20.47.120.0/23 West US 2 AzureCompute True 8069:51026 +20.47.62.0/23 West US 2 AzureStorage True 8069:52026 +``` + +Get all cdn prefixes for subscription diff --git a/src/Peering/examples/Get-AzPeeringConnectionMonitorTest.md b/src/Peering/examples/Get-AzPeeringConnectionMonitorTest.md new file mode 100644 index 000000000000..56053654b293 --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringConnectionMonitorTest.md @@ -0,0 +1,27 @@ +### Example 1: Lists all connection monitor tests +```powershell + Get-AzPeeringConnectionMonitorTest -ResourceGroupName DemoRG -PeeringServiceName DRTest +``` + +```output +SourceAgent Destination DestinationPort TestFrequency Sucessful ProvisioningState +----------- ----------- --------------- ------------- --------- ----------------- +Agent 1 1.1.1.1 80 30 True Succeeded +Agent 2 8.8.8.8 80 30 True Succeeded +``` + +Lists all connection monitor test objects + +### Example 2: Get single connection monitor test +```powershell + Get-AzPeeringConnectionMonitorTest -ResourceGroupName DemoRG -PeeringServiceName DRTest -Name TestName +``` + +```output +SourceAgent Destination DestinationPort TestFrequency Sucessful ProvisioningState +----------- ----------- --------------- ------------- --------- ----------------- +Agent 1 1.1.1.1 80 30 True Succeeded +``` + +Gets a single connection monitor test + diff --git a/src/Peering/examples/Get-AzPeeringLegacy.md b/src/Peering/examples/Get-AzPeeringLegacy.md new file mode 100644 index 000000000000..542fe985425e --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringLegacy.md @@ -0,0 +1,15 @@ +### Example 1: Gets legacy peering object +```powershell +Get-AzPeeringLegacy -Kind Direct -PeeringLocation Seattle +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +DemoComp1 Premium_Direct_Free Direct Dallas Succeeded South Central US +DemoPeering Premium_Direct_Free Direct Dallas Succeeded South Central US +TestEdgeZone Premium_Direct_Free Direct Atlanta Succeeded East US 2 +``` + +Gets legacy peering object + diff --git a/src/Peering/examples/Get-AzPeeringLocation.md b/src/Peering/examples/Get-AzPeeringLocation.md new file mode 100644 index 000000000000..f0dbb3574d60 --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringLocation.md @@ -0,0 +1,21 @@ +### Example 1: Get all direct peering locations +```powershell +Get-AzPeeringLocation -Kind Direct +``` + +```output +Get-AzPeeringLocation -Kind Direct + +Name Country AzureRegion Kind +---- ------- ----------- ---- +Amsterdam NL West Europe Direct +Ashburn US East US Direct +Athens GR France Central Direct +Atlanta US East US 2 Direct +Auckland NZ Australia East Direct +Barcelona ES France Central Direct +Berlin DE West Europe Direct +... +``` + +Gets all peering locations for direct peers \ No newline at end of file diff --git a/src/Peering/examples/Get-AzPeeringReceivedRoute.md b/src/Peering/examples/Get-AzPeeringReceivedRoute.md new file mode 100644 index 000000000000..361226fa518a --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringReceivedRoute.md @@ -0,0 +1,46 @@ +### Example 1: Get all received routes for a specific peering +```powershell +Get-AzPeeringReceivedRoute -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +```output +AsPath NextHop OriginAsValidationState Prefix ReceivedTimestamp RpkiValidationState TrustAnchor +------ ------- ----------------------- ------ ----------------- ------------------- ----------- +7018 13335 12.90.152.69 Valid 1.0.0.0/24 2022-12-05T11:51:51.2062620Z Valid None +7018 13335 12.90.152.69 Valid 1.1.1.0/24 2022-12-05T11:51:51.2062620Z Valid None +7018 4837 4808 12.90.152.69 Valid 1.119.192.0/21 2021-12-07T05:21:11.7043790Z Unknown None +7018 4837 4808 12.90.152.69 Valid 1.119.200.0/22 2021-12-07T05:21:11.7043790Z Unknown None +7018 4837 4808 59034 12.90.152.69 Valid 1.119.204.0/24 2021-12-07T05:21:13.7045170Z Unknown None +7018 9680 9680 3462 12.90.152.69 Valid 1.160.0.0/12 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.160.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.161.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.162.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.163.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 15169 396982 12.90.152.69 Unknown 1.179.112.0/20 2021-12-07T05:21:16.7056160Z Unknown None +7018 9680 9680 3462 12.90.152.69 Valid 1.164.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.165.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.166.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.167.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +... +``` + +Gets all the received routes for a specific peering + +### Example 2: Filter received routes based on optional parameters +```powershell +Get-AzPeeringReceivedRoute -PeeringName DemoPeering -ResourceGroupName DemoRG -AsPath "7018 9680 9680 3462" +``` + +```output +AsPath NextHop OriginAsValidationState Prefix ReceivedTimestamp RpkiValidationState TrustAnchor +------ ------- ----------------------- ------ ----------------- ------------------- ----------- +7018 9680 9680 3462 12.90.152.69 Valid 1.160.0.0/12 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.160.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.161.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.162.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.163.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.164.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +... +``` + +Gets all received routes of a peering with a specific AsPath diff --git a/src/Peering/examples/Get-AzPeeringRegisteredAsn.md b/src/Peering/examples/Get-AzPeeringRegisteredAsn.md new file mode 100644 index 000000000000..0304a5632e38 --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringRegisteredAsn.md @@ -0,0 +1,28 @@ +### Example 1: List all registered asns for peering +```powershell +Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo +``` + +```output +Name Asn PeeringServicePrefixKey ProvisioningState +---- --- ----------------------- ----------------- +fgfg 6500 767c9f30-7388-49ef-ba8e-e2d16d1c08e4 Succeeded +homedepottest 65000 32259ee0-ea01-495e-8279-06c24ef7aae0 Succeeded +JonOrmondTest 62540 e3f552c5-909e-434b-8fab-93e524a1aeed Succeeded +``` + +Lists all registered asn's for a peering + +### Example 2: Get specific registered asn for peering +```powershell +Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Name fgfg +``` + +```output +Name Asn PeeringServicePrefixKey ProvisioningState +---- --- ----------------------- ----------------- +fgfg 6500 767c9f30-7388-49ef-ba8e-e2d16d1c08e4 Succeeded +``` + +Gets a specific registered asn for a peering by name + diff --git a/src/Peering/examples/Get-AzPeeringRegisteredPrefix.md b/src/Peering/examples/Get-AzPeeringRegisteredPrefix.md new file mode 100644 index 000000000000..71206ce88957 --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringRegisteredPrefix.md @@ -0,0 +1,30 @@ +### Example 1: List all registered prefixes for a peering +```powershell +Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +```output +Name Prefix PeeringServicePrefixKey PrefixValidationState ProvisioningState +---- ------ ----------------------- --------------------- ----------------- +accessibilityTesting1 240.0.0.0/24 f5947454-80e3-4ce5-bcb3-2501537b6952 Failed Succeeded +accessibilityTesting2 240.0.1.0/24 249aa0dd-6177-4105-94fe-dfefcbf5ab48 Failed Succeeded +accessibilityTesting3 240.0.2.0/24 4fb59e9e-d4eb-4847-b2ad-9939edda750b Failed Succeeded +accessibilityTesting4 240.0.4.0/24 b725f16c-759b-4144-93ed-ed4eb89cb8f7 Failed Succeeded +accessibilityTesting5 240.0.3.0/24 bb1262ca-0b31-45f3-a301-105b0615b21c Failed Succeeded +``` + +List all registered prefixes + +### Example 2: Get specific registered prefix for a peering +```powershell +Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG -Name accessibilityTesting1 +``` + +```output +Name Prefix PeeringServicePrefixKey PrefixValidationState ProvisioningState +---- ------ ----------------------- --------------------- ----------------- +accessibilityTesting1 240.0.0.0/24 f5947454-80e3-4ce5-bcb3-2501537b6952 Failed Succeeded +``` + +Get a specific registered prefix by name + diff --git a/src/Peering/examples/Get-AzPeeringRpUnbilledPrefix.md b/src/Peering/examples/Get-AzPeeringRpUnbilledPrefix.md new file mode 100644 index 000000000000..25a882591ae6 --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringRpUnbilledPrefix.md @@ -0,0 +1,15 @@ +### Example 1: List all unbilled prefixes for a peering +```powershell +Get-AzPeeringRpUnbilledPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +```output +Prefix AzureRegion PeerASN +------ ----------- ------- +2.16.0.0/13 West US 2 65010 +23.0.0.0/12 West US 2 65010 +... +``` + +Lists all the unbilled prefixes for a peering + diff --git a/src/Peering/examples/Get-AzPeeringService.md b/src/Peering/examples/Get-AzPeeringService.md new file mode 100644 index 000000000000..76231167217b --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringService.md @@ -0,0 +1,53 @@ +### Example 1: List all peering services under subscription +```powershell +Get-AzPeeringService +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +TestPrefixForAtlanta DemoRG Georgia MicrosoftEdge Succeeded East US 2 +TestExtension DemoRG Virginia MicrosoftEdge Succeeded East US +TestExtension2 DemoRG Virginia MicrosoftEdge Succeeded East US +DemoPeeringServiceInterCloudLondon DemoRG London InterCloud Succeeded UK South +DRTestInterCloud DemoRG Ile-de-France InterCloud Succeeded UK South +Gaurav Thareja DemoRG Ile-de-France InterCloud Succeeded UK South +TestDRInterCloudZurich DemoRG Zurich InterCloud Succeeded France Central +DRTest DemoRG Ile-de-France InterCloud Succeeded France Central +``` + +Lists all peering services under default subscription + +### Example 2: List all peering services under a specific resource group +```powershell +Get-AzPeeringService -ResourceGroupName DemoRG +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +TestPrefixForAtlanta DemoRG Georgia MicrosoftEdge Succeeded East US 2 +TestExtension DemoRG Virginia MicrosoftEdge Succeeded East US +TestExtension2 DemoRG Virginia MicrosoftEdge Succeeded East US +DemoPeeringServiceInterCloudLondon DemoRG London InterCloud Succeeded UK South +DRTestInterCloud DemoRG Ile-de-France InterCloud Succeeded UK South +Gaurav Thareja DemoRG Ile-de-France InterCloud Succeeded UK South +TestDRInterCloudZurich DemoRG Zurich InterCloud Succeeded France Central +DRTest DemoRG Ile-de-France InterCloud Succeeded France Central +``` + +Lists all the peering services under a resource group + + +### Example 3: List all peering services under a specific resource group +```powershell +Get-AzPeeringService -ResourceGroupName DemoRG -Name TestExtension +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +TestExtension DemoRG Virginia MicrosoftEdge Succeeded East US +``` + +Gets a peering service with matching name and resource group \ No newline at end of file diff --git a/src/Peering/examples/Get-AzPeeringServiceCountry.md b/src/Peering/examples/Get-AzPeeringServiceCountry.md new file mode 100644 index 000000000000..68a570159682 --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringServiceCountry.md @@ -0,0 +1,27 @@ +### Example 1: Lists all the peering service countries +```powershell +Get-AzPeeringServiceCountry +``` + +```output +Name +---- +Australia +Belgium +Brazil +Canada +Denmark +Finland +France +Germany +Hong Kong +Japan +Kenya +Korea, South +Malaysia +Netherlands +New Zealand +... +``` + +Lists the countries available for peering service. diff --git a/src/Peering/examples/Get-AzPeeringServiceLocation.md b/src/Peering/examples/Get-AzPeeringServiceLocation.md new file mode 100644 index 000000000000..b20d9f58120b --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringServiceLocation.md @@ -0,0 +1,59 @@ +### Example 1: List all peering service locations +```powershell +Get-AzPeeringServiceLocation +``` + +```output +Name State Country AzureRegion +---- ----- ------- ----------- +Obwalden Obwalden Switzerland France Central +Sankt Gallen Sankt Gallen Switzerland France Central +Schaffhausen Schaffhausen Switzerland France Central +Schwyz Schwyz Switzerland France Central +Solothurn Solothurn Switzerland France Central +Thurgau Thurgau Switzerland France Central +Ticino Ticino Switzerland France Central +Uri Uri Switzerland France Central +Valais Valais Switzerland France Central +Vaud Vaud Switzerland France Central +Zug Zug Switzerland France Central +Zurich Zurich Switzerland France Central +Aberdeen City Aberdeen City United Kingdom UK West +Angus Angus United Kingdom UK West +Antrim and Newtownabbey Antrim and Newtownabbey United Kingdom North Europe +Ards and North Down Ards and North Down United Kingdom North Europe +Argyll and Bute Argyll and Bute United Kingdom North Europe +Armagh, Banbridge and Craigavon Armagh, Banbridge and Craigavon United Kingdom North Europe +Barking and Dagenham Barking and Dagenham United Kingdom UK South +... +``` + +Retrieves all peering service locations + +### Example 2: List all peering service +```powershell +Get-AzPeeringServiceLocation -Country Japan +``` + +```output +Name State Country AzureRegion +---- ----- ------- ----------- +Aichi Aichi Japan Japan West +Akita Akita Japan Japan East +Aomori Aomori Japan Japan East +Chiba Chiba Japan Japan East +Ehime Ehime Japan Japan West +Fukui Fukui Japan Japan West +Fukuoka Fukuoka Japan Japan West +Fukushima Fukushima Japan Japan East +Gifu Gifu Japan Japan West +Gunma Gunma Japan Japan East +Hiroshima Hiroshima Japan Japan West +Hyogo Hyogo Japan Japan West +Ibaraki Ibaraki Japan Japan East +Ishikawa Ishikawa Japan Japan West +... +``` + +Retrieves all peering service locations for a specific country + diff --git a/src/Peering/examples/Get-AzPeeringServicePrefix.md b/src/Peering/examples/Get-AzPeeringServicePrefix.md new file mode 100644 index 000000000000..fb1839f724ff --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringServicePrefix.md @@ -0,0 +1,27 @@ +### Example 1: List all peering service prefixes +```powershell +Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG +``` + +```output +Name Prefix Key PrefixValidationState LearnedType ProvisioningState +---- ------ --- --------------------- ----------- ----------------- +TestPrefix 91.194.255.0/24 6a7f0d42-e49c-4eea-a930-280610671c3f Failed None Succeeded +TestPrefix2 240.0.0.0/24 Failed None Succeeded +``` + +Lists all peering service prefixes for the peering service + +### Example 2: Get specific peering service prefix +```powershell +Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG -Name TestPrefix +``` + +```output +Name Prefix Key PrefixValidationState LearnedType ProvisioningState +---- ------ --- --------------------- ----------- ----------------- +TestPrefix 91.194.255.0/24 6a7f0d42-e49c-4eea-a930-280610671c3f Failed None Succeeded +``` + +Gets a specific peering service prefix + diff --git a/src/Peering/examples/Get-AzPeeringServiceProvider.md b/src/Peering/examples/Get-AzPeeringServiceProvider.md new file mode 100644 index 000000000000..c538bad79634 --- /dev/null +++ b/src/Peering/examples/Get-AzPeeringServiceProvider.md @@ -0,0 +1,27 @@ +### Example 1: List all peering service providers +```powershell +Get-AzPeeringServiceProvider +``` + +```output +Name PeeringLocation ServiceProviderName +---- --------------- ------------------- +IIJ {Osaka, Tokyo} IIJ +NTTCom {Osaka, Tokyo} NTTCom +Kordia Limited {Auckland, Sydney} Kordia Limited +Liquid Telecommunications Ltd {Cape Town, Johannesburg, Nairobi} Liquid Telecommunications Ltd +InterCloud {london, Paris, Zurich, Geneva} InterCloud +Computer Concepts Limited {Auckland} Computer Concepts Limited +Singnet {singapore} Singnet +NTT Communications - Flexible InterConnect {Osaka, Tokyo} NTT Communications - Flexible InterConnect +NAPAfrica {Johannesburg, Cape Town} NAPAfrica +Vocusgroup NZ {Sydney, Auckland} Vocusgroup NZ +CMC NETWORKS {Johannesburg, Nairobi, cape Town} CMC NETWORKS +MainOne {Lisbon, Lagos} MainOne +Swisscom Switzerland Ltd {Geneva, Zurich} Swisscom Switzerland Ltd +DE-CIX {Frankfurt, Marseille, Newark, Madrid…} DE-CIX +Lumen Technologies {denver, los Angeles} Lumen Technologies +Colt Technology Services {Amsterdam, Barcelona, Berlin, Frankfurt…} Colt Technology Services +``` + +Lists all peering service providers diff --git a/src/Peering/examples/Initialize-AzPeeringServiceConnectionMonitor.md b/src/Peering/examples/Initialize-AzPeeringServiceConnectionMonitor.md new file mode 100644 index 000000000000..83cffda30bfb --- /dev/null +++ b/src/Peering/examples/Initialize-AzPeeringServiceConnectionMonitor.md @@ -0,0 +1,7 @@ +### Example 1: Initialize connection monitor functionality +```powershell +Initialize-AzPeeringServiceConnectionMonitor +``` + +Initialize connection monitor functionality + diff --git a/src/Peering/examples/New-AzPeering.md b/src/Peering/examples/New-AzPeering.md new file mode 100644 index 000000000000..92611b124e0a --- /dev/null +++ b/src/Peering/examples/New-AzPeering.md @@ -0,0 +1,15 @@ +### Example 1: Create a new direct peering object +```powershell +$connection1 = New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 ... +$directConnections = ,$connection1 +New-AzPeering -Name TestPeeringPs -ResourceGroupName DemoRG -Kind Direct -Location "South Central US" -DirectConnection $directConnections -DirectPeeringType Cdn -DirectPeerAsnId $peerAsnId -PeeringLocation Dallas -Sku Premium_Direct_Unlimited +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +TestPeering Premium_Direct_Unlimited Direct Dallas Succeeded South Central US +``` + +Create a new direct peering object + diff --git a/src/Peering/examples/New-AzPeeringAsn.md b/src/Peering/examples/New-AzPeeringAsn.md new file mode 100644 index 000000000000..ed0fc5314bf7 --- /dev/null +++ b/src/Peering/examples/New-AzPeeringAsn.md @@ -0,0 +1,15 @@ +### Example 1: Create a new peering asn +```powershell +$contactDetail = New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" +$PeerContactList = ,$contactDetail +New-AzPeeringAsn -Name PsTestAsn -PeerAsn 65001 -PeerContactDetail $PeerContactList -PeerName DemoPeering +``` + +```output +Name PeerName PropertiesPeerAsn ValidationState PeerContactDetail +---- -------- ----------------- --------------- ----------------- +PsTestAsn DemoPeering 65001 Pending {{… +``` + +Create a new peering asn with the specified properties + diff --git a/src/Peering/examples/New-AzPeeringCheckServiceProviderAvailabilityInputObject.md b/src/Peering/examples/New-AzPeeringCheckServiceProviderAvailabilityInputObject.md new file mode 100644 index 000000000000..052651e8ff92 --- /dev/null +++ b/src/Peering/examples/New-AzPeeringCheckServiceProviderAvailabilityInputObject.md @@ -0,0 +1,12 @@ +### Example 1: Create a check service provider availability object +```powershell +New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ +``` + +```output +PeeringServiceLocation PeeringServiceProvider +---------------------- ---------------------- +Osaka IIJ +``` + +Creates a CheckServiceProviderAvailabilityInputObject with the specified location and provider and stores it in memory diff --git a/src/Peering/examples/New-AzPeeringConnectionMonitorTest.md b/src/Peering/examples/New-AzPeeringConnectionMonitorTest.md new file mode 100644 index 000000000000..1a5345898975 --- /dev/null +++ b/src/Peering/examples/New-AzPeeringConnectionMonitorTest.md @@ -0,0 +1,13 @@ +### Example 1: Create a new connection monitor test +```powershell +New-AzPeeringConnectionMonitorTest -Name TestName -PeeringServiceName DRTest -ResourceGroupName DemoRG +``` + +```output +SourceAgent Destination DestinationPort TestFrequency Sucessful ProvisioningState +----------- ----------- --------------- ------------- --------- ----------------- +Agent 1 1.1.1.1 80 30 True Succeeded +``` + +Creates a connection monitor test for the peering service + diff --git a/src/Peering/examples/New-AzPeeringContactDetailObject.md b/src/Peering/examples/New-AzPeeringContactDetailObject.md new file mode 100644 index 000000000000..f7de3ccfb7ce --- /dev/null +++ b/src/Peering/examples/New-AzPeeringContactDetailObject.md @@ -0,0 +1,13 @@ +### Example 1: Create a Contact Detail object +```powershell +New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" +``` + +```output +Email Phone Role +----- ----- ---- +abc@xyz.com 1234567890 Noc +``` + +Creates a ContactDetail object with the specified email phone and role stores it in memory + diff --git a/src/Peering/examples/New-AzPeeringDirectConnectionObject.md b/src/Peering/examples/New-AzPeeringDirectConnectionObject.md new file mode 100644 index 000000000000..6111c9a7ea49 --- /dev/null +++ b/src/Peering/examples/New-AzPeeringDirectConnectionObject.md @@ -0,0 +1,14 @@ +### Example 1: Create a direct connection object +```powershell +New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 1.1.1.1 -BgpSessionPeerSessionIPv4Address 1.1.1.0 -BgpSessionPrefixV4 1.1.1.1/31 -PeeringDbFacilityId 82 -SessionAddressProvider Peer -ConnectionIdentifier c111111111111 +``` + +```output +BandwidthInMbps ConnectionIdentifier ConnectionState ErrorMessage MicrosoftTrackingId PeeringDbFacilityId ProvisionedBandwidthInMbps ... [more fields] +--------------- -------------------- --------------- ------------ ------------------- ------------------- -------------------------- ... ------------- +10000 c111111111111 PendingApproval 82 + +``` + +Creates an in-memory direct connection object + diff --git a/src/Peering/examples/New-AzPeeringExchangeConnectionObject.md b/src/Peering/examples/New-AzPeeringExchangeConnectionObject.md new file mode 100644 index 000000000000..9f16da1f1357 --- /dev/null +++ b/src/Peering/examples/New-AzPeeringExchangeConnectionObject.md @@ -0,0 +1,13 @@ +### Example 1: Create an exchange connection object +```powershell +New-AzPeeringExchangeConnectionObject -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 1.1.1.1 -BgpSessionPeerSessionIPv4Address 1.1.1.0 -BgpSessionPrefixV4 1.1.1.1/31 -PeeringDbFacilityId 82 -ConnectionIdentifier c111111111111 +``` + +```output +ConnectionIdentifier ConnectionState ErrorMessage PeeringDbFacilityId ... [more fields] +-------------------- --------------- ------------ ------------------- ... ------------- +c111111111111 82 +``` + +Create a exchange connection object in memory + diff --git a/src/Peering/examples/New-AzPeeringRegisteredAsn.md b/src/Peering/examples/New-AzPeeringRegisteredAsn.md new file mode 100644 index 000000000000..3423d0379082 --- /dev/null +++ b/src/Peering/examples/New-AzPeeringRegisteredAsn.md @@ -0,0 +1,12 @@ +### Example 1: Create registered asn +```powershell +New-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Asn 65001 +``` + +```output +Name Asn PeeringServicePrefixKey ProvisioningState +---- --- ----------------------- ----------------- +TestAsn 65001 45a8db73-4b7c-4800-bb0f-d304a747d6f1 Succeeded +``` + +Create a new registered asn for a peering diff --git a/src/Peering/examples/New-AzPeeringRegisteredPrefix.md b/src/Peering/examples/New-AzPeeringRegisteredPrefix.md new file mode 100644 index 000000000000..579a746d213c --- /dev/null +++ b/src/Peering/examples/New-AzPeeringRegisteredPrefix.md @@ -0,0 +1,13 @@ +### Example 1: Create a new registered prefix +```powershell +New-AzPeeringRegisteredPrefix -Name accessibilityTesting6 -PeeringName DemoPeering -ResourceGroupName DemoRG -Prefix 240.0.5.0/24 +``` + +```output +Name Prefix PeeringServicePrefixKey PrefixValidationState ProvisioningState +---- ------ ----------------------- --------------------- ----------------- +accessibilityTesting6 240.0.5.0/24 f5947454-80e3-4ce5-bcb3-2501537b6952 Pending Updating +``` + +Create a new registered prefix object + diff --git a/src/Peering/examples/New-AzPeeringService.md b/src/Peering/examples/New-AzPeeringService.md new file mode 100644 index 000000000000..7271f100212a --- /dev/null +++ b/src/Peering/examples/New-AzPeeringService.md @@ -0,0 +1,12 @@ +### Example 1: Create a new peering service +```powershell +New-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG -Location "East US 2" -PeeringServiceLocation Georgia -PeeringServiceProvider MicrosoftEdge -ProviderPrimaryPeeringLocation Atlanta +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +TestPeeringService DemoRG Georgia MicrosoftEdge ProvisioningStarted East US 2 +``` + +Create a new peering service in the resource group \ No newline at end of file diff --git a/src/Peering/examples/New-AzPeeringServicePrefix.md b/src/Peering/examples/New-AzPeeringServicePrefix.md new file mode 100644 index 000000000000..705666ec214f --- /dev/null +++ b/src/Peering/examples/New-AzPeeringServicePrefix.md @@ -0,0 +1,13 @@ +### Example 1: Create Peering service prefix +```powershell +New-AzPeeringServicePrefix -Name TestPrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG -PeeringServicePrefixKey 6a7f0d42-e49c-4eea-a930-280610671c3f -Prefix 91.194.255.0/24 +``` + +```output +Name Prefix Key PrefixValidationState LearnedType ProvisioningState +---- ------ --- --------------------- ----------- ----------------- +TestPrefix 91.194.255.0/24 6a7f0d42-e49c-4eea-a930-280610671c3f Failed None Succeeded +``` + +Create a peering service prefix + diff --git a/src/Peering/examples/Remove-AzPeering.md b/src/Peering/examples/Remove-AzPeering.md new file mode 100644 index 000000000000..69b391d69500 --- /dev/null +++ b/src/Peering/examples/Remove-AzPeering.md @@ -0,0 +1,7 @@ +### Example 1: Remove peering +```powershell +Remove-AzPeering -Name TestPeering -ResourceGroupName DemoRG +``` + +Remove a peering from the given resource group + diff --git a/src/Peering/examples/Remove-AzPeeringAsn.md b/src/Peering/examples/Remove-AzPeeringAsn.md new file mode 100644 index 000000000000..a4bbb4752c51 --- /dev/null +++ b/src/Peering/examples/Remove-AzPeeringAsn.md @@ -0,0 +1,7 @@ +### Example 1: Remove peer asn +```powershell +Remove-AzPeeringAsn -Name PsTestAsn +``` + +Removes peer asn with the name specified + diff --git a/src/Peering/examples/Remove-AzPeeringConnectionMonitorTest.md b/src/Peering/examples/Remove-AzPeeringConnectionMonitorTest.md new file mode 100644 index 000000000000..68da517e77c5 --- /dev/null +++ b/src/Peering/examples/Remove-AzPeeringConnectionMonitorTest.md @@ -0,0 +1,7 @@ +### Example 1: Remove connection monitor test +```powershell +Remove-AzPeeringConnectionMonitorTest -Name TestName -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG +``` + +Removes the given connection monitor test from the peering service + diff --git a/src/Peering/examples/Remove-AzPeeringRegisteredAsn.md b/src/Peering/examples/Remove-AzPeeringRegisteredAsn.md new file mode 100644 index 000000000000..7ade89312b31 --- /dev/null +++ b/src/Peering/examples/Remove-AzPeeringRegisteredAsn.md @@ -0,0 +1,6 @@ +### Example 1: Remove a registered asn from the peering +```powershell +Remove-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo +``` + +Remove a registered asn from the peering object diff --git a/src/Peering/examples/Remove-AzPeeringRegisteredPrefix.md b/src/Peering/examples/Remove-AzPeeringRegisteredPrefix.md new file mode 100644 index 000000000000..1bab58bdb993 --- /dev/null +++ b/src/Peering/examples/Remove-AzPeeringRegisteredPrefix.md @@ -0,0 +1,6 @@ +### Example 1: Remove registered prefix +```powershell +Remove-AzPeeringRegisteredPrefix -Name accessibilityTesting6 -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +Removes the specified registered prefix from peering diff --git a/src/Peering/examples/Remove-AzPeeringService.md b/src/Peering/examples/Remove-AzPeeringService.md new file mode 100644 index 000000000000..a252469c7ba5 --- /dev/null +++ b/src/Peering/examples/Remove-AzPeeringService.md @@ -0,0 +1,7 @@ +### Example 1: Remove peering service +```powershell +Remove-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG +``` + +Removes a peering service from the given resource group + diff --git a/src/Peering/examples/Remove-AzPeeringServicePrefix.md b/src/Peering/examples/Remove-AzPeeringServicePrefix.md new file mode 100644 index 000000000000..6a01f19b0716 --- /dev/null +++ b/src/Peering/examples/Remove-AzPeeringServicePrefix.md @@ -0,0 +1,7 @@ +### Example 1: Remove peering service prefix +```powershell +Remove-AzPeeringServicePrefix -Name TestPrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroup DemoRG +``` + +Removes peering service prefix from peering + diff --git a/src/Peering/examples/Start-AzPeeringInvokeLookingGlass.md b/src/Peering/examples/Start-AzPeeringInvokeLookingGlass.md new file mode 100644 index 000000000000..99c6f8129959 --- /dev/null +++ b/src/Peering/examples/Start-AzPeeringInvokeLookingGlass.md @@ -0,0 +1,13 @@ +### Example 1: Invoke looking glass command +```powershell +Start-AzPeeringInvokeLookingGlass -Command Ping -DestinationIp 1.1.1.1 -SourceLocation Seattle -SourceType EdgeSite +``` + +```output +Command Output +------- ------ +Ping PING 1.1.1.1 (1.1.1.1): 56 data bytes… +``` + +Invoke the given looking glass command + diff --git a/src/Peering/examples/Test-AzPeeringRegisteredPrefix.md b/src/Peering/examples/Test-AzPeeringRegisteredPrefix.md new file mode 100644 index 000000000000..989796889dbd --- /dev/null +++ b/src/Peering/examples/Test-AzPeeringRegisteredPrefix.md @@ -0,0 +1,13 @@ +### Example 1: Test registered prefix +```powershell +Test-AzPeeringRegisteredPrefix -Name accessibilityTesting2 -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +```output +Name Prefix PeeringServicePrefixKey PrefixValidationState ProvisioningState +---- ------ ----------------------- --------------------- ----------------- +accessibilityTesting2 240.0.1.0/24 249aa0dd-6177-4105-94fe-dfefcbf5ab48 Pending Succeeded +``` + +Tests the validity of the given registered prefix (shown in prefix validation state) + diff --git a/src/Peering/examples/Test-AzPeeringServiceProviderAvailability.md b/src/Peering/examples/Test-AzPeeringServiceProviderAvailability.md new file mode 100644 index 000000000000..6048b2f5140e --- /dev/null +++ b/src/Peering/examples/Test-AzPeeringServiceProviderAvailability.md @@ -0,0 +1,11 @@ +### Example 1: Check if provider is available at a location +```powershell +$providerAvailability = New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ +Test-AzPeeringServiceProviderAvailability -CheckServiceProviderAvailabilityInput $providerAvailability +``` + +```output +"Available" +``` + +Check whether the given provider is available at the given location diff --git a/src/Peering/examples/Update-AzPeering.md b/src/Peering/examples/Update-AzPeering.md new file mode 100644 index 000000000000..3b6e429a0cf8 --- /dev/null +++ b/src/Peering/examples/Update-AzPeering.md @@ -0,0 +1,14 @@ +### Example 1: Update peering tags +```powershell +$tags=@{hello='world'} +Update-AzPeering -Name DemoPeering -ResourceGroupName DemoRG -Tag $tags +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +DemoPeering Premium_Direct_Free Direct Dallas Succeeded South Central US +``` + +Updates the specified peering's tags + diff --git a/src/Peering/examples/Update-AzPeeringService.md b/src/Peering/examples/Update-AzPeeringService.md new file mode 100644 index 000000000000..5ca9ffb8e113 --- /dev/null +++ b/src/Peering/examples/Update-AzPeeringService.md @@ -0,0 +1,13 @@ +### Example 1: Update peering service tags +```powershell +$tags=@{hello='world'} +Update-AzPeeringService -Name DRTestInterCloud -ResourceGroupName DemoRG -Tag $tags +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +DRTestInterCloud DemoRG Ile-de-France InterCloud Succeeded UK South +``` + +Updates the peering service tags \ No newline at end of file diff --git a/src/Peering/export-surface.ps1 b/src/Peering/export-surface.ps1 new file mode 100644 index 000000000000..097cb4e2aafd --- /dev/null +++ b/src/Peering/export-surface.ps1 @@ -0,0 +1,41 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.Peering.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} +$null = Import-Module -Name $dll + +$moduleName = 'Az.Peering' +$exportsFolder = Join-Path $PSScriptRoot 'exports' +$resourcesFolder = Join-Path $PSScriptRoot 'resources' + +Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'" + +Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'" + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Peering/exports/Get-AzPeering.ps1 b/src/Peering/exports/Get-AzPeering.ps1 new file mode 100644 index 000000000000..185727711122 --- /dev/null +++ b/src/Peering/exports/Get-AzPeering.ps1 @@ -0,0 +1,210 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Gets an existing peering with the specified name under the given subscription and resource group. +.Description +Gets an existing peering with the specified name under the given subscription and resource group. +.Example + Get-AzPeering +.Example +Get-AzPeering -Name DemoPeering -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeering +#> +function Get-AzPeering { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PeeringName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeering_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeering_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeering_List'; + List1 = 'Az.Peering.private\Get-AzPeering_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringAsn.ps1 b/src/Peering/exports/Get-AzPeeringAsn.ps1 new file mode 100644 index 000000000000..c1b71f74afb5 --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringAsn.ps1 @@ -0,0 +1,201 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Gets the peer ASN with the specified name under the given subscription. +.Description +Gets the peer ASN with the specified name under the given subscription. +.Example +Get-AzPeeringAsn +.Example +Get-AzPeeringAsn -Name ContosoEdgeTest + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringasn +#> +function Get-AzPeeringAsn { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PeerAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The peer ASN name. + ${Name}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringAsn_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringAsn_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringAsn_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringCdnPrefix.ps1 b/src/Peering/exports/Get-AzPeeringCdnPrefix.ps1 new file mode 100644 index 000000000000..af9e808ca4f8 --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringCdnPrefix.ps1 @@ -0,0 +1,170 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Lists all of the advertised prefixes for the specified peering location +.Description +Lists all of the advertised prefixes for the specified peering location +.Example +Get-AzPeeringCdnPrefix -PeeringLocation Seattle + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringcdnprefix +#> +function Get-AzPeeringCdnPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The peering location. + ${PeeringLocation}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringCdnPrefix_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringConnectionMonitorTest.ps1 b/src/Peering/exports/Get-AzPeeringConnectionMonitorTest.ps1 new file mode 100644 index 000000000000..9dae3ce9cac4 --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringConnectionMonitorTest.ps1 @@ -0,0 +1,215 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service. +.Description +Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service. +.Example + Get-AzPeeringConnectionMonitorTest -ResourceGroupName DemoRG -PeeringServiceName DRTest +.Example + Get-AzPeeringConnectionMonitorTest -ResourceGroupName DemoRG -PeeringServiceName DRTest -Name TestName + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringconnectionmonitortest +#> +function Get-AzPeeringConnectionMonitorTest { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('ConnectionMonitorTestName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the connection monitor test + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringConnectionMonitorTest_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringConnectionMonitorTest_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringConnectionMonitorTest_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringLegacy.ps1 b/src/Peering/exports/Get-AzPeeringLegacy.ps1 new file mode 100644 index 000000000000..a3768599a830 --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringLegacy.ps1 @@ -0,0 +1,190 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Lists all of the legacy peerings under the given subscription matching the specified kind and location. +.Description +Lists all of the legacy peerings under the given subscription matching the specified kind and location. +.Example +Get-AzPeeringLegacy -Kind Direct -PeeringLocation Seattle + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringlegacy +#> +function Get-AzPeeringLegacy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind] + # The kind of the peering. + ${Kind}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The location of the peering. + ${PeeringLocation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.Int32] + # The ASN number associated with a legacy peering. + ${Asn}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType] + # The direct peering type. + ${DirectPeeringType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringLegacy_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringLocation.ps1 b/src/Peering/exports/Get-AzPeeringLocation.ps1 new file mode 100644 index 000000000000..90ba08392e9b --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringLocation.ps1 @@ -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 +Lists all of the available peering locations for the specified kind of peering. +.Description +Lists all of the available peering locations for the specified kind of peering. +.Example +Get-AzPeeringLocation -Kind Direct + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringlocation +#> +function Get-AzPeeringLocation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind] + # The kind of the peering. + ${Kind}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType] + # The type of direct peering. + ${DirectPeeringType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringLocation_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringReceivedRoute.ps1 b/src/Peering/exports/Get-AzPeeringReceivedRoute.ps1 new file mode 100644 index 000000000000..ec7aa79da36e --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringReceivedRoute.ps1 @@ -0,0 +1,208 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Lists the prefixes received over the specified peering under the given subscription and resource group. +.Description +Lists the prefixes received over the specified peering under the given subscription and resource group. +.Example +Get-AzPeeringReceivedRoute -PeeringName DemoPeering -ResourceGroupName DemoRG +.Example +Get-AzPeeringReceivedRoute -PeeringName DemoPeering -ResourceGroupName DemoRG -AsPath "7018 9680 9680 3462" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringreceivedroute +#> +function Get-AzPeeringReceivedRoute { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional AS path that can be used to filter the routes. + ${AsPath}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional origin AS validation state that can be used to filter the routes. + ${OriginAsValidationState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional prefix that can be used to filter the routes. + ${Prefix}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional RPKI validation state that can be used to filter the routes. + ${RpkiValidationState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional page continuation token that is used in the event of paginated result. + ${SkipToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringReceivedRoute_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringRegisteredAsn.ps1 b/src/Peering/exports/Get-AzPeeringRegisteredAsn.ps1 new file mode 100644 index 000000000000..b6ef3744aa9f --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringRegisteredAsn.ps1 @@ -0,0 +1,215 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. +.Description +Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. +.Example +Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo +.Example +Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Name fgfg + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringregisteredasn +#> +function Get-AzPeeringRegisteredAsn { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('RegisteredAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered ASN. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringRegisteredAsn_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringRegisteredAsn_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringRegisteredAsn_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringRegisteredPrefix.ps1 b/src/Peering/exports/Get-AzPeeringRegisteredPrefix.ps1 new file mode 100644 index 000000000000..d308f0fc1cfd --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringRegisteredPrefix.ps1 @@ -0,0 +1,215 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Description +Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Example +Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG +.Example +Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG -Name accessibilityTesting1 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringregisteredprefix +#> +function Get-AzPeeringRegisteredPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('RegisteredPrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered prefix. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringRegisteredPrefix_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringRegisteredPrefix_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringRegisteredPrefix_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringRpUnbilledPrefix.ps1 b/src/Peering/exports/Get-AzPeeringRpUnbilledPrefix.ps1 new file mode 100644 index 000000000000..0f91bda37031 --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringRpUnbilledPrefix.ps1 @@ -0,0 +1,182 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Lists all of the RP unbilled prefixes for the specified peering +.Description +Lists all of the RP unbilled prefixes for the specified peering +.Example +Get-AzPeeringRpUnbilledPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringrpunbilledprefix +#> +function Get-AzPeeringRpUnbilledPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The peering name. + ${PeeringName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The Azure resource group name. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.Management.Automation.SwitchParameter] + # Flag to enable consolidation prefixes + ${Consolidate}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringRpUnbilledPrefix_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringService.ps1 b/src/Peering/exports/Get-AzPeeringService.ps1 new file mode 100644 index 000000000000..105f434beca5 --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringService.ps1 @@ -0,0 +1,212 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Gets an existing peering service with the specified name under the given subscription and resource group. +.Description +Gets an existing peering service with the specified name under the given subscription and resource group. +.Example +Get-AzPeeringService +.Example +Get-AzPeeringService -ResourceGroupName DemoRG +.Example +Get-AzPeeringService -ResourceGroupName DemoRG -Name TestExtension + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringservice +#> +function Get-AzPeeringService { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PeeringServiceName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringService_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringService_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringService_List'; + List1 = 'Az.Peering.private\Get-AzPeeringService_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringServiceCountry.ps1 b/src/Peering/exports/Get-AzPeeringServiceCountry.ps1 new file mode 100644 index 000000000000..d173ec677513 --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringServiceCountry.ps1 @@ -0,0 +1,164 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Lists all of the available countries for peering service. +.Description +Lists all of the available countries for peering service. +.Example +Get-AzPeeringServiceCountry + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringservicecountry +#> +function Get-AzPeeringServiceCountry { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringServiceCountry_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringServiceLocation.ps1 b/src/Peering/exports/Get-AzPeeringServiceLocation.ps1 new file mode 100644 index 000000000000..15ec0d68bd11 --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringServiceLocation.ps1 @@ -0,0 +1,172 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Lists all of the available locations for peering service. +.Description +Lists all of the available locations for peering service. +.Example +Get-AzPeeringServiceLocation +.Example +Get-AzPeeringServiceLocation -Country Japan + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringservicelocation +#> +function Get-AzPeeringServiceLocation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The country of interest, in which the locations are to be present. + ${Country}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringServiceLocation_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringServicePrefix.ps1 b/src/Peering/exports/Get-AzPeeringServicePrefix.ps1 new file mode 100644 index 000000000000..1f019f5fb001 --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringServicePrefix.ps1 @@ -0,0 +1,221 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Gets an existing prefix with the specified name under the given subscription, resource group and peering service. +.Description +Gets an existing prefix with the specified name under the given subscription, resource group and peering service. +.Example +Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG +.Example +Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG -Name TestPrefix + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringserviceprefix +#> +function Get-AzPeeringServicePrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the prefix. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The properties to be expanded. + ${Expand}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringServicePrefix_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringServicePrefix_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringServicePrefix_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Get-AzPeeringServiceProvider.ps1 b/src/Peering/exports/Get-AzPeeringServiceProvider.ps1 new file mode 100644 index 000000000000..239f83e6d7bb --- /dev/null +++ b/src/Peering/exports/Get-AzPeeringServiceProvider.ps1 @@ -0,0 +1,164 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Lists all of the available peering service locations for the specified kind of peering. +.Description +Lists all of the available peering service locations for the specified kind of peering. +.Example +Get-AzPeeringServiceProvider + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringserviceprovider +#> +function Get-AzPeeringServiceProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringServiceProvider_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Initialize-AzPeeringServiceConnectionMonitor.ps1 b/src/Peering/exports/Initialize-AzPeeringServiceConnectionMonitor.ps1 new file mode 100644 index 000000000000..ad43859bf04b --- /dev/null +++ b/src/Peering/exports/Initialize-AzPeeringServiceConnectionMonitor.ps1 @@ -0,0 +1,196 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Initialize Peering Service for Connection Monitor functionality +.Description +Initialize Peering Service for Connection Monitor functionality +.Example +Initialize-AzPeeringServiceConnectionMonitor + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/initialize-azpeeringserviceconnectionmonitor +#> +function Initialize-AzPeeringServiceConnectionMonitor { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Initialize', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Initialize')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='InitializeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Initialize = 'Az.Peering.private\Initialize-AzPeeringServiceConnectionMonitor_Initialize'; + InitializeViaIdentity = 'Az.Peering.private\Initialize-AzPeeringServiceConnectionMonitor_InitializeViaIdentity'; + } + if (('Initialize') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeering.ps1 b/src/Peering/exports/New-AzPeering.ps1 new file mode 100644 index 000000000000..429b56f02e06 --- /dev/null +++ b/src/Peering/exports/New-AzPeering.ps1 @@ -0,0 +1,280 @@ + +# ---------------------------------------------------------------------------------- +# 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 a new peering or updates an existing peering with the specified name under the given subscription and resource group. +.Description +Creates a new peering or updates an existing peering with the specified name under the given subscription and resource group. +.Example +$connection1 = New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 ... +$directConnections = ,$connection1 +New-AzPeering -Name TestPeeringPs -ResourceGroupName DemoRG -Kind Direct -Location "South Central US" -DirectConnection $directConnections -DirectPeeringType Cdn -DirectPeerAsnId $peerAsnId -PeeringLocation Dallas -Sku Premium_Direct_Unlimited + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering +.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. + +DIRECTCONNECTION : The set of connections that constitute a direct peering. + [BandwidthInMbps ]: The bandwidth of the connection. + [BgpSessionMaxPrefixesAdvertisedV4 ]: The maximum number of prefixes advertised over the IPv4 session. + [BgpSessionMaxPrefixesAdvertisedV6 ]: The maximum number of prefixes advertised over the IPv6 session. + [BgpSessionMd5AuthenticationKey ]: The MD5 authentication key of the session. + [BgpSessionMicrosoftSessionIPv4Address ]: The IPv4 session address on Microsoft's end. + [BgpSessionMicrosoftSessionIPv6Address ]: The IPv6 session address on Microsoft's end. + [BgpSessionPeerSessionIPv4Address ]: The IPv4 session address on peer's end. + [BgpSessionPeerSessionIPv6Address ]: The IPv6 session address on peer's end. + [BgpSessionPrefixV4 ]: The IPv4 prefix that contains both ends' IPv4 addresses. + [BgpSessionPrefixV6 ]: The IPv6 prefix that contains both ends' IPv6 addresses. + [ConnectionIdentifier ]: The unique identifier (GUID) for the connection. + [PeeringDbFacilityId ]: The PeeringDB.com ID of the facility at which the connection has to be set up. + [SessionAddressProvider ]: The field indicating if Microsoft provides session ip addresses. + [UseForPeeringService ]: The flag that indicates whether or not the connection is used for peering service. + +EXCHANGECONNECTION : The set of connections that constitute an exchange peering. + [BgpSessionMaxPrefixesAdvertisedV4 ]: The maximum number of prefixes advertised over the IPv4 session. + [BgpSessionMaxPrefixesAdvertisedV6 ]: The maximum number of prefixes advertised over the IPv6 session. + [BgpSessionMd5AuthenticationKey ]: The MD5 authentication key of the session. + [BgpSessionMicrosoftSessionIPv4Address ]: The IPv4 session address on Microsoft's end. + [BgpSessionMicrosoftSessionIPv6Address ]: The IPv6 session address on Microsoft's end. + [BgpSessionPeerSessionIPv4Address ]: The IPv4 session address on peer's end. + [BgpSessionPeerSessionIPv6Address ]: The IPv6 session address on peer's end. + [BgpSessionPrefixV4 ]: The IPv4 prefix that contains both ends' IPv4 addresses. + [BgpSessionPrefixV6 ]: The IPv6 prefix that contains both ends' IPv6 addresses. + [ConnectionIdentifier ]: The unique identifier (GUID) for the connection. + [PeeringDbFacilityId ]: The PeeringDB.com ID of the facility at which the connection has to be set up. +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeering +#> +function New-AzPeering { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PeeringName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind] + # The kind of the peering. + ${Kind}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The location of the resource. + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[]] + # The set of connections that constitute a direct peering. + # To construct, see NOTES section for DIRECTCONNECTION properties and create a hash table. + ${DirectConnection}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The identifier of the referenced resource. + ${DirectPeerAsnId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType] + # The type of direct peering. + ${DirectPeeringType}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[]] + # The set of connections that constitute an exchange peering. + # To construct, see NOTES section for EXCHANGECONNECTION properties and create a hash table. + ${ExchangeConnection}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The identifier of the referenced resource. + ${ExchangePeerAsnId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The location of the peering. + ${PeeringLocation}, + + [Parameter()] + [Alias('SkuName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The name of the peering SKU. + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags]))] + [System.Collections.Hashtable] + # The resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeering_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringAsn.ps1 b/src/Peering/exports/New-AzPeeringAsn.ps1 new file mode 100644 index 000000000000..373d6d79ab4c --- /dev/null +++ b/src/Peering/exports/New-AzPeeringAsn.ps1 @@ -0,0 +1,202 @@ + +# ---------------------------------------------------------------------------------- +# 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 a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. +.Description +Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. +.Example +$contactDetail = New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" +$PeerContactList = ,$contactDetail +New-AzPeeringAsn -Name PsTestAsn -PeerAsn 65001 -PeerContactDetail $PeerContactList -PeerName DemoPeering + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn +.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. + +PEERCONTACTDETAIL : The contact details of the peer. + [Email ]: The e-mail address of the contact. + [Phone ]: The phone number of the contact. + [Role ]: The role of the contact. +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringasn +#> +function New-AzPeeringAsn { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PeerAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The peer ASN name. + ${Name}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The Autonomous System Number (ASN) of the peer. + ${PeerAsn}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[]] + # The contact details of the peer. + # To construct, see NOTES section for PEERCONTACTDETAIL properties and create a hash table. + ${PeerContactDetail}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The name of the peer. + ${PeerName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringAsn_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringCheckServiceProviderAvailabilityInputObject.ps1 b/src/Peering/exports/New-AzPeeringCheckServiceProviderAvailabilityInputObject.ps1 new file mode 100644 index 000000000000..b4e636176122 --- /dev/null +++ b/src/Peering/exports/New-AzPeeringCheckServiceProviderAvailabilityInputObject.ps1 @@ -0,0 +1,119 @@ + +# ---------------------------------------------------------------------------------- +# 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 CheckServiceProviderAvailabilityInput. +.Description +Create an in-memory object for CheckServiceProviderAvailabilityInput. +.Example +New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringCheckServiceProviderAvailabilityInputObject +#> +function New-AzPeeringCheckServiceProviderAvailabilityInputObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # Gets or sets the peering service location. + ${PeeringServiceLocation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # Gets or sets the peering service provider. + ${PeeringServiceProvider} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Peering.custom\New-AzPeeringCheckServiceProviderAvailabilityInputObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringConnectionMonitorTest.ps1 b/src/Peering/exports/New-AzPeeringConnectionMonitorTest.ps1 new file mode 100644 index 000000000000..c5df9fc422b5 --- /dev/null +++ b/src/Peering/exports/New-AzPeeringConnectionMonitorTest.ps1 @@ -0,0 +1,207 @@ + +# ---------------------------------------------------------------------------------- +# 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 connection monitor test with the specified name under the given subscription, resource group and peering service. +.Description +Creates or updates a connection monitor test with the specified name under the given subscription, resource group and peering service. +.Example +New-AzPeeringConnectionMonitorTest -Name TestName -PeeringServiceName DRTest -ResourceGroupName DemoRG + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringconnectionmonitortest +#> +function New-AzPeeringConnectionMonitorTest { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('ConnectionMonitorTestName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the connection monitor test + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The Connection Monitor test destination + ${Destination}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The Connection Monitor test destination port + ${DestinationPort}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The Connection Monitor test source agent + ${SourceAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The Connection Monitor test frequency in seconds + ${TestFrequencyInSec}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringConnectionMonitorTest_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringContactDetailObject.ps1 b/src/Peering/exports/New-AzPeeringContactDetailObject.ps1 new file mode 100644 index 000000000000..1af08fa19093 --- /dev/null +++ b/src/Peering/exports/New-AzPeeringContactDetailObject.ps1 @@ -0,0 +1,126 @@ + +# ---------------------------------------------------------------------------------- +# 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 ContactDetail. +.Description +Create an in-memory object for ContactDetail. +.Example +New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringContactDetailObject +#> +function New-AzPeeringContactDetailObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The e-mail address of the contact. + ${Email}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The phone number of the contact. + ${Phone}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role] + # The role of the contact. + ${Role} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Peering.custom\New-AzPeeringContactDetailObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringDirectConnectionObject.ps1 b/src/Peering/exports/New-AzPeeringDirectConnectionObject.ps1 new file mode 100644 index 000000000000..bd528c2f35e2 --- /dev/null +++ b/src/Peering/exports/New-AzPeeringDirectConnectionObject.ps1 @@ -0,0 +1,192 @@ + +# ---------------------------------------------------------------------------------- +# 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 DirectConnection. +.Description +Create an in-memory object for DirectConnection. +.Example +New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 1.1.1.1 -BgpSessionPeerSessionIPv4Address 1.1.1.0 -BgpSessionPrefixV4 1.1.1.1/31 -PeeringDbFacilityId 82 -SessionAddressProvider Peer -ConnectionIdentifier c111111111111 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringDirectConnectionObject +#> +function New-AzPeeringDirectConnectionObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The bandwidth of the connection. + ${BandwidthInMbps}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The maximum number of prefixes advertised over the IPv4 session. + ${BgpSessionMaxPrefixesAdvertisedV4}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The maximum number of prefixes advertised over the IPv6 session. + ${BgpSessionMaxPrefixesAdvertisedV6}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The MD5 authentication key of the session. + ${BgpSessionMd5AuthenticationKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 session address on Microsoft's end. + ${BgpSessionMicrosoftSessionIPv4Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 session address on Microsoft's end. + ${BgpSessionMicrosoftSessionIPv6Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 session address on peer's end. + ${BgpSessionPeerSessionIPv4Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 session address on peer's end. + ${BgpSessionPeerSessionIPv6Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 prefix that contains both ends' IPv4 addresses. + ${BgpSessionPrefixV4}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 prefix that contains both ends' IPv6 addresses. + ${BgpSessionPrefixV6}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The unique identifier (GUID) for the connection. + ${ConnectionIdentifier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The PeeringDB.com ID of the facility at which the connection has to be set up. + ${PeeringDbFacilityId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider] + # The field indicating if Microsoft provides session ip addresses. + ${SessionAddressProvider}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Boolean] + # The flag that indicates whether or not the connection is used for peering service. + ${UseForPeeringService} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Peering.custom\New-AzPeeringDirectConnectionObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringExchangeConnectionObject.ps1 b/src/Peering/exports/New-AzPeeringExchangeConnectionObject.ps1 new file mode 100644 index 000000000000..19705a6c85d5 --- /dev/null +++ b/src/Peering/exports/New-AzPeeringExchangeConnectionObject.ps1 @@ -0,0 +1,173 @@ + +# ---------------------------------------------------------------------------------- +# 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 ExchangeConnection. +.Description +Create an in-memory object for ExchangeConnection. +.Example +New-AzPeeringExchangeConnectionObject -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 1.1.1.1 -BgpSessionPeerSessionIPv4Address 1.1.1.0 -BgpSessionPrefixV4 1.1.1.1/31 -PeeringDbFacilityId 82 -ConnectionIdentifier c111111111111 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringExchangeConnectionObject +#> +function New-AzPeeringExchangeConnectionObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The maximum number of prefixes advertised over the IPv4 session. + ${BgpSessionMaxPrefixesAdvertisedV4}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The maximum number of prefixes advertised over the IPv6 session. + ${BgpSessionMaxPrefixesAdvertisedV6}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The MD5 authentication key of the session. + ${BgpSessionMd5AuthenticationKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 session address on Microsoft's end. + ${BgpSessionMicrosoftSessionIPv4Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 session address on Microsoft's end. + ${BgpSessionMicrosoftSessionIPv6Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 session address on peer's end. + ${BgpSessionPeerSessionIPv4Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 session address on peer's end. + ${BgpSessionPeerSessionIPv6Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 prefix that contains both ends' IPv4 addresses. + ${BgpSessionPrefixV4}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 prefix that contains both ends' IPv6 addresses. + ${BgpSessionPrefixV6}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The unique identifier (GUID) for the connection. + ${ConnectionIdentifier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The PeeringDB.com ID of the facility at which the connection has to be set up. + ${PeeringDbFacilityId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Peering.custom\New-AzPeeringExchangeConnectionObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringRegisteredAsn.ps1 b/src/Peering/exports/New-AzPeeringRegisteredAsn.ps1 new file mode 100644 index 000000000000..79becafaeed9 --- /dev/null +++ b/src/Peering/exports/New-AzPeeringRegisteredAsn.ps1 @@ -0,0 +1,189 @@ + +# ---------------------------------------------------------------------------------- +# 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 a new registered ASN with the specified name under the given subscription, resource group and peering. +.Description +Creates a new registered ASN with the specified name under the given subscription, resource group and peering. +.Example +New-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Asn 65001 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringregisteredasn +#> +function New-AzPeeringRegisteredAsn { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('RegisteredAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the ASN. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The customer's ASN from which traffic originates. + ${Asn}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringRegisteredAsn_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringRegisteredPrefix.ps1 b/src/Peering/exports/New-AzPeeringRegisteredPrefix.ps1 new file mode 100644 index 000000000000..74eecafa6c7f --- /dev/null +++ b/src/Peering/exports/New-AzPeeringRegisteredPrefix.ps1 @@ -0,0 +1,189 @@ + +# ---------------------------------------------------------------------------------- +# 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 a new registered prefix with the specified name under the given subscription, resource group and peering. +.Description +Creates a new registered prefix with the specified name under the given subscription, resource group and peering. +.Example +New-AzPeeringRegisteredPrefix -Name accessibilityTesting6 -PeeringName DemoPeering -ResourceGroupName DemoRG -Prefix 240.0.5.0/24 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringregisteredprefix +#> +function New-AzPeeringRegisteredPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('RegisteredPrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered prefix. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The customer's prefix from which traffic originates. + ${Prefix}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringRegisteredPrefix_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringService.ps1 b/src/Peering/exports/New-AzPeeringService.ps1 new file mode 100644 index 000000000000..a616e430165a --- /dev/null +++ b/src/Peering/exports/New-AzPeeringService.ps1 @@ -0,0 +1,221 @@ + +# ---------------------------------------------------------------------------------- +# 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 a new peering service or updates an existing peering with the specified name under the given subscription and resource group. +.Description +Creates a new peering service or updates an existing peering with the specified name under the given subscription and resource group. +.Example +New-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG -Location "East US 2" -PeeringServiceLocation Georgia -PeeringServiceProvider MicrosoftEdge -ProviderPrimaryPeeringLocation Atlanta + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringservice +#> +function New-AzPeeringService { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PeeringServiceName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The location of the resource. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The location (state/province) of the customer. + ${PeeringServiceLocation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The name of the service provider. + ${PeeringServiceProvider}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The backup peering (Microsoft/service provider) location to be used for customer traffic. + ${ProviderBackupPeeringLocation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The primary peering (Microsoft/service provider) location to be used for customer traffic. + ${ProviderPrimaryPeeringLocation}, + + [Parameter()] + [Alias('SkuName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The name of the peering service SKU. + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags]))] + [System.Collections.Hashtable] + # The resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringService_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/New-AzPeeringServicePrefix.ps1 b/src/Peering/exports/New-AzPeeringServicePrefix.ps1 new file mode 100644 index 000000000000..32fd937d1459 --- /dev/null +++ b/src/Peering/exports/New-AzPeeringServicePrefix.ps1 @@ -0,0 +1,195 @@ + +# ---------------------------------------------------------------------------------- +# 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 a new prefix with the specified name under the given subscription, resource group and peering service. +.Description +Creates a new prefix with the specified name under the given subscription, resource group and peering service. +.Example +New-AzPeeringServicePrefix -Name TestPrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG -PeeringServicePrefixKey 6a7f0d42-e49c-4eea-a930-280610671c3f -Prefix 91.194.255.0/24 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringserviceprefix +#> +function New-AzPeeringServicePrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the prefix. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The peering service prefix key + ${PeeringServicePrefixKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The prefix from which your traffic originates. + ${Prefix}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringServicePrefix_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/ProxyCmdletDefinitions.ps1 b/src/Peering/exports/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..b55ddef4e1e7 --- /dev/null +++ b/src/Peering/exports/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,7187 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Gets the peer ASN with the specified name under the given subscription. +.Description +Gets the peer ASN with the specified name under the given subscription. +.Example +Get-AzPeeringAsn +.Example +Get-AzPeeringAsn -Name ContosoEdgeTest + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringasn +#> +function Get-AzPeeringAsn { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PeerAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The peer ASN name. + ${Name}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringAsn_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringAsn_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringAsn_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists all of the advertised prefixes for the specified peering location +.Description +Lists all of the advertised prefixes for the specified peering location +.Example +Get-AzPeeringCdnPrefix -PeeringLocation Seattle + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringcdnprefix +#> +function Get-AzPeeringCdnPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The peering location. + ${PeeringLocation}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringCdnPrefix_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service. +.Description +Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service. +.Example + Get-AzPeeringConnectionMonitorTest -ResourceGroupName DemoRG -PeeringServiceName DRTest +.Example + Get-AzPeeringConnectionMonitorTest -ResourceGroupName DemoRG -PeeringServiceName DRTest -Name TestName + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringconnectionmonitortest +#> +function Get-AzPeeringConnectionMonitorTest { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('ConnectionMonitorTestName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the connection monitor test + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringConnectionMonitorTest_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringConnectionMonitorTest_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringConnectionMonitorTest_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists all of the legacy peerings under the given subscription matching the specified kind and location. +.Description +Lists all of the legacy peerings under the given subscription matching the specified kind and location. +.Example +Get-AzPeeringLegacy -Kind Direct -PeeringLocation Seattle + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringlegacy +#> +function Get-AzPeeringLegacy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind] + # The kind of the peering. + ${Kind}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The location of the peering. + ${PeeringLocation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.Int32] + # The ASN number associated with a legacy peering. + ${Asn}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType] + # The direct peering type. + ${DirectPeeringType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringLegacy_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists all of the available peering locations for the specified kind of peering. +.Description +Lists all of the available peering locations for the specified kind of peering. +.Example +Get-AzPeeringLocation -Kind Direct + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringlocation +#> +function Get-AzPeeringLocation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind] + # The kind of the peering. + ${Kind}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType] + # The type of direct peering. + ${DirectPeeringType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringLocation_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists the prefixes received over the specified peering under the given subscription and resource group. +.Description +Lists the prefixes received over the specified peering under the given subscription and resource group. +.Example +Get-AzPeeringReceivedRoute -PeeringName DemoPeering -ResourceGroupName DemoRG +.Example +Get-AzPeeringReceivedRoute -PeeringName DemoPeering -ResourceGroupName DemoRG -AsPath "7018 9680 9680 3462" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringreceivedroute +#> +function Get-AzPeeringReceivedRoute { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional AS path that can be used to filter the routes. + ${AsPath}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional origin AS validation state that can be used to filter the routes. + ${OriginAsValidationState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional prefix that can be used to filter the routes. + ${Prefix}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional RPKI validation state that can be used to filter the routes. + ${RpkiValidationState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The optional page continuation token that is used in the event of paginated result. + ${SkipToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringReceivedRoute_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. +.Description +Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. +.Example +Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo +.Example +Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Name fgfg + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringregisteredasn +#> +function Get-AzPeeringRegisteredAsn { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('RegisteredAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered ASN. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringRegisteredAsn_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringRegisteredAsn_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringRegisteredAsn_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Description +Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Example +Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG +.Example +Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG -Name accessibilityTesting1 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringregisteredprefix +#> +function Get-AzPeeringRegisteredPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('RegisteredPrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered prefix. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringRegisteredPrefix_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringRegisteredPrefix_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringRegisteredPrefix_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists all of the RP unbilled prefixes for the specified peering +.Description +Lists all of the RP unbilled prefixes for the specified peering +.Example +Get-AzPeeringRpUnbilledPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringrpunbilledprefix +#> +function Get-AzPeeringRpUnbilledPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The peering name. + ${PeeringName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The Azure resource group name. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.Management.Automation.SwitchParameter] + # Flag to enable consolidation prefixes + ${Consolidate}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringRpUnbilledPrefix_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists all of the available countries for peering service. +.Description +Lists all of the available countries for peering service. +.Example +Get-AzPeeringServiceCountry + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringservicecountry +#> +function Get-AzPeeringServiceCountry { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringServiceCountry_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists all of the available locations for peering service. +.Description +Lists all of the available locations for peering service. +.Example +Get-AzPeeringServiceLocation +.Example +Get-AzPeeringServiceLocation -Country Japan + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringservicelocation +#> +function Get-AzPeeringServiceLocation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The country of interest, in which the locations are to be present. + ${Country}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringServiceLocation_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets an existing prefix with the specified name under the given subscription, resource group and peering service. +.Description +Gets an existing prefix with the specified name under the given subscription, resource group and peering service. +.Example +Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG +.Example +Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG -Name TestPrefix + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringserviceprefix +#> +function Get-AzPeeringServicePrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the prefix. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The properties to be expanded. + ${Expand}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringServicePrefix_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringServicePrefix_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringServicePrefix_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists all of the available peering service locations for the specified kind of peering. +.Description +Lists all of the available peering service locations for the specified kind of peering. +.Example +Get-AzPeeringServiceProvider + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringserviceprovider +#> +function Get-AzPeeringServiceProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringServiceProvider_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets an existing peering service with the specified name under the given subscription and resource group. +.Description +Gets an existing peering service with the specified name under the given subscription and resource group. +.Example +Get-AzPeeringService +.Example +Get-AzPeeringService -ResourceGroupName DemoRG +.Example +Get-AzPeeringService -ResourceGroupName DemoRG -Name TestExtension + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringservice +#> +function Get-AzPeeringService { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PeeringServiceName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeeringService_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeeringService_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeeringService_List'; + List1 = 'Az.Peering.private\Get-AzPeeringService_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets an existing peering with the specified name under the given subscription and resource group. +.Description +Gets an existing peering with the specified name under the given subscription and resource group. +.Example + Get-AzPeering +.Example +Get-AzPeering -Name DemoPeering -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeering +#> +function Get-AzPeering { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PeeringName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.Peering.private\Get-AzPeering_Get'; + GetViaIdentity = 'Az.Peering.private\Get-AzPeering_GetViaIdentity'; + List = 'Az.Peering.private\Get-AzPeering_List'; + List1 = 'Az.Peering.private\Get-AzPeering_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Initialize Peering Service for Connection Monitor functionality +.Description +Initialize Peering Service for Connection Monitor functionality +.Example +Initialize-AzPeeringServiceConnectionMonitor + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/initialize-azpeeringserviceconnectionmonitor +#> +function Initialize-AzPeeringServiceConnectionMonitor { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Initialize', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Initialize')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='InitializeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Initialize = 'Az.Peering.private\Initialize-AzPeeringServiceConnectionMonitor_Initialize'; + InitializeViaIdentity = 'Az.Peering.private\Initialize-AzPeeringServiceConnectionMonitor_InitializeViaIdentity'; + } + if (('Initialize') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. +.Description +Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. +.Example +$contactDetail = New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" +$PeerContactList = ,$contactDetail +New-AzPeeringAsn -Name PsTestAsn -PeerAsn 65001 -PeerContactDetail $PeerContactList -PeerName DemoPeering + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn +.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. + +PEERCONTACTDETAIL : The contact details of the peer. + [Email ]: The e-mail address of the contact. + [Phone ]: The phone number of the contact. + [Role ]: The role of the contact. +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringasn +#> +function New-AzPeeringAsn { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PeerAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The peer ASN name. + ${Name}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The Autonomous System Number (ASN) of the peer. + ${PeerAsn}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[]] + # The contact details of the peer. + # To construct, see NOTES section for PEERCONTACTDETAIL properties and create a hash table. + ${PeerContactDetail}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The name of the peer. + ${PeerName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringAsn_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Creates or updates a connection monitor test with the specified name under the given subscription, resource group and peering service. +.Description +Creates or updates a connection monitor test with the specified name under the given subscription, resource group and peering service. +.Example +New-AzPeeringConnectionMonitorTest -Name TestName -PeeringServiceName DRTest -ResourceGroupName DemoRG + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringconnectionmonitortest +#> +function New-AzPeeringConnectionMonitorTest { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('ConnectionMonitorTestName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the connection monitor test + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The Connection Monitor test destination + ${Destination}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The Connection Monitor test destination port + ${DestinationPort}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The Connection Monitor test source agent + ${SourceAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The Connection Monitor test frequency in seconds + ${TestFrequencyInSec}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringConnectionMonitorTest_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Creates a new registered ASN with the specified name under the given subscription, resource group and peering. +.Description +Creates a new registered ASN with the specified name under the given subscription, resource group and peering. +.Example +New-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Asn 65001 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringregisteredasn +#> +function New-AzPeeringRegisteredAsn { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('RegisteredAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the ASN. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The customer's ASN from which traffic originates. + ${Asn}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringRegisteredAsn_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Creates a new registered prefix with the specified name under the given subscription, resource group and peering. +.Description +Creates a new registered prefix with the specified name under the given subscription, resource group and peering. +.Example +New-AzPeeringRegisteredPrefix -Name accessibilityTesting6 -PeeringName DemoPeering -ResourceGroupName DemoRG -Prefix 240.0.5.0/24 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringregisteredprefix +#> +function New-AzPeeringRegisteredPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('RegisteredPrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered prefix. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The customer's prefix from which traffic originates. + ${Prefix}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringRegisteredPrefix_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Creates a new prefix with the specified name under the given subscription, resource group and peering service. +.Description +Creates a new prefix with the specified name under the given subscription, resource group and peering service. +.Example +New-AzPeeringServicePrefix -Name TestPrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG -PeeringServicePrefixKey 6a7f0d42-e49c-4eea-a930-280610671c3f -Prefix 91.194.255.0/24 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringserviceprefix +#> +function New-AzPeeringServicePrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the prefix. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The peering service prefix key + ${PeeringServicePrefixKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The prefix from which your traffic originates. + ${Prefix}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringServicePrefix_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Creates a new peering service or updates an existing peering with the specified name under the given subscription and resource group. +.Description +Creates a new peering service or updates an existing peering with the specified name under the given subscription and resource group. +.Example +New-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG -Location "East US 2" -PeeringServiceLocation Georgia -PeeringServiceProvider MicrosoftEdge -ProviderPrimaryPeeringLocation Atlanta + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringservice +#> +function New-AzPeeringService { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PeeringServiceName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The location of the resource. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The location (state/province) of the customer. + ${PeeringServiceLocation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The name of the service provider. + ${PeeringServiceProvider}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The backup peering (Microsoft/service provider) location to be used for customer traffic. + ${ProviderBackupPeeringLocation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The primary peering (Microsoft/service provider) location to be used for customer traffic. + ${ProviderPrimaryPeeringLocation}, + + [Parameter()] + [Alias('SkuName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The name of the peering service SKU. + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags]))] + [System.Collections.Hashtable] + # The resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeeringService_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Creates a new peering or updates an existing peering with the specified name under the given subscription and resource group. +.Description +Creates a new peering or updates an existing peering with the specified name under the given subscription and resource group. +.Example +$connection1 = New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 ... +$directConnections = ,$connection1 +New-AzPeering -Name TestPeeringPs -ResourceGroupName DemoRG -Kind Direct -Location "South Central US" -DirectConnection $directConnections -DirectPeeringType Cdn -DirectPeerAsnId $peerAsnId -PeeringLocation Dallas -Sku Premium_Direct_Unlimited + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering +.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. + +DIRECTCONNECTION : The set of connections that constitute a direct peering. + [BandwidthInMbps ]: The bandwidth of the connection. + [BgpSessionMaxPrefixesAdvertisedV4 ]: The maximum number of prefixes advertised over the IPv4 session. + [BgpSessionMaxPrefixesAdvertisedV6 ]: The maximum number of prefixes advertised over the IPv6 session. + [BgpSessionMd5AuthenticationKey ]: The MD5 authentication key of the session. + [BgpSessionMicrosoftSessionIPv4Address ]: The IPv4 session address on Microsoft's end. + [BgpSessionMicrosoftSessionIPv6Address ]: The IPv6 session address on Microsoft's end. + [BgpSessionPeerSessionIPv4Address ]: The IPv4 session address on peer's end. + [BgpSessionPeerSessionIPv6Address ]: The IPv6 session address on peer's end. + [BgpSessionPrefixV4 ]: The IPv4 prefix that contains both ends' IPv4 addresses. + [BgpSessionPrefixV6 ]: The IPv6 prefix that contains both ends' IPv6 addresses. + [ConnectionIdentifier ]: The unique identifier (GUID) for the connection. + [PeeringDbFacilityId ]: The PeeringDB.com ID of the facility at which the connection has to be set up. + [SessionAddressProvider ]: The field indicating if Microsoft provides session ip addresses. + [UseForPeeringService ]: The flag that indicates whether or not the connection is used for peering service. + +EXCHANGECONNECTION : The set of connections that constitute an exchange peering. + [BgpSessionMaxPrefixesAdvertisedV4 ]: The maximum number of prefixes advertised over the IPv4 session. + [BgpSessionMaxPrefixesAdvertisedV6 ]: The maximum number of prefixes advertised over the IPv6 session. + [BgpSessionMd5AuthenticationKey ]: The MD5 authentication key of the session. + [BgpSessionMicrosoftSessionIPv4Address ]: The IPv4 session address on Microsoft's end. + [BgpSessionMicrosoftSessionIPv6Address ]: The IPv6 session address on Microsoft's end. + [BgpSessionPeerSessionIPv4Address ]: The IPv4 session address on peer's end. + [BgpSessionPeerSessionIPv6Address ]: The IPv6 session address on peer's end. + [BgpSessionPrefixV4 ]: The IPv4 prefix that contains both ends' IPv4 addresses. + [BgpSessionPrefixV6 ]: The IPv6 prefix that contains both ends' IPv6 addresses. + [ConnectionIdentifier ]: The unique identifier (GUID) for the connection. + [PeeringDbFacilityId ]: The PeeringDB.com ID of the facility at which the connection has to be set up. +.Link +https://learn.microsoft.com/powershell/module/az.peering/new-azpeering +#> +function New-AzPeering { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PeeringName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind] + # The kind of the peering. + ${Kind}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The location of the resource. + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[]] + # The set of connections that constitute a direct peering. + # To construct, see NOTES section for DIRECTCONNECTION properties and create a hash table. + ${DirectConnection}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The identifier of the referenced resource. + ${DirectPeerAsnId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType] + # The type of direct peering. + ${DirectPeeringType}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[]] + # The set of connections that constitute an exchange peering. + # To construct, see NOTES section for EXCHANGECONNECTION properties and create a hash table. + ${ExchangeConnection}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The identifier of the referenced resource. + ${ExchangePeerAsnId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The location of the peering. + ${PeeringLocation}, + + [Parameter()] + [Alias('SkuName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The name of the peering SKU. + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags]))] + [System.Collections.Hashtable] + # The resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Peering.private\New-AzPeering_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes an existing peer ASN with the specified name under the given subscription. +.Description +Deletes an existing peer ASN with the specified name under the given subscription. +.Example +Remove-AzPeeringAsn -Name PsTestAsn + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringasn +#> +function Remove-AzPeeringAsn { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PeerAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The peer ASN name. + ${Name}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringAsn_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringAsn_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service. +.Description +Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service. +.Example +Remove-AzPeeringConnectionMonitorTest -Name TestName -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringconnectionmonitortest +#> +function Remove-AzPeeringConnectionMonitorTest { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('ConnectionMonitorTestName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the connection monitor test + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringConnectionMonitorTest_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringConnectionMonitorTest_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. +.Description +Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. +.Example +Remove-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringregisteredasn +#> +function Remove-AzPeeringRegisteredAsn { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('RegisteredAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered ASN. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringRegisteredAsn_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringRegisteredAsn_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Description +Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Example +Remove-AzPeeringRegisteredPrefix -Name accessibilityTesting6 -PeeringName DemoPeering -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringregisteredprefix +#> +function Remove-AzPeeringRegisteredPrefix { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('RegisteredPrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered prefix. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringRegisteredPrefix_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringRegisteredPrefix_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. +.Description +Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. +.Example +Remove-AzPeeringServicePrefix -Name TestPrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroup DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringserviceprefix +#> +function Remove-AzPeeringServicePrefix { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the prefix. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringServicePrefix_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringServicePrefix_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes an existing peering service with the specified name under the given subscription and resource group. +.Description +Deletes an existing peering service with the specified name under the given subscription and resource group. +.Example +Remove-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringservice +#> +function Remove-AzPeeringService { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PeeringServiceName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringService_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringService_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes an existing peering with the specified name under the given subscription and resource group. +.Description +Deletes an existing peering with the specified name under the given subscription and resource group. +.Example +Remove-AzPeering -Name TestPeering -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeering +#> +function Remove-AzPeering { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PeeringName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeering_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeering_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Run looking glass functionality +.Description +Run looking glass functionality +.Example +Start-AzPeeringInvokeLookingGlass -Command Ping -DestinationIp 1.1.1.1 -SourceLocation Seattle -SourceType EdgeSite + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/start-azpeeringinvokelookingglass +#> +function Start-AzPeeringInvokeLookingGlass { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput])] +[CmdletBinding(DefaultParameterSetName='Invoke', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Invoke')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='InvokeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand] + # The command to be executed: ping, traceroute, bgpRoute. + ${Command}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The IP address of the destination. + ${DestinationIP}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The location of the source. + ${SourceLocation}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType] + # The type of the source: Edge site or Azure Region. + ${SourceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Invoke = 'Az.Peering.private\Start-AzPeeringInvokeLookingGlass_Invoke'; + InvokeViaIdentity = 'Az.Peering.private\Start-AzPeeringInvokeLookingGlass_InvokeViaIdentity'; + } + if (('Invoke') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Description +Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Example +Test-AzPeeringRegisteredPrefix -Name accessibilityTesting2 -PeeringName DemoPeering -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/test-azpeeringregisteredprefix +#> +function Test-AzPeeringRegisteredPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix])] +[CmdletBinding(DefaultParameterSetName='Validate', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Validate', Mandatory)] + [Alias('RegisteredPrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered prefix. + ${Name}, + + [Parameter(ParameterSetName='Validate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Validate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Validate')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ValidateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Validate = 'Az.Peering.private\Test-AzPeeringRegisteredPrefix_Validate'; + ValidateViaIdentity = 'Az.Peering.private\Test-AzPeeringRegisteredPrefix_ValidateViaIdentity'; + } + if (('Validate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Checks if the peering service provider is present within 1000 miles of customer's location +.Description +Checks if the peering service provider is present within 1000 miles of customer's location +.Example +$providerAvailability = New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ +Test-AzPeeringServiceProviderAvailability -CheckServiceProviderAvailabilityInput $providerAvailability + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.String +.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. + +CHECKSERVICEPROVIDERAVAILABILITYINPUT : Class for CheckServiceProviderAvailabilityInput + [PeeringServiceLocation ]: Gets or sets the peering service location. + [PeeringServiceProvider ]: Gets or sets the peering service provider. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/test-azpeeringserviceprovideravailability +#> +function Test-AzPeeringServiceProviderAvailability { +[OutputType([System.String])] +[CmdletBinding(DefaultParameterSetName='CheckExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Check')] + [Parameter(ParameterSetName='CheckExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CheckViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CheckViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Check', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CheckViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput] + # Class for CheckServiceProviderAvailabilityInput + # To construct, see NOTES section for CHECKSERVICEPROVIDERAVAILABILITYINPUT properties and create a hash table. + ${CheckServiceProviderAvailabilityInput}, + + [Parameter(ParameterSetName='CheckExpanded')] + [Parameter(ParameterSetName='CheckViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # Gets or sets the peering service location. + ${PeeringServiceLocation}, + + [Parameter(ParameterSetName='CheckExpanded')] + [Parameter(ParameterSetName='CheckViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # Gets or sets the peering service provider. + ${PeeringServiceProvider}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Check = 'Az.Peering.private\Test-AzPeeringServiceProviderAvailability_Check'; + CheckExpanded = 'Az.Peering.private\Test-AzPeeringServiceProviderAvailability_CheckExpanded'; + CheckViaIdentity = 'Az.Peering.private\Test-AzPeeringServiceProviderAvailability_CheckViaIdentity'; + CheckViaIdentityExpanded = 'Az.Peering.private\Test-AzPeeringServiceProviderAvailability_CheckViaIdentityExpanded'; + } + if (('Check', 'CheckExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Updates tags for a peering service with the specified name under the given subscription and resource group. +.Description +Updates tags for a peering service with the specified name under the given subscription and resource group. +.Example +$tags=@{hello='world'} +Update-AzPeeringService -Name DRTestInterCloud -ResourceGroupName DemoRG -Tag $tags + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/update-azpeeringservice +#> +function Update-AzPeeringService { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('PeeringServiceName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags]))] + [System.Collections.Hashtable] + # Gets or sets the tags, a dictionary of descriptors arm object + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Peering.private\Update-AzPeeringService_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Peering.private\Update-AzPeeringService_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Updates tags for a peering with the specified name under the given subscription and resource group. +.Description +Updates tags for a peering with the specified name under the given subscription and resource group. +.Example +$tags=@{hello='world'} +Update-AzPeering -Name DemoPeering -ResourceGroupName DemoRG -Tag $tags + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/update-azpeering +#> +function Update-AzPeering { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('PeeringName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags]))] + [System.Collections.Hashtable] + # Gets or sets the tags, a dictionary of descriptors arm object + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Peering.private\Update-AzPeering_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Peering.private\Update-AzPeering_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for CheckServiceProviderAvailabilityInput. +.Description +Create an in-memory object for CheckServiceProviderAvailabilityInput. +.Example +New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringCheckServiceProviderAvailabilityInputObject +#> +function New-AzPeeringCheckServiceProviderAvailabilityInputObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # Gets or sets the peering service location. + ${PeeringServiceLocation}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # Gets or sets the peering service provider. + ${PeeringServiceProvider} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Peering.custom\New-AzPeeringCheckServiceProviderAvailabilityInputObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for ContactDetail. +.Description +Create an in-memory object for ContactDetail. +.Example +New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringContactDetailObject +#> +function New-AzPeeringContactDetailObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The e-mail address of the contact. + ${Email}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The phone number of the contact. + ${Phone}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role] + # The role of the contact. + ${Role} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Peering.custom\New-AzPeeringContactDetailObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for DirectConnection. +.Description +Create an in-memory object for DirectConnection. +.Example +New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 1.1.1.1 -BgpSessionPeerSessionIPv4Address 1.1.1.0 -BgpSessionPrefixV4 1.1.1.1/31 -PeeringDbFacilityId 82 -SessionAddressProvider Peer -ConnectionIdentifier c111111111111 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringDirectConnectionObject +#> +function New-AzPeeringDirectConnectionObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The bandwidth of the connection. + ${BandwidthInMbps}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The maximum number of prefixes advertised over the IPv4 session. + ${BgpSessionMaxPrefixesAdvertisedV4}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The maximum number of prefixes advertised over the IPv6 session. + ${BgpSessionMaxPrefixesAdvertisedV6}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The MD5 authentication key of the session. + ${BgpSessionMd5AuthenticationKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 session address on Microsoft's end. + ${BgpSessionMicrosoftSessionIPv4Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 session address on Microsoft's end. + ${BgpSessionMicrosoftSessionIPv6Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 session address on peer's end. + ${BgpSessionPeerSessionIPv4Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 session address on peer's end. + ${BgpSessionPeerSessionIPv6Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 prefix that contains both ends' IPv4 addresses. + ${BgpSessionPrefixV4}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 prefix that contains both ends' IPv6 addresses. + ${BgpSessionPrefixV6}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The unique identifier (GUID) for the connection. + ${ConnectionIdentifier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The PeeringDB.com ID of the facility at which the connection has to be set up. + ${PeeringDbFacilityId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider] + # The field indicating if Microsoft provides session ip addresses. + ${SessionAddressProvider}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Boolean] + # The flag that indicates whether or not the connection is used for peering service. + ${UseForPeeringService} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Peering.custom\New-AzPeeringDirectConnectionObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create an in-memory object for ExchangeConnection. +.Description +Create an in-memory object for ExchangeConnection. +.Example +New-AzPeeringExchangeConnectionObject -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 1.1.1.1 -BgpSessionPeerSessionIPv4Address 1.1.1.0 -BgpSessionPrefixV4 1.1.1.1/31 -PeeringDbFacilityId 82 -ConnectionIdentifier c111111111111 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection +.Link +https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringExchangeConnectionObject +#> +function New-AzPeeringExchangeConnectionObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The maximum number of prefixes advertised over the IPv4 session. + ${BgpSessionMaxPrefixesAdvertisedV4}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The maximum number of prefixes advertised over the IPv6 session. + ${BgpSessionMaxPrefixesAdvertisedV6}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The MD5 authentication key of the session. + ${BgpSessionMd5AuthenticationKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 session address on Microsoft's end. + ${BgpSessionMicrosoftSessionIPv4Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 session address on Microsoft's end. + ${BgpSessionMicrosoftSessionIPv6Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 session address on peer's end. + ${BgpSessionPeerSessionIPv4Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 session address on peer's end. + ${BgpSessionPeerSessionIPv6Address}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv4 prefix that contains both ends' IPv4 addresses. + ${BgpSessionPrefixV4}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The IPv6 prefix that contains both ends' IPv6 addresses. + ${BgpSessionPrefixV6}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # The unique identifier (GUID) for the connection. + ${ConnectionIdentifier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.Int32] + # The PeeringDB.com ID of the facility at which the connection has to be set up. + ${PeeringDbFacilityId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.Peering.custom\New-AzPeeringExchangeConnectionObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/README.md b/src/Peering/exports/README.md new file mode 100644 index 000000000000..3d63e42f4514 --- /dev/null +++ b/src/Peering/exports/README.md @@ -0,0 +1,20 @@ +# Exports +This directory contains the cmdlets *exported by* `Az.Peering`. No other cmdlets in this repository are directly exported. What that means is the `Az.Peering` module will run [Export-ModuleMember](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`..\bin\Az.Peering.private.dll`) and from the `..\custom\Az.Peering.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [README.md](..\internal/README.md) in the `..\internal` folder. + +## Purpose +We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles. + +## Structure +The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile. + +## Usage +When `./Az.Peering.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message. \ No newline at end of file diff --git a/src/Peering/exports/Remove-AzPeering.ps1 b/src/Peering/exports/Remove-AzPeering.ps1 new file mode 100644 index 000000000000..ab44621e3d53 --- /dev/null +++ b/src/Peering/exports/Remove-AzPeering.ps1 @@ -0,0 +1,209 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Deletes an existing peering with the specified name under the given subscription and resource group. +.Description +Deletes an existing peering with the specified name under the given subscription and resource group. +.Example +Remove-AzPeering -Name TestPeering -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeering +#> +function Remove-AzPeering { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PeeringName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeering_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeering_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Remove-AzPeeringAsn.ps1 b/src/Peering/exports/Remove-AzPeeringAsn.ps1 new file mode 100644 index 000000000000..e96ed6055d2c --- /dev/null +++ b/src/Peering/exports/Remove-AzPeeringAsn.ps1 @@ -0,0 +1,203 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Deletes an existing peer ASN with the specified name under the given subscription. +.Description +Deletes an existing peer ASN with the specified name under the given subscription. +.Example +Remove-AzPeeringAsn -Name PsTestAsn + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringasn +#> +function Remove-AzPeeringAsn { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PeerAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The peer ASN name. + ${Name}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringAsn_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringAsn_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Remove-AzPeeringConnectionMonitorTest.ps1 b/src/Peering/exports/Remove-AzPeeringConnectionMonitorTest.ps1 new file mode 100644 index 000000000000..ae474e32b9b0 --- /dev/null +++ b/src/Peering/exports/Remove-AzPeeringConnectionMonitorTest.ps1 @@ -0,0 +1,215 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service. +.Description +Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service. +.Example +Remove-AzPeeringConnectionMonitorTest -Name TestName -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringconnectionmonitortest +#> +function Remove-AzPeeringConnectionMonitorTest { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('ConnectionMonitorTestName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the connection monitor test + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringConnectionMonitorTest_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringConnectionMonitorTest_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Remove-AzPeeringRegisteredAsn.ps1 b/src/Peering/exports/Remove-AzPeeringRegisteredAsn.ps1 new file mode 100644 index 000000000000..25bf7c47a207 --- /dev/null +++ b/src/Peering/exports/Remove-AzPeeringRegisteredAsn.ps1 @@ -0,0 +1,215 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. +.Description +Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. +.Example +Remove-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringregisteredasn +#> +function Remove-AzPeeringRegisteredAsn { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('RegisteredAsnName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered ASN. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringRegisteredAsn_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringRegisteredAsn_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Remove-AzPeeringRegisteredPrefix.ps1 b/src/Peering/exports/Remove-AzPeeringRegisteredPrefix.ps1 new file mode 100644 index 000000000000..13ffce8c3245 --- /dev/null +++ b/src/Peering/exports/Remove-AzPeeringRegisteredPrefix.ps1 @@ -0,0 +1,215 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Description +Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Example +Remove-AzPeeringRegisteredPrefix -Name accessibilityTesting6 -PeeringName DemoPeering -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringregisteredprefix +#> +function Remove-AzPeeringRegisteredPrefix { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('RegisteredPrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered prefix. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringRegisteredPrefix_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringRegisteredPrefix_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Remove-AzPeeringService.ps1 b/src/Peering/exports/Remove-AzPeeringService.ps1 new file mode 100644 index 000000000000..567da57fa3bb --- /dev/null +++ b/src/Peering/exports/Remove-AzPeeringService.ps1 @@ -0,0 +1,209 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Deletes an existing peering service with the specified name under the given subscription and resource group. +.Description +Deletes an existing peering service with the specified name under the given subscription and resource group. +.Example +Remove-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringservice +#> +function Remove-AzPeeringService { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PeeringServiceName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringService_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringService_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Remove-AzPeeringServicePrefix.ps1 b/src/Peering/exports/Remove-AzPeeringServicePrefix.ps1 new file mode 100644 index 000000000000..d0f547387e46 --- /dev/null +++ b/src/Peering/exports/Remove-AzPeeringServicePrefix.ps1 @@ -0,0 +1,215 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. +.Description +Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. +.Example +Remove-AzPeeringServicePrefix -Name TestPrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroup DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.Boolean +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringserviceprefix +#> +function Remove-AzPeeringServicePrefix { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the prefix. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${PeeringServiceName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Peering.private\Remove-AzPeeringServicePrefix_Delete'; + DeleteViaIdentity = 'Az.Peering.private\Remove-AzPeeringServicePrefix_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Start-AzPeeringInvokeLookingGlass.ps1 b/src/Peering/exports/Start-AzPeeringInvokeLookingGlass.ps1 new file mode 100644 index 000000000000..2d2661b422dc --- /dev/null +++ b/src/Peering/exports/Start-AzPeeringInvokeLookingGlass.ps1 @@ -0,0 +1,216 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Run looking glass functionality +.Description +Run looking glass functionality +.Example +Start-AzPeeringInvokeLookingGlass -Command Ping -DestinationIp 1.1.1.1 -SourceLocation Seattle -SourceType EdgeSite + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/start-azpeeringinvokelookingglass +#> +function Start-AzPeeringInvokeLookingGlass { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput])] +[CmdletBinding(DefaultParameterSetName='Invoke', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Invoke')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='InvokeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand] + # The command to be executed: ping, traceroute, bgpRoute. + ${Command}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The IP address of the destination. + ${DestinationIP}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [System.String] + # The location of the source. + ${SourceLocation}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType])] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType] + # The type of the source: Edge site or Azure Region. + ${SourceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Invoke = 'Az.Peering.private\Start-AzPeeringInvokeLookingGlass_Invoke'; + InvokeViaIdentity = 'Az.Peering.private\Start-AzPeeringInvokeLookingGlass_InvokeViaIdentity'; + } + if (('Invoke') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Test-AzPeeringRegisteredPrefix.ps1 b/src/Peering/exports/Test-AzPeeringRegisteredPrefix.ps1 new file mode 100644 index 000000000000..0584e2eadc9e --- /dev/null +++ b/src/Peering/exports/Test-AzPeeringRegisteredPrefix.ps1 @@ -0,0 +1,209 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Description +Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. +.Example +Test-AzPeeringRegisteredPrefix -Name accessibilityTesting2 -PeeringName DemoPeering -ResourceGroupName DemoRG + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/test-azpeeringregisteredprefix +#> +function Test-AzPeeringRegisteredPrefix { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix])] +[CmdletBinding(DefaultParameterSetName='Validate', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Validate', Mandatory)] + [Alias('RegisteredPrefixName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the registered prefix. + ${Name}, + + [Parameter(ParameterSetName='Validate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${PeeringName}, + + [Parameter(ParameterSetName='Validate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Validate')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ValidateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Validate = 'Az.Peering.private\Test-AzPeeringRegisteredPrefix_Validate'; + ValidateViaIdentity = 'Az.Peering.private\Test-AzPeeringRegisteredPrefix_ValidateViaIdentity'; + } + if (('Validate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Test-AzPeeringServiceProviderAvailability.ps1 b/src/Peering/exports/Test-AzPeeringServiceProviderAvailability.ps1 new file mode 100644 index 000000000000..77b20e771f13 --- /dev/null +++ b/src/Peering/exports/Test-AzPeeringServiceProviderAvailability.ps1 @@ -0,0 +1,223 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Checks if the peering service provider is present within 1000 miles of customer's location +.Description +Checks if the peering service provider is present within 1000 miles of customer's location +.Example +$providerAvailability = New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ +Test-AzPeeringServiceProviderAvailability -CheckServiceProviderAvailabilityInput $providerAvailability + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +System.String +.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. + +CHECKSERVICEPROVIDERAVAILABILITYINPUT : Class for CheckServiceProviderAvailabilityInput + [PeeringServiceLocation ]: Gets or sets the peering service location. + [PeeringServiceProvider ]: Gets or sets the peering service provider. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/test-azpeeringserviceprovideravailability +#> +function Test-AzPeeringServiceProviderAvailability { +[OutputType([System.String])] +[CmdletBinding(DefaultParameterSetName='CheckExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Check')] + [Parameter(ParameterSetName='CheckExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CheckViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CheckViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Check', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CheckViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput] + # Class for CheckServiceProviderAvailabilityInput + # To construct, see NOTES section for CHECKSERVICEPROVIDERAVAILABILITYINPUT properties and create a hash table. + ${CheckServiceProviderAvailabilityInput}, + + [Parameter(ParameterSetName='CheckExpanded')] + [Parameter(ParameterSetName='CheckViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # Gets or sets the peering service location. + ${PeeringServiceLocation}, + + [Parameter(ParameterSetName='CheckExpanded')] + [Parameter(ParameterSetName='CheckViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [System.String] + # Gets or sets the peering service provider. + ${PeeringServiceProvider}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Check = 'Az.Peering.private\Test-AzPeeringServiceProviderAvailability_Check'; + CheckExpanded = 'Az.Peering.private\Test-AzPeeringServiceProviderAvailability_CheckExpanded'; + CheckViaIdentity = 'Az.Peering.private\Test-AzPeeringServiceProviderAvailability_CheckViaIdentity'; + CheckViaIdentityExpanded = 'Az.Peering.private\Test-AzPeeringServiceProviderAvailability_CheckViaIdentityExpanded'; + } + if (('Check', 'CheckExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Update-AzPeering.ps1 b/src/Peering/exports/Update-AzPeering.ps1 new file mode 100644 index 000000000000..9aa3b4da9e13 --- /dev/null +++ b/src/Peering/exports/Update-AzPeering.ps1 @@ -0,0 +1,211 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Updates tags for a peering with the specified name under the given subscription and resource group. +.Description +Updates tags for a peering with the specified name under the given subscription and resource group. +.Example +$tags=@{hello='world'} +Update-AzPeering -Name DemoPeering -ResourceGroupName DemoRG -Tag $tags + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/update-azpeering +#> +function Update-AzPeering { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('PeeringName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags]))] + [System.Collections.Hashtable] + # Gets or sets the tags, a dictionary of descriptors arm object + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Peering.private\Update-AzPeering_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Peering.private\Update-AzPeering_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/exports/Update-AzPeeringService.ps1 b/src/Peering/exports/Update-AzPeeringService.ps1 new file mode 100644 index 000000000000..40ef8f3d5293 --- /dev/null +++ b/src/Peering/exports/Update-AzPeeringService.ps1 @@ -0,0 +1,211 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Updates tags for a peering service with the specified name under the given subscription and resource group. +.Description +Updates tags for a peering service with the specified name under the given subscription and resource group. +.Example +$tags=@{hello='world'} +Update-AzPeeringService -Name DRTestInterCloud -ResourceGroupName DemoRG -Tag $tags + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService +.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. + +INPUTOBJECT : Identity Parameter + [ConnectionMonitorTestName ]: The name of the connection monitor test + [Id ]: Resource identity path + [PeerAsnName ]: The peer ASN name. + [PeeringName ]: The name of the peering. + [PeeringServiceName ]: The name of the peering service. + [PrefixName ]: The name of the prefix. + [RegisteredAsnName ]: The name of the registered ASN. + [RegisteredPrefixName ]: The name of the registered prefix. + [ResourceGroupName ]: The name of the resource group. + [SubscriptionId ]: The Azure subscription ID. +.Link +https://learn.microsoft.com/powershell/module/az.peering/update-azpeeringservice +#> +function Update-AzPeeringService { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('PeeringServiceName')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the peering service. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The Azure subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags]))] + [System.Collections.Hashtable] + # Gets or sets the tags, a dictionary of descriptors arm object + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Peering.private\Update-AzPeeringService_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Peering.private\Update-AzPeeringService_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Peering/generate-help.ps1 b/src/Peering/generate-help.ps1 new file mode 100644 index 000000000000..1044cc480432 --- /dev/null +++ b/src/Peering/generate-help.ps1 @@ -0,0 +1,74 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(-not (Test-Path $exportsFolder)) { + Write-Error "Exports folder '$exportsFolder' was not found." +} + +$directories = Get-ChildItem -Directory -Path $exportsFolder +$hasProfiles = ($directories | Measure-Object).Count -gt 0 +if(-not $hasProfiles) { + $directories = Get-Item -Path $exportsFolder +} + +$docsFolder = Join-Path $PSScriptRoot 'docs' +if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue +$examplesFolder = Join-Path $PSScriptRoot 'examples' + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Peering.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.Peering.private.dll') +$instance = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName + +foreach($directory in $directories) +{ + if($hasProfiles) { + Select-AzProfile -Name $directory.Name + } + # Reload module per profile + Import-Module -Name $modulePath -Force + + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName + $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full } + $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo + + $docsPath = Join-Path $docsFolder $directory.Name + $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue + $examplesPath = Join-Path $examplesFolder $directory.Name + + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath + Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Peering/generate-info.json b/src/Peering/generate-info.json new file mode 100644 index 000000000000..db68fb1d287b --- /dev/null +++ b/src/Peering/generate-info.json @@ -0,0 +1,8 @@ +{ + "swagger_commit": "90a294fca4845153be79d926b7415be5375522ac", + "node": "v14.15.5", + "autorest": "`-- (empty)", + "autorest_core": "3.9.4", + "autorest_modelerfour": "4.15.414", + "autorest_powershell": "3.0.498" +} diff --git a/src/Peering/generated/Module.cs b/src/Peering/generated/Module.cs new file mode 100644 index 000000000000..43728b26f0f4 --- /dev/null +++ b/src/Peering/generated/Module.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>; + using GetParameterDelegate = global::System.Func; + using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using ArgumentCompleterDelegate = global::System.Func; + using GetTelemetryIdDelegate = global::System.Func; + using TelemetryDelegate = global::System.Action; + using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; + using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; + using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + + /// A class that contains the module-common code and data. + public partial class Module + { + /// The currently selected profile. + public string Profile = global::System.String.Empty; + + public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + + /// the ISendAsync pipeline instance + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline _pipeline; + + /// the ISendAsync pipeline instance (when proxy is enabled) + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline _pipelineWithProxy; + + public bool _useProxy = false; + + public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); + + /// Gets completion data for azure specific fields + public ArgumentCompleterDelegate ArgumentCompleter { get; set; } + + /// The instance of the Client API + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering ClientAPI { get; set; } + + /// A delegate that gets called for each signalled event + public EventListenerDelegate EventListener { get; set; } + + /// The delegate to call to get parameter data from a common module. + public GetParameterDelegate GetParameterValue { get; set; } + + /// The delegate to get the telemetry Id. + public GetTelemetryIdDelegate GetTelemetryId { get; set; } + + /// Backing field for property. + private static Microsoft.Azure.PowerShell.Cmdlets.Peering.Module _instance; + + /// the singleton of this module class + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Module()); + + /// The Name of this module + public string Name => @"Az.Peering"; + + /// The delegate to call when this module is loaded (supporting a commmon module). + public ModuleLoadPipelineDelegate OnModuleLoad { get; set; } + + /// The delegate to call before each new request (supporting a commmon module). + public NewRequestPipelineDelegate OnNewRequest { get; set; } + + /// The name of the currently selected Azure profile + public global::System.String ProfileName { get; set; } + + /// The ResourceID for this module (azure arm). + public string ResourceId => @"Az.Peering"; + + /// The delegate for creating a telemetry. + public TelemetryDelegate Telemetry { get; set; } + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline pipeline); + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline pipeline); + + partial void CustomInit(); + + /// Creates an instance of the HttpPipeline for each call. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the cmdlet's parameterset name. + /// a dict for extensible parameters + /// An instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline for the remote call. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null, global::System.Collections.Generic.IDictionary extensibleParameters = null) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline pipeline = null; + BeforeCreatePipeline(invocationInfo, ref pipeline); + pipeline = (pipeline ?? (_useProxy ? _pipelineWithProxy : _pipeline)).Clone(); + AfterCreatePipeline(invocationInfo, ref pipeline); + pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); + OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); + return pipeline; + } + + /// Gets parameters from a common module. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// The name of the parameter to get the value for. + /// + /// The parameter value from the common module. (Note: this should be type converted on the way back) + /// + public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName ); + + /// Initialization steps performed after the module is loaded. + public void Init() + { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + } + + /// Creates the module instance. + private Module() + { + // constructor + ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering(); + _handler.Proxy = _webProxy; + _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); + _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler))); + } + + /// The HTTP Proxy to use. + /// The HTTP Proxy Credentials + /// True if the proxy should use default credentials + public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) + { + _useProxy = proxy != null; + if (proxy == null) + { + return; + } + // set the proxy configuration + _webProxy.Address = proxy; + _webProxy.BypassProxyOnLocal = false; + if (proxyUseDefaultCredentials) + { + _webProxy.Credentials = null; + _webProxy.UseDefaultCredentials = true; + } + else + { + _webProxy.UseDefaultCredentials = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + } + } + + /// Called to dispatch events to the common module listener + /// The ID of the event + /// The cancellation token for the event + /// A delegate to get the detailed event data + /// The callback for the event dispatcher + /// The from the cmdlet + /// the cmdlet's parameterset name. + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the exception that is being thrown (if available) + /// + /// A that will be complete when handling of the event is completed. + /// + public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception) + { + using( NoSynchronizationContext ) + { + await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/BgpSession.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/BgpSession.PowerShell.cs new file mode 100644 index 000000000000..59ad6e1e62bb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/BgpSession.PowerShell.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a BGP session. + [System.ComponentModel.TypeConverter(typeof(BgpSessionTypeConverter))] + public partial class BgpSession + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BgpSession(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SessionPrefixV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionPrefixV4 = (string) content.GetValueForProperty("SessionPrefixV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionPrefixV4, global::System.Convert.ToString); + } + if (content.Contains("SessionPrefixV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionPrefixV6 = (string) content.GetValueForProperty("SessionPrefixV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionPrefixV6, global::System.Convert.ToString); + } + if (content.Contains("MicrosoftSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MicrosoftSessionIPv4Address = (string) content.GetValueForProperty("MicrosoftSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MicrosoftSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("MicrosoftSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MicrosoftSessionIPv6Address = (string) content.GetValueForProperty("MicrosoftSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MicrosoftSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("PeerSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).PeerSessionIPv4Address = (string) content.GetValueForProperty("PeerSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).PeerSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("PeerSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).PeerSessionIPv6Address = (string) content.GetValueForProperty("PeerSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).PeerSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("SessionStateV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionStateV4 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4?) content.GetValueForProperty("SessionStateV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionStateV4, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4.CreateFrom); + } + if (content.Contains("SessionStateV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionStateV6 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6?) content.GetValueForProperty("SessionStateV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionStateV6, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6.CreateFrom); + } + if (content.Contains("MaxPrefixesAdvertisedV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MaxPrefixesAdvertisedV4 = (int?) content.GetValueForProperty("MaxPrefixesAdvertisedV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MaxPrefixesAdvertisedV4, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MaxPrefixesAdvertisedV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MaxPrefixesAdvertisedV6 = (int?) content.GetValueForProperty("MaxPrefixesAdvertisedV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MaxPrefixesAdvertisedV6, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Md5AuthenticationKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).Md5AuthenticationKey = (string) content.GetValueForProperty("Md5AuthenticationKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).Md5AuthenticationKey, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BgpSession(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SessionPrefixV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionPrefixV4 = (string) content.GetValueForProperty("SessionPrefixV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionPrefixV4, global::System.Convert.ToString); + } + if (content.Contains("SessionPrefixV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionPrefixV6 = (string) content.GetValueForProperty("SessionPrefixV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionPrefixV6, global::System.Convert.ToString); + } + if (content.Contains("MicrosoftSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MicrosoftSessionIPv4Address = (string) content.GetValueForProperty("MicrosoftSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MicrosoftSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("MicrosoftSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MicrosoftSessionIPv6Address = (string) content.GetValueForProperty("MicrosoftSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MicrosoftSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("PeerSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).PeerSessionIPv4Address = (string) content.GetValueForProperty("PeerSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).PeerSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("PeerSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).PeerSessionIPv6Address = (string) content.GetValueForProperty("PeerSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).PeerSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("SessionStateV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionStateV4 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4?) content.GetValueForProperty("SessionStateV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionStateV4, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4.CreateFrom); + } + if (content.Contains("SessionStateV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionStateV6 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6?) content.GetValueForProperty("SessionStateV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).SessionStateV6, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6.CreateFrom); + } + if (content.Contains("MaxPrefixesAdvertisedV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MaxPrefixesAdvertisedV4 = (int?) content.GetValueForProperty("MaxPrefixesAdvertisedV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MaxPrefixesAdvertisedV4, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MaxPrefixesAdvertisedV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MaxPrefixesAdvertisedV6 = (int?) content.GetValueForProperty("MaxPrefixesAdvertisedV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).MaxPrefixesAdvertisedV6, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Md5AuthenticationKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).Md5AuthenticationKey = (string) content.GetValueForProperty("Md5AuthenticationKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)this).Md5AuthenticationKey, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BgpSession(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BgpSession(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a BGP session. + [System.ComponentModel.TypeConverter(typeof(BgpSessionTypeConverter))] + public partial interface IBgpSession + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/BgpSession.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/BgpSession.TypeConverter.cs new file mode 100644 index 000000000000..83cc297e78d6 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/BgpSession.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BgpSessionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BgpSession.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BgpSession.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BgpSession.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/BgpSession.cs b/src/Peering/generated/api/Models/Api20221001/BgpSession.cs new file mode 100644 index 000000000000..fed64c20ea03 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/BgpSession.cs @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a BGP session. + public partial class BgpSession : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal + { + + /// Backing field for property. + private int? _maxPrefixesAdvertisedV4; + + /// The maximum number of prefixes advertised over the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? MaxPrefixesAdvertisedV4 { get => this._maxPrefixesAdvertisedV4; set => this._maxPrefixesAdvertisedV4 = value; } + + /// Backing field for property. + private int? _maxPrefixesAdvertisedV6; + + /// The maximum number of prefixes advertised over the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? MaxPrefixesAdvertisedV6 { get => this._maxPrefixesAdvertisedV6; set => this._maxPrefixesAdvertisedV6 = value; } + + /// Backing field for property. + private string _md5AuthenticationKey; + + /// The MD5 authentication key of the session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Md5AuthenticationKey { get => this._md5AuthenticationKey; set => this._md5AuthenticationKey = value; } + + /// Internal Acessors for SessionStateV4 + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal.SessionStateV4 { get => this._sessionStateV4; set { {_sessionStateV4 = value;} } } + + /// Internal Acessors for SessionStateV6 + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal.SessionStateV6 { get => this._sessionStateV6; set { {_sessionStateV6 = value;} } } + + /// Backing field for property. + private string _microsoftSessionIPv4Address; + + /// The IPv4 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string MicrosoftSessionIPv4Address { get => this._microsoftSessionIPv4Address; set => this._microsoftSessionIPv4Address = value; } + + /// Backing field for property. + private string _microsoftSessionIPv6Address; + + /// The IPv6 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string MicrosoftSessionIPv6Address { get => this._microsoftSessionIPv6Address; set => this._microsoftSessionIPv6Address = value; } + + /// Backing field for property. + private string _peerSessionIPv4Address; + + /// The IPv4 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeerSessionIPv4Address { get => this._peerSessionIPv4Address; set => this._peerSessionIPv4Address = value; } + + /// Backing field for property. + private string _peerSessionIPv6Address; + + /// The IPv6 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeerSessionIPv6Address { get => this._peerSessionIPv6Address; set => this._peerSessionIPv6Address = value; } + + /// Backing field for property. + private string _sessionPrefixV4; + + /// The IPv4 prefix that contains both ends' IPv4 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string SessionPrefixV4 { get => this._sessionPrefixV4; set => this._sessionPrefixV4 = value; } + + /// Backing field for property. + private string _sessionPrefixV6; + + /// The IPv6 prefix that contains both ends' IPv6 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string SessionPrefixV6 { get => this._sessionPrefixV6; set => this._sessionPrefixV6 = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? _sessionStateV4; + + /// The state of the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? SessionStateV4 { get => this._sessionStateV4; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? _sessionStateV6; + + /// The state of the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? SessionStateV6 { get => this._sessionStateV6; } + + /// Creates an new instance. + public BgpSession() + { + + } + } + /// The properties that define a BGP session. + public partial interface IBgpSession : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The maximum number of prefixes advertised over the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum number of prefixes advertised over the IPv4 session.", + SerializedName = @"maxPrefixesAdvertisedV4", + PossibleTypes = new [] { typeof(int) })] + int? MaxPrefixesAdvertisedV4 { get; set; } + /// The maximum number of prefixes advertised over the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum number of prefixes advertised over the IPv6 session.", + SerializedName = @"maxPrefixesAdvertisedV6", + PossibleTypes = new [] { typeof(int) })] + int? MaxPrefixesAdvertisedV6 { get; set; } + /// The MD5 authentication key of the session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The MD5 authentication key of the session.", + SerializedName = @"md5AuthenticationKey", + PossibleTypes = new [] { typeof(string) })] + string Md5AuthenticationKey { get; set; } + /// The IPv4 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 session address on Microsoft's end.", + SerializedName = @"microsoftSessionIPv4Address", + PossibleTypes = new [] { typeof(string) })] + string MicrosoftSessionIPv4Address { get; set; } + /// The IPv6 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 session address on Microsoft's end.", + SerializedName = @"microsoftSessionIPv6Address", + PossibleTypes = new [] { typeof(string) })] + string MicrosoftSessionIPv6Address { get; set; } + /// The IPv4 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 session address on peer's end.", + SerializedName = @"peerSessionIPv4Address", + PossibleTypes = new [] { typeof(string) })] + string PeerSessionIPv4Address { get; set; } + /// The IPv6 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 session address on peer's end.", + SerializedName = @"peerSessionIPv6Address", + PossibleTypes = new [] { typeof(string) })] + string PeerSessionIPv6Address { get; set; } + /// The IPv4 prefix that contains both ends' IPv4 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 prefix that contains both ends' IPv4 addresses.", + SerializedName = @"sessionPrefixV4", + PossibleTypes = new [] { typeof(string) })] + string SessionPrefixV4 { get; set; } + /// The IPv6 prefix that contains both ends' IPv6 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 prefix that contains both ends' IPv6 addresses.", + SerializedName = @"sessionPrefixV6", + PossibleTypes = new [] { typeof(string) })] + string SessionPrefixV6 { get; set; } + /// The state of the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The state of the IPv4 session.", + SerializedName = @"sessionStateV4", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? SessionStateV4 { get; } + /// The state of the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The state of the IPv6 session.", + SerializedName = @"sessionStateV6", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? SessionStateV6 { get; } + + } + /// The properties that define a BGP session. + internal partial interface IBgpSessionInternal + + { + /// The maximum number of prefixes advertised over the IPv4 session. + int? MaxPrefixesAdvertisedV4 { get; set; } + /// The maximum number of prefixes advertised over the IPv6 session. + int? MaxPrefixesAdvertisedV6 { get; set; } + /// The MD5 authentication key of the session. + string Md5AuthenticationKey { get; set; } + /// The IPv4 session address on Microsoft's end. + string MicrosoftSessionIPv4Address { get; set; } + /// The IPv6 session address on Microsoft's end. + string MicrosoftSessionIPv6Address { get; set; } + /// The IPv4 session address on peer's end. + string PeerSessionIPv4Address { get; set; } + /// The IPv6 session address on peer's end. + string PeerSessionIPv6Address { get; set; } + /// The IPv4 prefix that contains both ends' IPv4 addresses. + string SessionPrefixV4 { get; set; } + /// The IPv6 prefix that contains both ends' IPv6 addresses. + string SessionPrefixV6 { get; set; } + /// The state of the IPv4 session. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? SessionStateV4 { get; set; } + /// The state of the IPv6 session. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? SessionStateV6 { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/BgpSession.json.cs b/src/Peering/generated/api/Models/Api20221001/BgpSession.json.cs new file mode 100644 index 000000000000..33afad58c15b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/BgpSession.json.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a BGP session. + public partial class BgpSession + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal BgpSession(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_sessionPrefixV4 = If( json?.PropertyT("sessionPrefixV4"), out var __jsonSessionPrefixV4) ? (string)__jsonSessionPrefixV4 : (string)SessionPrefixV4;} + {_sessionPrefixV6 = If( json?.PropertyT("sessionPrefixV6"), out var __jsonSessionPrefixV6) ? (string)__jsonSessionPrefixV6 : (string)SessionPrefixV6;} + {_microsoftSessionIPv4Address = If( json?.PropertyT("microsoftSessionIPv4Address"), out var __jsonMicrosoftSessionIPv4Address) ? (string)__jsonMicrosoftSessionIPv4Address : (string)MicrosoftSessionIPv4Address;} + {_microsoftSessionIPv6Address = If( json?.PropertyT("microsoftSessionIPv6Address"), out var __jsonMicrosoftSessionIPv6Address) ? (string)__jsonMicrosoftSessionIPv6Address : (string)MicrosoftSessionIPv6Address;} + {_peerSessionIPv4Address = If( json?.PropertyT("peerSessionIPv4Address"), out var __jsonPeerSessionIPv4Address) ? (string)__jsonPeerSessionIPv4Address : (string)PeerSessionIPv4Address;} + {_peerSessionIPv6Address = If( json?.PropertyT("peerSessionIPv6Address"), out var __jsonPeerSessionIPv6Address) ? (string)__jsonPeerSessionIPv6Address : (string)PeerSessionIPv6Address;} + {_sessionStateV4 = If( json?.PropertyT("sessionStateV4"), out var __jsonSessionStateV4) ? (string)__jsonSessionStateV4 : (string)SessionStateV4;} + {_sessionStateV6 = If( json?.PropertyT("sessionStateV6"), out var __jsonSessionStateV6) ? (string)__jsonSessionStateV6 : (string)SessionStateV6;} + {_maxPrefixesAdvertisedV4 = If( json?.PropertyT("maxPrefixesAdvertisedV4"), out var __jsonMaxPrefixesAdvertisedV4) ? (int?)__jsonMaxPrefixesAdvertisedV4 : MaxPrefixesAdvertisedV4;} + {_maxPrefixesAdvertisedV6 = If( json?.PropertyT("maxPrefixesAdvertisedV6"), out var __jsonMaxPrefixesAdvertisedV6) ? (int?)__jsonMaxPrefixesAdvertisedV6 : MaxPrefixesAdvertisedV6;} + {_md5AuthenticationKey = If( json?.PropertyT("md5AuthenticationKey"), out var __jsonMd5AuthenticationKey) ? (string)__jsonMd5AuthenticationKey : (string)Md5AuthenticationKey;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new BgpSession(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._sessionPrefixV4)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._sessionPrefixV4.ToString()) : null, "sessionPrefixV4" ,container.Add ); + AddIf( null != (((object)this._sessionPrefixV6)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._sessionPrefixV6.ToString()) : null, "sessionPrefixV6" ,container.Add ); + AddIf( null != (((object)this._microsoftSessionIPv4Address)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._microsoftSessionIPv4Address.ToString()) : null, "microsoftSessionIPv4Address" ,container.Add ); + AddIf( null != (((object)this._microsoftSessionIPv6Address)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._microsoftSessionIPv6Address.ToString()) : null, "microsoftSessionIPv6Address" ,container.Add ); + AddIf( null != (((object)this._peerSessionIPv4Address)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peerSessionIPv4Address.ToString()) : null, "peerSessionIPv4Address" ,container.Add ); + AddIf( null != (((object)this._peerSessionIPv6Address)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peerSessionIPv6Address.ToString()) : null, "peerSessionIPv6Address" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sessionStateV4)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._sessionStateV4.ToString()) : null, "sessionStateV4" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sessionStateV6)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._sessionStateV6.ToString()) : null, "sessionStateV6" ,container.Add ); + } + AddIf( null != this._maxPrefixesAdvertisedV4 ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._maxPrefixesAdvertisedV4) : null, "maxPrefixesAdvertisedV4" ,container.Add ); + AddIf( null != this._maxPrefixesAdvertisedV6 ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._maxPrefixesAdvertisedV6) : null, "maxPrefixesAdvertisedV6" ,container.Add ); + AddIf( null != (((object)this._md5AuthenticationKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._md5AuthenticationKey.ToString()) : null, "md5AuthenticationKey" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.PowerShell.cs new file mode 100644 index 000000000000..5e3f7d150f77 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.PowerShell.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The CDN peering prefix + [System.ComponentModel.TypeConverter(typeof(CdnPeeringPrefixTypeConverter))] + public partial class CdnPeeringPrefix + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CdnPeeringPrefix(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("AzureService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).AzureService = (string) content.GetValueForProperty("AzureService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).AzureService, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).IsPrimaryRegion = (bool?) content.GetValueForProperty("IsPrimaryRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).IsPrimaryRegion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("BgpCommunity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).BgpCommunity = (string) content.GetValueForProperty("BgpCommunity",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).BgpCommunity, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CdnPeeringPrefix(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("AzureService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).AzureService = (string) content.GetValueForProperty("AzureService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).AzureService, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).IsPrimaryRegion = (bool?) content.GetValueForProperty("IsPrimaryRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).IsPrimaryRegion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("BgpCommunity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).BgpCommunity = (string) content.GetValueForProperty("BgpCommunity",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal)this).BgpCommunity, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CdnPeeringPrefix(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CdnPeeringPrefix(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The CDN peering prefix + [System.ComponentModel.TypeConverter(typeof(CdnPeeringPrefixTypeConverter))] + public partial interface ICdnPeeringPrefix + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.TypeConverter.cs new file mode 100644 index 000000000000..10a0d7f5f97a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CdnPeeringPrefixTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CdnPeeringPrefix.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CdnPeeringPrefix.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CdnPeeringPrefix.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.cs new file mode 100644 index 000000000000..6892348b81e8 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The CDN peering prefix + public partial class CdnPeeringPrefix : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string AzureRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).AzureRegion; } + + /// The Azure service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public string AzureService { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).AzureService; } + + /// The BGP Community + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 4)] + public string BgpCommunity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).BgpCommunity; } + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// The flag that indicates whether or not this is the primary region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 3)] + public bool? IsPrimaryRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).IsPrimaryRegion; } + + /// Internal Acessors for AzureRegion + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal.AzureRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).AzureRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).AzureRegion = value; } + + /// Internal Acessors for AzureService + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal.AzureService { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).AzureService; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).AzureService = value; } + + /// Internal Acessors for BgpCommunity + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal.BgpCommunity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).BgpCommunity; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).BgpCommunity = value; } + + /// Internal Acessors for IsPrimaryRegion + bool? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal.IsPrimaryRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).IsPrimaryRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).IsPrimaryRegion = value; } + + /// Internal Acessors for Prefix + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal.Prefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).Prefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).Prefix = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Prefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)Property).Prefix; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties _property; + + /// The properties that define a cdn peering prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixProperties()); set => this._property = value; } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public CdnPeeringPrefix() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The CDN peering prefix + public partial interface ICdnPeeringPrefix : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Azure region.", + SerializedName = @"azureRegion", + PossibleTypes = new [] { typeof(string) })] + string AzureRegion { get; } + /// The Azure service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Azure service.", + SerializedName = @"azureService", + PossibleTypes = new [] { typeof(string) })] + string AzureService { get; } + /// The BGP Community + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The BGP Community", + SerializedName = @"bgpCommunity", + PossibleTypes = new [] { typeof(string) })] + string BgpCommunity { get; } + /// The flag that indicates whether or not this is the primary region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The flag that indicates whether or not this is the primary region.", + SerializedName = @"isPrimaryRegion", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPrimaryRegion { get; } + /// The prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + string Prefix { get; } + + } + /// The CDN peering prefix + internal partial interface ICdnPeeringPrefixInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The Azure region. + string AzureRegion { get; set; } + /// The Azure service. + string AzureService { get; set; } + /// The BGP Community + string BgpCommunity { get; set; } + /// The flag that indicates whether or not this is the primary region. + bool? IsPrimaryRegion { get; set; } + /// The prefix. + string Prefix { get; set; } + /// The properties that define a cdn peering prefix. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.json.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.json.cs new file mode 100644 index 000000000000..0372c93520f0 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefix.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The CDN peering prefix + public partial class CdnPeeringPrefix + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal CdnPeeringPrefix(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new CdnPeeringPrefix(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.PowerShell.cs new file mode 100644 index 000000000000..bc6d825901b7 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of CDN peering prefixes. + [System.ComponentModel.TypeConverter(typeof(CdnPeeringPrefixListResultTypeConverter))] + public partial class CdnPeeringPrefixListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CdnPeeringPrefixListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CdnPeeringPrefixListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CdnPeeringPrefixListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CdnPeeringPrefixListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of CDN peering prefixes. + [System.ComponentModel.TypeConverter(typeof(CdnPeeringPrefixListResultTypeConverter))] + public partial interface ICdnPeeringPrefixListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.TypeConverter.cs new file mode 100644 index 000000000000..c2b663f79a64 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CdnPeeringPrefixListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CdnPeeringPrefixListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CdnPeeringPrefixListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CdnPeeringPrefixListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.cs new file mode 100644 index 000000000000..69d5ca2a28fa --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of CDN peering prefixes. + public partial class CdnPeeringPrefixListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of CDN peering prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix[] _value; + + /// The list of CDN peering prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public CdnPeeringPrefixListResult() + { + + } + } + /// The paginated list of CDN peering prefixes. + public partial interface ICdnPeeringPrefixListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of CDN peering prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of CDN peering prefixes.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of CDN peering prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of CDN peering prefixes.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix[] Value { get; set; } + + } + /// The paginated list of CDN peering prefixes. + internal partial interface ICdnPeeringPrefixListResultInternal + + { + /// The link to fetch the next page of CDN peering prefixes. + string NextLink { get; set; } + /// The list of CDN peering prefixes. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.json.cs new file mode 100644 index 000000000000..70e5485f2318 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of CDN peering prefixes. + public partial class CdnPeeringPrefixListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal CdnPeeringPrefixListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefix.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new CdnPeeringPrefixListResult(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.PowerShell.cs new file mode 100644 index 000000000000..43033cdba2c2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a CDN peering prefix + [System.ComponentModel.TypeConverter(typeof(CdnPeeringPrefixPropertiesTypeConverter))] + public partial class CdnPeeringPrefixProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CdnPeeringPrefixProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("AzureService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).AzureService = (string) content.GetValueForProperty("AzureService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).AzureService, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).IsPrimaryRegion = (bool?) content.GetValueForProperty("IsPrimaryRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).IsPrimaryRegion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("BgpCommunity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).BgpCommunity = (string) content.GetValueForProperty("BgpCommunity",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).BgpCommunity, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CdnPeeringPrefixProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("AzureService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).AzureService = (string) content.GetValueForProperty("AzureService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).AzureService, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).IsPrimaryRegion = (bool?) content.GetValueForProperty("IsPrimaryRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).IsPrimaryRegion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("BgpCommunity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).BgpCommunity = (string) content.GetValueForProperty("BgpCommunity",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal)this).BgpCommunity, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CdnPeeringPrefixProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CdnPeeringPrefixProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a CDN peering prefix + [System.ComponentModel.TypeConverter(typeof(CdnPeeringPrefixPropertiesTypeConverter))] + public partial interface ICdnPeeringPrefixProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.TypeConverter.cs new file mode 100644 index 000000000000..c3a117a27c0e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CdnPeeringPrefixPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CdnPeeringPrefixProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CdnPeeringPrefixProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CdnPeeringPrefixProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.cs new file mode 100644 index 000000000000..82bc1c78a9fd --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a CDN peering prefix + public partial class CdnPeeringPrefixProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal + { + + /// Backing field for property. + private string _azureRegion; + + /// The Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string AzureRegion { get => this._azureRegion; } + + /// Backing field for property. + private string _azureService; + + /// The Azure service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string AzureService { get => this._azureService; } + + /// Backing field for property. + private string _bgpCommunity; + + /// The BGP Community + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string BgpCommunity { get => this._bgpCommunity; } + + /// Backing field for property. + private bool? _isPrimaryRegion; + + /// The flag that indicates whether or not this is the primary region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public bool? IsPrimaryRegion { get => this._isPrimaryRegion; } + + /// Internal Acessors for AzureRegion + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal.AzureRegion { get => this._azureRegion; set { {_azureRegion = value;} } } + + /// Internal Acessors for AzureService + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal.AzureService { get => this._azureService; set { {_azureService = value;} } } + + /// Internal Acessors for BgpCommunity + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal.BgpCommunity { get => this._bgpCommunity; set { {_bgpCommunity = value;} } } + + /// Internal Acessors for IsPrimaryRegion + bool? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal.IsPrimaryRegion { get => this._isPrimaryRegion; set { {_isPrimaryRegion = value;} } } + + /// Internal Acessors for Prefix + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixPropertiesInternal.Prefix { get => this._prefix; set { {_prefix = value;} } } + + /// Backing field for property. + private string _prefix; + + /// The prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Prefix { get => this._prefix; } + + /// Creates an new instance. + public CdnPeeringPrefixProperties() + { + + } + } + /// The properties that define a CDN peering prefix + public partial interface ICdnPeeringPrefixProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Azure region.", + SerializedName = @"azureRegion", + PossibleTypes = new [] { typeof(string) })] + string AzureRegion { get; } + /// The Azure service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Azure service.", + SerializedName = @"azureService", + PossibleTypes = new [] { typeof(string) })] + string AzureService { get; } + /// The BGP Community + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The BGP Community", + SerializedName = @"bgpCommunity", + PossibleTypes = new [] { typeof(string) })] + string BgpCommunity { get; } + /// The flag that indicates whether or not this is the primary region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The flag that indicates whether or not this is the primary region.", + SerializedName = @"isPrimaryRegion", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPrimaryRegion { get; } + /// The prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + string Prefix { get; } + + } + /// The properties that define a CDN peering prefix + internal partial interface ICdnPeeringPrefixPropertiesInternal + + { + /// The Azure region. + string AzureRegion { get; set; } + /// The Azure service. + string AzureService { get; set; } + /// The BGP Community + string BgpCommunity { get; set; } + /// The flag that indicates whether or not this is the primary region. + bool? IsPrimaryRegion { get; set; } + /// The prefix. + string Prefix { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.json.cs new file mode 100644 index 000000000000..d1cb74f053da --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CdnPeeringPrefixProperties.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a CDN peering prefix + public partial class CdnPeeringPrefixProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal CdnPeeringPrefixProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_prefix = If( json?.PropertyT("prefix"), out var __jsonPrefix) ? (string)__jsonPrefix : (string)Prefix;} + {_azureRegion = If( json?.PropertyT("azureRegion"), out var __jsonAzureRegion) ? (string)__jsonAzureRegion : (string)AzureRegion;} + {_azureService = If( json?.PropertyT("azureService"), out var __jsonAzureService) ? (string)__jsonAzureService : (string)AzureService;} + {_isPrimaryRegion = If( json?.PropertyT("isPrimaryRegion"), out var __jsonIsPrimaryRegion) ? (bool?)__jsonIsPrimaryRegion : IsPrimaryRegion;} + {_bgpCommunity = If( json?.PropertyT("bgpCommunity"), out var __jsonBgpCommunity) ? (string)__jsonBgpCommunity : (string)BgpCommunity;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new CdnPeeringPrefixProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._prefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._prefix.ToString()) : null, "prefix" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._azureRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._azureRegion.ToString()) : null, "azureRegion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._azureService)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._azureService.ToString()) : null, "azureService" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isPrimaryRegion ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonBoolean((bool)this._isPrimaryRegion) : null, "isPrimaryRegion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._bgpCommunity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._bgpCommunity.ToString()) : null, "bgpCommunity" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.PowerShell.cs new file mode 100644 index 000000000000..571e97ad4e94 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.PowerShell.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// Class for CheckServiceProviderAvailabilityInput + [System.ComponentModel.TypeConverter(typeof(CheckServiceProviderAvailabilityInputTypeConverter))] + public partial class CheckServiceProviderAvailabilityInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CheckServiceProviderAvailabilityInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeeringServiceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInputInternal)this).PeeringServiceLocation = (string) content.GetValueForProperty("PeeringServiceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInputInternal)this).PeeringServiceLocation, global::System.Convert.ToString); + } + if (content.Contains("PeeringServiceProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInputInternal)this).PeeringServiceProvider = (string) content.GetValueForProperty("PeeringServiceProvider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInputInternal)this).PeeringServiceProvider, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CheckServiceProviderAvailabilityInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeeringServiceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInputInternal)this).PeeringServiceLocation = (string) content.GetValueForProperty("PeeringServiceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInputInternal)this).PeeringServiceLocation, global::System.Convert.ToString); + } + if (content.Contains("PeeringServiceProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInputInternal)this).PeeringServiceProvider = (string) content.GetValueForProperty("PeeringServiceProvider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInputInternal)this).PeeringServiceProvider, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CheckServiceProviderAvailabilityInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CheckServiceProviderAvailabilityInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Class for CheckServiceProviderAvailabilityInput + [System.ComponentModel.TypeConverter(typeof(CheckServiceProviderAvailabilityInputTypeConverter))] + public partial interface ICheckServiceProviderAvailabilityInput + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.TypeConverter.cs new file mode 100644 index 000000000000..f01f8885cc31 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CheckServiceProviderAvailabilityInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CheckServiceProviderAvailabilityInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CheckServiceProviderAvailabilityInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CheckServiceProviderAvailabilityInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.cs b/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.cs new file mode 100644 index 000000000000..ad3de6f5afbb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Class for CheckServiceProviderAvailabilityInput + public partial class CheckServiceProviderAvailabilityInput : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInputInternal + { + + /// Backing field for property. + private string _peeringServiceLocation; + + /// Gets or sets the peering service location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringServiceLocation { get => this._peeringServiceLocation; set => this._peeringServiceLocation = value; } + + /// Backing field for property. + private string _peeringServiceProvider; + + /// Gets or sets the peering service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringServiceProvider { get => this._peeringServiceProvider; set => this._peeringServiceProvider = value; } + + /// Creates an new instance. + public CheckServiceProviderAvailabilityInput() + { + + } + } + /// Class for CheckServiceProviderAvailabilityInput + public partial interface ICheckServiceProviderAvailabilityInput : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// Gets or sets the peering service location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the peering service location.", + SerializedName = @"peeringServiceLocation", + PossibleTypes = new [] { typeof(string) })] + string PeeringServiceLocation { get; set; } + /// Gets or sets the peering service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the peering service provider.", + SerializedName = @"peeringServiceProvider", + PossibleTypes = new [] { typeof(string) })] + string PeeringServiceProvider { get; set; } + + } + /// Class for CheckServiceProviderAvailabilityInput + internal partial interface ICheckServiceProviderAvailabilityInputInternal + + { + /// Gets or sets the peering service location. + string PeeringServiceLocation { get; set; } + /// Gets or sets the peering service provider. + string PeeringServiceProvider { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.json.cs b/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.json.cs new file mode 100644 index 000000000000..5f6964e0bc0b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/CheckServiceProviderAvailabilityInput.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Class for CheckServiceProviderAvailabilityInput + public partial class CheckServiceProviderAvailabilityInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal CheckServiceProviderAvailabilityInput(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_peeringServiceLocation = If( json?.PropertyT("peeringServiceLocation"), out var __jsonPeeringServiceLocation) ? (string)__jsonPeeringServiceLocation : (string)PeeringServiceLocation;} + {_peeringServiceProvider = If( json?.PropertyT("peeringServiceProvider"), out var __jsonPeeringServiceProvider) ? (string)__jsonPeeringServiceProvider : (string)PeeringServiceProvider;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new CheckServiceProviderAvailabilityInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._peeringServiceLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringServiceLocation.ToString()) : null, "peeringServiceLocation" ,container.Add ); + AddIf( null != (((object)this._peeringServiceProvider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringServiceProvider.ToString()) : null, "peeringServiceProvider" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.PowerShell.cs new file mode 100644 index 000000000000..7b4aa8f88eca --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.PowerShell.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The Connection Monitor Test class. + [System.ComponentModel.TypeConverter(typeof(ConnectionMonitorTestTypeConverter))] + public partial class ConnectionMonitorTest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConnectionMonitorTest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("SourceAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).SourceAgent = (string) content.GetValueForProperty("SourceAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).SourceAgent, global::System.Convert.ToString); + } + if (content.Contains("Destination")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Destination = (string) content.GetValueForProperty("Destination",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Destination, global::System.Convert.ToString); + } + if (content.Contains("DestinationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).DestinationPort = (int?) content.GetValueForProperty("DestinationPort",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).DestinationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("TestFrequencyInSec")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).TestFrequencyInSec = (int?) content.GetValueForProperty("TestFrequencyInSec",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).TestFrequencyInSec, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("IsTestSuccessful")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).IsTestSuccessful = (bool?) content.GetValueForProperty("IsTestSuccessful",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).IsTestSuccessful, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Path = (string[]) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Path, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConnectionMonitorTest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("SourceAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).SourceAgent = (string) content.GetValueForProperty("SourceAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).SourceAgent, global::System.Convert.ToString); + } + if (content.Contains("Destination")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Destination = (string) content.GetValueForProperty("Destination",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Destination, global::System.Convert.ToString); + } + if (content.Contains("DestinationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).DestinationPort = (int?) content.GetValueForProperty("DestinationPort",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).DestinationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("TestFrequencyInSec")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).TestFrequencyInSec = (int?) content.GetValueForProperty("TestFrequencyInSec",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).TestFrequencyInSec, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("IsTestSuccessful")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).IsTestSuccessful = (bool?) content.GetValueForProperty("IsTestSuccessful",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).IsTestSuccessful, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Path = (string[]) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal)this).Path, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConnectionMonitorTest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConnectionMonitorTest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Connection Monitor Test class. + [System.ComponentModel.TypeConverter(typeof(ConnectionMonitorTestTypeConverter))] + public partial interface IConnectionMonitorTest + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.TypeConverter.cs new file mode 100644 index 000000000000..f77c2a350364 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConnectionMonitorTestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConnectionMonitorTest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConnectionMonitorTest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConnectionMonitorTest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.cs new file mode 100644 index 000000000000..916cc8a5add9 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The Connection Monitor Test class. + public partial class ConnectionMonitorTest : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The Connection Monitor test destination + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string Destination { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).Destination; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).Destination = value ?? null; } + + /// The Connection Monitor test destination port + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public int? DestinationPort { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).DestinationPort; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).DestinationPort = value ?? default(int); } + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// The flag that indicates if the Connection Monitor test is successful or not. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public bool? IsTestSuccessful { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).IsTestSuccessful; } + + /// Internal Acessors for IsTestSuccessful + bool? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal.IsTestSuccessful { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).IsTestSuccessful; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).IsTestSuccessful = value; } + + /// Internal Acessors for Path + string[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal.Path { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).Path; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).Path = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The path representing the Connection Monitor test. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string[] Path { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).Path; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties _property; + + /// The properties that define a Connection Monitor Test. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestProperties()); set => this._property = value; } + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// The Connection Monitor test source agent + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string SourceAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).SourceAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).SourceAgent = value ?? null; } + + /// The Connection Monitor test frequency in seconds + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public int? TestFrequencyInSec { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).TestFrequencyInSec; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)Property).TestFrequencyInSec = value ?? default(int); } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public ConnectionMonitorTest() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The Connection Monitor Test class. + public partial interface IConnectionMonitorTest : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The Connection Monitor test destination + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test destination", + SerializedName = @"destination", + PossibleTypes = new [] { typeof(string) })] + string Destination { get; set; } + /// The Connection Monitor test destination port + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test destination port", + SerializedName = @"destinationPort", + PossibleTypes = new [] { typeof(int) })] + int? DestinationPort { get; set; } + /// The flag that indicates if the Connection Monitor test is successful or not. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The flag that indicates if the Connection Monitor test is successful or not.", + SerializedName = @"isTestSuccessful", + PossibleTypes = new [] { typeof(bool) })] + bool? IsTestSuccessful { get; } + /// The path representing the Connection Monitor test. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The path representing the Connection Monitor test.", + SerializedName = @"path", + PossibleTypes = new [] { typeof(string) })] + string[] Path { get; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + /// The Connection Monitor test source agent + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test source agent", + SerializedName = @"sourceAgent", + PossibleTypes = new [] { typeof(string) })] + string SourceAgent { get; set; } + /// The Connection Monitor test frequency in seconds + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test frequency in seconds", + SerializedName = @"testFrequencyInSec", + PossibleTypes = new [] { typeof(int) })] + int? TestFrequencyInSec { get; set; } + + } + /// The Connection Monitor Test class. + internal partial interface IConnectionMonitorTestInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The Connection Monitor test destination + string Destination { get; set; } + /// The Connection Monitor test destination port + int? DestinationPort { get; set; } + /// The flag that indicates if the Connection Monitor test is successful or not. + bool? IsTestSuccessful { get; set; } + /// The path representing the Connection Monitor test. + string[] Path { get; set; } + /// The properties that define a Connection Monitor Test. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties Property { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + /// The Connection Monitor test source agent + string SourceAgent { get; set; } + /// The Connection Monitor test frequency in seconds + int? TestFrequencyInSec { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.json.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.json.cs new file mode 100644 index 000000000000..9d4f1c3813fc --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTest.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The Connection Monitor Test class. + public partial class ConnectionMonitorTest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ConnectionMonitorTest(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ConnectionMonitorTest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.PowerShell.cs new file mode 100644 index 000000000000..73f89a28cb87 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of Connection Monitor Tests. + [System.ComponentModel.TypeConverter(typeof(ConnectionMonitorTestListResultTypeConverter))] + public partial class ConnectionMonitorTestListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConnectionMonitorTestListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConnectionMonitorTestListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConnectionMonitorTestListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConnectionMonitorTestListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of Connection Monitor Tests. + [System.ComponentModel.TypeConverter(typeof(ConnectionMonitorTestListResultTypeConverter))] + public partial interface IConnectionMonitorTestListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.TypeConverter.cs new file mode 100644 index 000000000000..307789ef8a23 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConnectionMonitorTestListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConnectionMonitorTestListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConnectionMonitorTestListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConnectionMonitorTestListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.cs new file mode 100644 index 000000000000..96f2b8a878ba --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of Connection Monitor Tests. + public partial class ConnectionMonitorTestListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of Connection Monitor Tests. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest[] _value; + + /// The list of Connection Monitor Tests. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ConnectionMonitorTestListResult() + { + + } + } + /// The paginated list of Connection Monitor Tests. + public partial interface IConnectionMonitorTestListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of Connection Monitor Tests. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of Connection Monitor Tests.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of Connection Monitor Tests. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of Connection Monitor Tests.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest[] Value { get; set; } + + } + /// The paginated list of Connection Monitor Tests. + internal partial interface IConnectionMonitorTestListResultInternal + + { + /// The link to fetch the next page of Connection Monitor Tests. + string NextLink { get; set; } + /// The list of Connection Monitor Tests. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.json.cs new file mode 100644 index 000000000000..d6eb08a39d56 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of Connection Monitor Tests. + public partial class ConnectionMonitorTestListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ConnectionMonitorTestListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTest.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ConnectionMonitorTestListResult(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.PowerShell.cs new file mode 100644 index 000000000000..9a239b4ff5bc --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.PowerShell.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a Connection Monitor Test. + [System.ComponentModel.TypeConverter(typeof(ConnectionMonitorTestPropertiesTypeConverter))] + public partial class ConnectionMonitorTestProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConnectionMonitorTestProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).SourceAgent = (string) content.GetValueForProperty("SourceAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).SourceAgent, global::System.Convert.ToString); + } + if (content.Contains("Destination")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).Destination = (string) content.GetValueForProperty("Destination",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).Destination, global::System.Convert.ToString); + } + if (content.Contains("DestinationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).DestinationPort = (int?) content.GetValueForProperty("DestinationPort",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).DestinationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("TestFrequencyInSec")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).TestFrequencyInSec = (int?) content.GetValueForProperty("TestFrequencyInSec",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).TestFrequencyInSec, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("IsTestSuccessful")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).IsTestSuccessful = (bool?) content.GetValueForProperty("IsTestSuccessful",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).IsTestSuccessful, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).Path = (string[]) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).Path, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConnectionMonitorTestProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).SourceAgent = (string) content.GetValueForProperty("SourceAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).SourceAgent, global::System.Convert.ToString); + } + if (content.Contains("Destination")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).Destination = (string) content.GetValueForProperty("Destination",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).Destination, global::System.Convert.ToString); + } + if (content.Contains("DestinationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).DestinationPort = (int?) content.GetValueForProperty("DestinationPort",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).DestinationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("TestFrequencyInSec")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).TestFrequencyInSec = (int?) content.GetValueForProperty("TestFrequencyInSec",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).TestFrequencyInSec, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("IsTestSuccessful")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).IsTestSuccessful = (bool?) content.GetValueForProperty("IsTestSuccessful",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).IsTestSuccessful, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).Path = (string[]) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).Path, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConnectionMonitorTestProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConnectionMonitorTestProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a Connection Monitor Test. + [System.ComponentModel.TypeConverter(typeof(ConnectionMonitorTestPropertiesTypeConverter))] + public partial interface IConnectionMonitorTestProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.TypeConverter.cs new file mode 100644 index 000000000000..e687d2c9f2af --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConnectionMonitorTestPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConnectionMonitorTestProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConnectionMonitorTestProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConnectionMonitorTestProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.cs new file mode 100644 index 000000000000..65e5c6627112 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a Connection Monitor Test. + public partial class ConnectionMonitorTestProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal + { + + /// Backing field for property. + private string _destination; + + /// The Connection Monitor test destination + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Destination { get => this._destination; set => this._destination = value; } + + /// Backing field for property. + private int? _destinationPort; + + /// The Connection Monitor test destination port + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? DestinationPort { get => this._destinationPort; set => this._destinationPort = value; } + + /// Backing field for property. + private bool? _isTestSuccessful; + + /// The flag that indicates if the Connection Monitor test is successful or not. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public bool? IsTestSuccessful { get => this._isTestSuccessful; } + + /// Internal Acessors for IsTestSuccessful + bool? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal.IsTestSuccessful { get => this._isTestSuccessful; set { {_isTestSuccessful = value;} } } + + /// Internal Acessors for Path + string[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal.Path { get => this._path; set { {_path = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private string[] _path; + + /// The path representing the Connection Monitor test. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string[] Path { get => this._path; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? _provisioningState; + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _sourceAgent; + + /// The Connection Monitor test source agent + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string SourceAgent { get => this._sourceAgent; set => this._sourceAgent = value; } + + /// Backing field for property. + private int? _testFrequencyInSec; + + /// The Connection Monitor test frequency in seconds + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? TestFrequencyInSec { get => this._testFrequencyInSec; set => this._testFrequencyInSec = value; } + + /// Creates an new instance. + public ConnectionMonitorTestProperties() + { + + } + } + /// The properties that define a Connection Monitor Test. + public partial interface IConnectionMonitorTestProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The Connection Monitor test destination + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test destination", + SerializedName = @"destination", + PossibleTypes = new [] { typeof(string) })] + string Destination { get; set; } + /// The Connection Monitor test destination port + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test destination port", + SerializedName = @"destinationPort", + PossibleTypes = new [] { typeof(int) })] + int? DestinationPort { get; set; } + /// The flag that indicates if the Connection Monitor test is successful or not. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The flag that indicates if the Connection Monitor test is successful or not.", + SerializedName = @"isTestSuccessful", + PossibleTypes = new [] { typeof(bool) })] + bool? IsTestSuccessful { get; } + /// The path representing the Connection Monitor test. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The path representing the Connection Monitor test.", + SerializedName = @"path", + PossibleTypes = new [] { typeof(string) })] + string[] Path { get; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + /// The Connection Monitor test source agent + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test source agent", + SerializedName = @"sourceAgent", + PossibleTypes = new [] { typeof(string) })] + string SourceAgent { get; set; } + /// The Connection Monitor test frequency in seconds + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test frequency in seconds", + SerializedName = @"testFrequencyInSec", + PossibleTypes = new [] { typeof(int) })] + int? TestFrequencyInSec { get; set; } + + } + /// The properties that define a Connection Monitor Test. + internal partial interface IConnectionMonitorTestPropertiesInternal + + { + /// The Connection Monitor test destination + string Destination { get; set; } + /// The Connection Monitor test destination port + int? DestinationPort { get; set; } + /// The flag that indicates if the Connection Monitor test is successful or not. + bool? IsTestSuccessful { get; set; } + /// The path representing the Connection Monitor test. + string[] Path { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + /// The Connection Monitor test source agent + string SourceAgent { get; set; } + /// The Connection Monitor test frequency in seconds + int? TestFrequencyInSec { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.json.cs new file mode 100644 index 000000000000..19947fba4fa2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ConnectionMonitorTestProperties.json.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a Connection Monitor Test. + public partial class ConnectionMonitorTestProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ConnectionMonitorTestProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_sourceAgent = If( json?.PropertyT("sourceAgent"), out var __jsonSourceAgent) ? (string)__jsonSourceAgent : (string)SourceAgent;} + {_destination = If( json?.PropertyT("destination"), out var __jsonDestination) ? (string)__jsonDestination : (string)Destination;} + {_destinationPort = If( json?.PropertyT("destinationPort"), out var __jsonDestinationPort) ? (int?)__jsonDestinationPort : DestinationPort;} + {_testFrequencyInSec = If( json?.PropertyT("testFrequencyInSec"), out var __jsonTestFrequencyInSec) ? (int?)__jsonTestFrequencyInSec : TestFrequencyInSec;} + {_isTestSuccessful = If( json?.PropertyT("isTestSuccessful"), out var __jsonIsTestSuccessful) ? (bool?)__jsonIsTestSuccessful : IsTestSuccessful;} + {_path = If( json?.PropertyT("path"), out var __jsonPath) ? If( __jsonPath as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Path;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ConnectionMonitorTestProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._sourceAgent)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._sourceAgent.ToString()) : null, "sourceAgent" ,container.Add ); + AddIf( null != (((object)this._destination)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._destination.ToString()) : null, "destination" ,container.Add ); + AddIf( null != this._destinationPort ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._destinationPort) : null, "destinationPort" ,container.Add ); + AddIf( null != this._testFrequencyInSec ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._testFrequencyInSec) : null, "testFrequencyInSec" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isTestSuccessful ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonBoolean((bool)this._isTestSuccessful) : null, "isTestSuccessful" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._path) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._path ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("path",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ContactDetail.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ContactDetail.PowerShell.cs new file mode 100644 index 000000000000..f4548315d34e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ContactDetail.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The contact detail class. + [System.ComponentModel.TypeConverter(typeof(ContactDetailTypeConverter))] + public partial class ContactDetail + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ContactDetail(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Role")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Role = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role?) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Role, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role.CreateFrom); + } + if (content.Contains("Email")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Email = (string) content.GetValueForProperty("Email",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Email, global::System.Convert.ToString); + } + if (content.Contains("Phone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Phone, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ContactDetail(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Role")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Role = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role?) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Role, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role.CreateFrom); + } + if (content.Contains("Email")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Email = (string) content.GetValueForProperty("Email",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Email, global::System.Convert.ToString); + } + if (content.Contains("Phone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal)this).Phone, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ContactDetail(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ContactDetail(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The contact detail class. + [System.ComponentModel.TypeConverter(typeof(ContactDetailTypeConverter))] + public partial interface IContactDetail + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ContactDetail.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ContactDetail.TypeConverter.cs new file mode 100644 index 000000000000..c9e09ffdc421 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ContactDetail.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ContactDetailTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ContactDetail.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ContactDetail.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ContactDetail.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ContactDetail.cs b/src/Peering/generated/api/Models/Api20221001/ContactDetail.cs new file mode 100644 index 000000000000..9b5c611b8619 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ContactDetail.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The contact detail class. + public partial class ContactDetail : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetailInternal + { + + /// Backing field for property. + private string _email; + + /// The e-mail address of the contact. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Email { get => this._email; set => this._email = value; } + + /// Backing field for property. + private string _phone; + + /// The phone number of the contact. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Phone { get => this._phone; set => this._phone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role? _role; + + /// The role of the contact. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role? Role { get => this._role; set => this._role = value; } + + /// Creates an new instance. + public ContactDetail() + { + + } + } + /// The contact detail class. + public partial interface IContactDetail : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The e-mail address of the contact. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The e-mail address of the contact.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + string Email { get; set; } + /// The phone number of the contact. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The phone number of the contact.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string Phone { get; set; } + /// The role of the contact. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The role of the contact.", + SerializedName = @"role", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role? Role { get; set; } + + } + /// The contact detail class. + internal partial interface IContactDetailInternal + + { + /// The e-mail address of the contact. + string Email { get; set; } + /// The phone number of the contact. + string Phone { get; set; } + /// The role of the contact. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role? Role { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ContactDetail.json.cs b/src/Peering/generated/api/Models/Api20221001/ContactDetail.json.cs new file mode 100644 index 000000000000..cbd09b671746 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ContactDetail.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The contact detail class. + public partial class ContactDetail + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ContactDetail(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_role = If( json?.PropertyT("role"), out var __jsonRole) ? (string)__jsonRole : (string)Role;} + {_email = If( json?.PropertyT("email"), out var __jsonEmail) ? (string)__jsonEmail : (string)Email;} + {_phone = If( json?.PropertyT("phone"), out var __jsonPhone) ? (string)__jsonPhone : (string)Phone;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ContactDetail(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._role)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._role.ToString()) : null, "role" ,container.Add ); + AddIf( null != (((object)this._email)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._email.ToString()) : null, "email" ,container.Add ); + AddIf( null != (((object)this._phone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._phone.ToString()) : null, "phone" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/DirectConnection.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/DirectConnection.PowerShell.cs new file mode 100644 index 000000000000..3f8edd10eb37 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/DirectConnection.PowerShell.cs @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a direct connection. + [System.ComponentModel.TypeConverter(typeof(DirectConnectionTypeConverter))] + public partial class DirectConnection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DirectConnection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DirectConnection(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DirectConnection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BgpSession")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSession = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession) content.GetValueForProperty("BgpSession",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSession, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSessionTypeConverter.ConvertFrom); + } + if (content.Contains("BandwidthInMbps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BandwidthInMbps = (int?) content.GetValueForProperty("BandwidthInMbps",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BandwidthInMbps, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProvisionedBandwidthInMbps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ProvisionedBandwidthInMbps = (int?) content.GetValueForProperty("ProvisionedBandwidthInMbps",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ProvisionedBandwidthInMbps, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SessionAddressProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).SessionAddressProvider = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider?) content.GetValueForProperty("SessionAddressProvider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).SessionAddressProvider, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider.CreateFrom); + } + if (content.Contains("UseForPeeringService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).UseForPeeringService = (bool?) content.GetValueForProperty("UseForPeeringService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).UseForPeeringService, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MicrosoftTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).MicrosoftTrackingId = (string) content.GetValueForProperty("MicrosoftTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).MicrosoftTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PeeringDbFacilityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).PeeringDbFacilityId = (int?) content.GetValueForProperty("PeeringDbFacilityId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).PeeringDbFacilityId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ConnectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ConnectionState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState?) content.GetValueForProperty("ConnectionState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ConnectionState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState.CreateFrom); + } + if (content.Contains("ConnectionIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ConnectionIdentifier = (string) content.GetValueForProperty("ConnectionIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ConnectionIdentifier, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPrefixV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPrefixV4 = (string) content.GetValueForProperty("BgpSessionPrefixV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPrefixV4, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPrefixV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPrefixV6 = (string) content.GetValueForProperty("BgpSessionPrefixV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPrefixV6, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionMicrosoftSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMicrosoftSessionIPv4Address = (string) content.GetValueForProperty("BgpSessionMicrosoftSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMicrosoftSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionMicrosoftSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMicrosoftSessionIPv6Address = (string) content.GetValueForProperty("BgpSessionMicrosoftSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMicrosoftSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPeerSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPeerSessionIPv4Address = (string) content.GetValueForProperty("BgpSessionPeerSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPeerSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPeerSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPeerSessionIPv6Address = (string) content.GetValueForProperty("BgpSessionPeerSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPeerSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionStateV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionStateV4 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4?) content.GetValueForProperty("BgpSessionStateV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionStateV4, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4.CreateFrom); + } + if (content.Contains("BgpSessionStateV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionStateV6 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6?) content.GetValueForProperty("BgpSessionStateV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionStateV6, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6.CreateFrom); + } + if (content.Contains("BgpSessionMaxPrefixesAdvertisedV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV4 = (int?) content.GetValueForProperty("BgpSessionMaxPrefixesAdvertisedV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV4, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("BgpSessionMaxPrefixesAdvertisedV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV6 = (int?) content.GetValueForProperty("BgpSessionMaxPrefixesAdvertisedV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV6, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("BgpSessionMd5AuthenticationKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMd5AuthenticationKey = (string) content.GetValueForProperty("BgpSessionMd5AuthenticationKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMd5AuthenticationKey, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DirectConnection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BgpSession")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSession = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession) content.GetValueForProperty("BgpSession",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSession, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSessionTypeConverter.ConvertFrom); + } + if (content.Contains("BandwidthInMbps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BandwidthInMbps = (int?) content.GetValueForProperty("BandwidthInMbps",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BandwidthInMbps, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProvisionedBandwidthInMbps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ProvisionedBandwidthInMbps = (int?) content.GetValueForProperty("ProvisionedBandwidthInMbps",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ProvisionedBandwidthInMbps, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SessionAddressProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).SessionAddressProvider = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider?) content.GetValueForProperty("SessionAddressProvider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).SessionAddressProvider, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider.CreateFrom); + } + if (content.Contains("UseForPeeringService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).UseForPeeringService = (bool?) content.GetValueForProperty("UseForPeeringService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).UseForPeeringService, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MicrosoftTrackingId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).MicrosoftTrackingId = (string) content.GetValueForProperty("MicrosoftTrackingId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).MicrosoftTrackingId, global::System.Convert.ToString); + } + if (content.Contains("PeeringDbFacilityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).PeeringDbFacilityId = (int?) content.GetValueForProperty("PeeringDbFacilityId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).PeeringDbFacilityId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ConnectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ConnectionState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState?) content.GetValueForProperty("ConnectionState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ConnectionState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState.CreateFrom); + } + if (content.Contains("ConnectionIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ConnectionIdentifier = (string) content.GetValueForProperty("ConnectionIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ConnectionIdentifier, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPrefixV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPrefixV4 = (string) content.GetValueForProperty("BgpSessionPrefixV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPrefixV4, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPrefixV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPrefixV6 = (string) content.GetValueForProperty("BgpSessionPrefixV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPrefixV6, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionMicrosoftSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMicrosoftSessionIPv4Address = (string) content.GetValueForProperty("BgpSessionMicrosoftSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMicrosoftSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionMicrosoftSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMicrosoftSessionIPv6Address = (string) content.GetValueForProperty("BgpSessionMicrosoftSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMicrosoftSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPeerSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPeerSessionIPv4Address = (string) content.GetValueForProperty("BgpSessionPeerSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPeerSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPeerSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPeerSessionIPv6Address = (string) content.GetValueForProperty("BgpSessionPeerSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionPeerSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionStateV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionStateV4 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4?) content.GetValueForProperty("BgpSessionStateV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionStateV4, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4.CreateFrom); + } + if (content.Contains("BgpSessionStateV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionStateV6 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6?) content.GetValueForProperty("BgpSessionStateV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionStateV6, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6.CreateFrom); + } + if (content.Contains("BgpSessionMaxPrefixesAdvertisedV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV4 = (int?) content.GetValueForProperty("BgpSessionMaxPrefixesAdvertisedV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV4, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("BgpSessionMaxPrefixesAdvertisedV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV6 = (int?) content.GetValueForProperty("BgpSessionMaxPrefixesAdvertisedV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV6, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("BgpSessionMd5AuthenticationKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMd5AuthenticationKey = (string) content.GetValueForProperty("BgpSessionMd5AuthenticationKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal)this).BgpSessionMd5AuthenticationKey, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a direct connection. + [System.ComponentModel.TypeConverter(typeof(DirectConnectionTypeConverter))] + public partial interface IDirectConnection + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/DirectConnection.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/DirectConnection.TypeConverter.cs new file mode 100644 index 000000000000..0535f6be0fc9 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/DirectConnection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DirectConnectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DirectConnection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DirectConnection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DirectConnection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/DirectConnection.cs b/src/Peering/generated/api/Models/Api20221001/DirectConnection.cs new file mode 100644 index 000000000000..d56023883421 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/DirectConnection.cs @@ -0,0 +1,383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a direct connection. + public partial class DirectConnection : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal + { + + /// Backing field for property. + private int? _bandwidthInMbps; + + /// The bandwidth of the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? BandwidthInMbps { get => this._bandwidthInMbps; set => this._bandwidthInMbps = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession _bgpSession; + + /// The BGP session associated with the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession BgpSession { get => (this._bgpSession = this._bgpSession ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSession()); set => this._bgpSession = value; } + + /// The maximum number of prefixes advertised over the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public int? BgpSessionMaxPrefixesAdvertisedV4 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MaxPrefixesAdvertisedV4; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MaxPrefixesAdvertisedV4 = value ?? default(int); } + + /// The maximum number of prefixes advertised over the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public int? BgpSessionMaxPrefixesAdvertisedV6 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MaxPrefixesAdvertisedV6; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MaxPrefixesAdvertisedV6 = value ?? default(int); } + + /// The MD5 authentication key of the session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionMd5AuthenticationKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).Md5AuthenticationKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).Md5AuthenticationKey = value ?? null; } + + /// The IPv4 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionMicrosoftSessionIPv4Address { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MicrosoftSessionIPv4Address; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MicrosoftSessionIPv4Address = value ?? null; } + + /// The IPv6 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionMicrosoftSessionIPv6Address { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MicrosoftSessionIPv6Address; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MicrosoftSessionIPv6Address = value ?? null; } + + /// The IPv4 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionPeerSessionIPv4Address { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).PeerSessionIPv4Address; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).PeerSessionIPv4Address = value ?? null; } + + /// The IPv6 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionPeerSessionIPv6Address { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).PeerSessionIPv6Address; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).PeerSessionIPv6Address = value ?? null; } + + /// The IPv4 prefix that contains both ends' IPv4 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionPrefixV4 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionPrefixV4; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionPrefixV4 = value ?? null; } + + /// The IPv6 prefix that contains both ends' IPv6 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionPrefixV6 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionPrefixV6; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionPrefixV6 = value ?? null; } + + /// The state of the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? BgpSessionStateV4 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV4; } + + /// The state of the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? BgpSessionStateV6 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV6; } + + /// Backing field for property. + private string _connectionIdentifier; + + /// The unique identifier (GUID) for the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ConnectionIdentifier { get => this._connectionIdentifier; set => this._connectionIdentifier = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? _connectionState; + + /// The state of the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? ConnectionState { get => this._connectionState; } + + /// Backing field for property. + private string _errorMessage; + + /// The error message related to the connection state, if any. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Internal Acessors for BgpSession + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal.BgpSession { get => (this._bgpSession = this._bgpSession ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSession()); set { {_bgpSession = value;} } } + + /// Internal Acessors for BgpSessionStateV4 + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal.BgpSessionStateV4 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV4; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV4 = value; } + + /// Internal Acessors for BgpSessionStateV6 + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal.BgpSessionStateV6 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV6; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV6 = value; } + + /// Internal Acessors for ConnectionState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal.ConnectionState { get => this._connectionState; set { {_connectionState = value;} } } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Internal Acessors for MicrosoftTrackingId + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal.MicrosoftTrackingId { get => this._microsoftTrackingId; set { {_microsoftTrackingId = value;} } } + + /// Internal Acessors for ProvisionedBandwidthInMbps + int? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnectionInternal.ProvisionedBandwidthInMbps { get => this._provisionedBandwidthInMbps; set { {_provisionedBandwidthInMbps = value;} } } + + /// Backing field for property. + private string _microsoftTrackingId; + + /// + /// The ID used within Microsoft's peering provisioning system to track the connection + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string MicrosoftTrackingId { get => this._microsoftTrackingId; } + + /// Backing field for property. + private int? _peeringDbFacilityId; + + /// The PeeringDB.com ID of the facility at which the connection has to be set up. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? PeeringDbFacilityId { get => this._peeringDbFacilityId; set => this._peeringDbFacilityId = value; } + + /// Backing field for property. + private int? _provisionedBandwidthInMbps; + + /// The bandwidth that is actually provisioned. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? ProvisionedBandwidthInMbps { get => this._provisionedBandwidthInMbps; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider? _sessionAddressProvider; + + /// The field indicating if Microsoft provides session ip addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider? SessionAddressProvider { get => this._sessionAddressProvider; set => this._sessionAddressProvider = value; } + + /// Backing field for property. + private bool? _useForPeeringService; + + /// + /// The flag that indicates whether or not the connection is used for peering service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public bool? UseForPeeringService { get => this._useForPeeringService; set => this._useForPeeringService = value; } + + /// Creates an new instance. + public DirectConnection() + { + + } + } + /// The properties that define a direct connection. + public partial interface IDirectConnection : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The bandwidth of the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The bandwidth of the connection.", + SerializedName = @"bandwidthInMbps", + PossibleTypes = new [] { typeof(int) })] + int? BandwidthInMbps { get; set; } + /// The maximum number of prefixes advertised over the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum number of prefixes advertised over the IPv4 session.", + SerializedName = @"maxPrefixesAdvertisedV4", + PossibleTypes = new [] { typeof(int) })] + int? BgpSessionMaxPrefixesAdvertisedV4 { get; set; } + /// The maximum number of prefixes advertised over the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum number of prefixes advertised over the IPv6 session.", + SerializedName = @"maxPrefixesAdvertisedV6", + PossibleTypes = new [] { typeof(int) })] + int? BgpSessionMaxPrefixesAdvertisedV6 { get; set; } + /// The MD5 authentication key of the session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The MD5 authentication key of the session.", + SerializedName = @"md5AuthenticationKey", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionMd5AuthenticationKey { get; set; } + /// The IPv4 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 session address on Microsoft's end.", + SerializedName = @"microsoftSessionIPv4Address", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionMicrosoftSessionIPv4Address { get; set; } + /// The IPv6 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 session address on Microsoft's end.", + SerializedName = @"microsoftSessionIPv6Address", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionMicrosoftSessionIPv6Address { get; set; } + /// The IPv4 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 session address on peer's end.", + SerializedName = @"peerSessionIPv4Address", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionPeerSessionIPv4Address { get; set; } + /// The IPv6 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 session address on peer's end.", + SerializedName = @"peerSessionIPv6Address", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionPeerSessionIPv6Address { get; set; } + /// The IPv4 prefix that contains both ends' IPv4 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 prefix that contains both ends' IPv4 addresses.", + SerializedName = @"sessionPrefixV4", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionPrefixV4 { get; set; } + /// The IPv6 prefix that contains both ends' IPv6 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 prefix that contains both ends' IPv6 addresses.", + SerializedName = @"sessionPrefixV6", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionPrefixV6 { get; set; } + /// The state of the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The state of the IPv4 session.", + SerializedName = @"sessionStateV4", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? BgpSessionStateV4 { get; } + /// The state of the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The state of the IPv6 session.", + SerializedName = @"sessionStateV6", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? BgpSessionStateV6 { get; } + /// The unique identifier (GUID) for the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique identifier (GUID) for the connection.", + SerializedName = @"connectionIdentifier", + PossibleTypes = new [] { typeof(string) })] + string ConnectionIdentifier { get; set; } + /// The state of the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The state of the connection.", + SerializedName = @"connectionState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? ConnectionState { get; } + /// The error message related to the connection state, if any. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message related to the connection state, if any.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// + /// The ID used within Microsoft's peering provisioning system to track the connection + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ID used within Microsoft's peering provisioning system to track the connection", + SerializedName = @"microsoftTrackingId", + PossibleTypes = new [] { typeof(string) })] + string MicrosoftTrackingId { get; } + /// The PeeringDB.com ID of the facility at which the connection has to be set up. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PeeringDB.com ID of the facility at which the connection has to be set up.", + SerializedName = @"peeringDBFacilityId", + PossibleTypes = new [] { typeof(int) })] + int? PeeringDbFacilityId { get; set; } + /// The bandwidth that is actually provisioned. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The bandwidth that is actually provisioned.", + SerializedName = @"provisionedBandwidthInMbps", + PossibleTypes = new [] { typeof(int) })] + int? ProvisionedBandwidthInMbps { get; } + /// The field indicating if Microsoft provides session ip addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The field indicating if Microsoft provides session ip addresses.", + SerializedName = @"sessionAddressProvider", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider? SessionAddressProvider { get; set; } + /// + /// The flag that indicates whether or not the connection is used for peering service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The flag that indicates whether or not the connection is used for peering service.", + SerializedName = @"useForPeeringService", + PossibleTypes = new [] { typeof(bool) })] + bool? UseForPeeringService { get; set; } + + } + /// The properties that define a direct connection. + internal partial interface IDirectConnectionInternal + + { + /// The bandwidth of the connection. + int? BandwidthInMbps { get; set; } + /// The BGP session associated with the connection. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession BgpSession { get; set; } + /// The maximum number of prefixes advertised over the IPv4 session. + int? BgpSessionMaxPrefixesAdvertisedV4 { get; set; } + /// The maximum number of prefixes advertised over the IPv6 session. + int? BgpSessionMaxPrefixesAdvertisedV6 { get; set; } + /// The MD5 authentication key of the session. + string BgpSessionMd5AuthenticationKey { get; set; } + /// The IPv4 session address on Microsoft's end. + string BgpSessionMicrosoftSessionIPv4Address { get; set; } + /// The IPv6 session address on Microsoft's end. + string BgpSessionMicrosoftSessionIPv6Address { get; set; } + /// The IPv4 session address on peer's end. + string BgpSessionPeerSessionIPv4Address { get; set; } + /// The IPv6 session address on peer's end. + string BgpSessionPeerSessionIPv6Address { get; set; } + /// The IPv4 prefix that contains both ends' IPv4 addresses. + string BgpSessionPrefixV4 { get; set; } + /// The IPv6 prefix that contains both ends' IPv6 addresses. + string BgpSessionPrefixV6 { get; set; } + /// The state of the IPv4 session. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? BgpSessionStateV4 { get; set; } + /// The state of the IPv6 session. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? BgpSessionStateV6 { get; set; } + /// The unique identifier (GUID) for the connection. + string ConnectionIdentifier { get; set; } + /// The state of the connection. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? ConnectionState { get; set; } + /// The error message related to the connection state, if any. + string ErrorMessage { get; set; } + /// + /// The ID used within Microsoft's peering provisioning system to track the connection + /// + string MicrosoftTrackingId { get; set; } + /// The PeeringDB.com ID of the facility at which the connection has to be set up. + int? PeeringDbFacilityId { get; set; } + /// The bandwidth that is actually provisioned. + int? ProvisionedBandwidthInMbps { get; set; } + /// The field indicating if Microsoft provides session ip addresses. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider? SessionAddressProvider { get; set; } + /// + /// The flag that indicates whether or not the connection is used for peering service. + /// + bool? UseForPeeringService { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/DirectConnection.json.cs b/src/Peering/generated/api/Models/Api20221001/DirectConnection.json.cs new file mode 100644 index 000000000000..21baafcc3377 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/DirectConnection.json.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a direct connection. + public partial class DirectConnection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal DirectConnection(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_bgpSession = If( json?.PropertyT("bgpSession"), out var __jsonBgpSession) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSession.FromJson(__jsonBgpSession) : BgpSession;} + {_bandwidthInMbps = If( json?.PropertyT("bandwidthInMbps"), out var __jsonBandwidthInMbps) ? (int?)__jsonBandwidthInMbps : BandwidthInMbps;} + {_provisionedBandwidthInMbps = If( json?.PropertyT("provisionedBandwidthInMbps"), out var __jsonProvisionedBandwidthInMbps) ? (int?)__jsonProvisionedBandwidthInMbps : ProvisionedBandwidthInMbps;} + {_sessionAddressProvider = If( json?.PropertyT("sessionAddressProvider"), out var __jsonSessionAddressProvider) ? (string)__jsonSessionAddressProvider : (string)SessionAddressProvider;} + {_useForPeeringService = If( json?.PropertyT("useForPeeringService"), out var __jsonUseForPeeringService) ? (bool?)__jsonUseForPeeringService : UseForPeeringService;} + {_microsoftTrackingId = If( json?.PropertyT("microsoftTrackingId"), out var __jsonMicrosoftTrackingId) ? (string)__jsonMicrosoftTrackingId : (string)MicrosoftTrackingId;} + {_peeringDbFacilityId = If( json?.PropertyT("peeringDBFacilityId"), out var __jsonPeeringDbFacilityId) ? (int?)__jsonPeeringDbFacilityId : PeeringDbFacilityId;} + {_connectionState = If( json?.PropertyT("connectionState"), out var __jsonConnectionState) ? (string)__jsonConnectionState : (string)ConnectionState;} + {_connectionIdentifier = If( json?.PropertyT("connectionIdentifier"), out var __jsonConnectionIdentifier) ? (string)__jsonConnectionIdentifier : (string)ConnectionIdentifier;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new DirectConnection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._bgpSession ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._bgpSession.ToJson(null,serializationMode) : null, "bgpSession" ,container.Add ); + AddIf( null != this._bandwidthInMbps ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._bandwidthInMbps) : null, "bandwidthInMbps" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._provisionedBandwidthInMbps ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._provisionedBandwidthInMbps) : null, "provisionedBandwidthInMbps" ,container.Add ); + } + AddIf( null != (((object)this._sessionAddressProvider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._sessionAddressProvider.ToString()) : null, "sessionAddressProvider" ,container.Add ); + AddIf( null != this._useForPeeringService ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonBoolean((bool)this._useForPeeringService) : null, "useForPeeringService" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._microsoftTrackingId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._microsoftTrackingId.ToString()) : null, "microsoftTrackingId" ,container.Add ); + } + AddIf( null != this._peeringDbFacilityId ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._peeringDbFacilityId) : null, "peeringDBFacilityId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._connectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._connectionState.ToString()) : null, "connectionState" ,container.Add ); + } + AddIf( null != (((object)this._connectionIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._connectionIdentifier.ToString()) : null, "connectionIdentifier" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.PowerShell.cs new file mode 100644 index 000000000000..de2e459d96cb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a direct peering facility. + [System.ComponentModel.TypeConverter(typeof(DirectPeeringFacilityTypeConverter))] + public partial class DirectPeeringFacility + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DirectPeeringFacility(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DirectPeeringFacility(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DirectPeeringFacility(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).Address = (string) content.GetValueForProperty("Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).Address, global::System.Convert.ToString); + } + if (content.Contains("DirectPeeringType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).DirectPeeringType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType?) content.GetValueForProperty("DirectPeeringType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).DirectPeeringType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType.CreateFrom); + } + if (content.Contains("PeeringDbFacilityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).PeeringDbFacilityId = (int?) content.GetValueForProperty("PeeringDbFacilityId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).PeeringDbFacilityId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeeringDbFacilityLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).PeeringDbFacilityLink = (string) content.GetValueForProperty("PeeringDbFacilityLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).PeeringDbFacilityLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DirectPeeringFacility(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).Address = (string) content.GetValueForProperty("Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).Address, global::System.Convert.ToString); + } + if (content.Contains("DirectPeeringType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).DirectPeeringType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType?) content.GetValueForProperty("DirectPeeringType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).DirectPeeringType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType.CreateFrom); + } + if (content.Contains("PeeringDbFacilityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).PeeringDbFacilityId = (int?) content.GetValueForProperty("PeeringDbFacilityId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).PeeringDbFacilityId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeeringDbFacilityLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).PeeringDbFacilityLink = (string) content.GetValueForProperty("PeeringDbFacilityLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal)this).PeeringDbFacilityLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a direct peering facility. + [System.ComponentModel.TypeConverter(typeof(DirectPeeringFacilityTypeConverter))] + public partial interface IDirectPeeringFacility + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.TypeConverter.cs new file mode 100644 index 000000000000..9b18b6f76306 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DirectPeeringFacilityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DirectPeeringFacility.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DirectPeeringFacility.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DirectPeeringFacility.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.cs b/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.cs new file mode 100644 index 000000000000..8ebff0ab0bbf --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a direct peering facility. + public partial class DirectPeeringFacility : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacilityInternal + { + + /// Backing field for property. + private string _address; + + /// The address of the direct peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Address { get => this._address; set => this._address = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? _directPeeringType; + + /// The type of the direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get => this._directPeeringType; set => this._directPeeringType = value; } + + /// Backing field for property. + private int? _peeringDbFacilityId; + + /// The PeeringDB.com ID of the facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? PeeringDbFacilityId { get => this._peeringDbFacilityId; set => this._peeringDbFacilityId = value; } + + /// Backing field for property. + private string _peeringDbFacilityLink; + + /// The PeeringDB.com URL of the facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringDbFacilityLink { get => this._peeringDbFacilityLink; set => this._peeringDbFacilityLink = value; } + + /// Creates an new instance. + public DirectPeeringFacility() + { + + } + } + /// The properties that define a direct peering facility. + public partial interface IDirectPeeringFacility : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The address of the direct peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The address of the direct peering facility.", + SerializedName = @"address", + PossibleTypes = new [] { typeof(string) })] + string Address { get; set; } + /// The type of the direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the direct peering.", + SerializedName = @"directPeeringType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get; set; } + /// The PeeringDB.com ID of the facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PeeringDB.com ID of the facility.", + SerializedName = @"peeringDBFacilityId", + PossibleTypes = new [] { typeof(int) })] + int? PeeringDbFacilityId { get; set; } + /// The PeeringDB.com URL of the facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PeeringDB.com URL of the facility.", + SerializedName = @"peeringDBFacilityLink", + PossibleTypes = new [] { typeof(string) })] + string PeeringDbFacilityLink { get; set; } + + } + /// The properties that define a direct peering facility. + internal partial interface IDirectPeeringFacilityInternal + + { + /// The address of the direct peering facility. + string Address { get; set; } + /// The type of the direct peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get; set; } + /// The PeeringDB.com ID of the facility. + int? PeeringDbFacilityId { get; set; } + /// The PeeringDB.com URL of the facility. + string PeeringDbFacilityLink { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.json.cs b/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.json.cs new file mode 100644 index 000000000000..1c4ce86ded58 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/DirectPeeringFacility.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a direct peering facility. + public partial class DirectPeeringFacility + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal DirectPeeringFacility(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_address = If( json?.PropertyT("address"), out var __jsonAddress) ? (string)__jsonAddress : (string)Address;} + {_directPeeringType = If( json?.PropertyT("directPeeringType"), out var __jsonDirectPeeringType) ? (string)__jsonDirectPeeringType : (string)DirectPeeringType;} + {_peeringDbFacilityId = If( json?.PropertyT("peeringDBFacilityId"), out var __jsonPeeringDbFacilityId) ? (int?)__jsonPeeringDbFacilityId : PeeringDbFacilityId;} + {_peeringDbFacilityLink = If( json?.PropertyT("peeringDBFacilityLink"), out var __jsonPeeringDbFacilityLink) ? (string)__jsonPeeringDbFacilityLink : (string)PeeringDbFacilityLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new DirectPeeringFacility(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._address)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._address.ToString()) : null, "address" ,container.Add ); + AddIf( null != (((object)this._directPeeringType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._directPeeringType.ToString()) : null, "directPeeringType" ,container.Add ); + AddIf( null != this._peeringDbFacilityId ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._peeringDbFacilityId) : null, "peeringDBFacilityId" ,container.Add ); + AddIf( null != (((object)this._peeringDbFacilityLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringDbFacilityLink.ToString()) : null, "peeringDBFacilityLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ErrorDetail.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ErrorDetail.PowerShell.cs new file mode 100644 index 000000000000..7dd8a57ebb2b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ErrorDetail.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The error detail that describes why an operation has failed. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial class ErrorDetail + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorDetail(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorDetail(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The error detail that describes why an operation has failed. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial interface IErrorDetail + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ErrorDetail.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ErrorDetail.TypeConverter.cs new file mode 100644 index 000000000000..4565c6acd95a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ErrorDetail.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorDetailTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorDetail.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ErrorDetail.cs b/src/Peering/generated/api/Models/Api20221001/ErrorDetail.cs new file mode 100644 index 000000000000..c57db50e5ce6 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ErrorDetail.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The error detail that describes why an operation has failed. + public partial class ErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal + { + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal.Message { get => this._message; set { {_message = value;} } } + + /// Creates an new instance. + public ErrorDetail() + { + + } + } + /// The error detail that describes why an operation has failed. + public partial interface IErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + + } + /// The error detail that describes why an operation has failed. + internal partial interface IErrorDetailInternal + + { + /// The error code. + string Code { get; set; } + /// The error message. + string Message { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ErrorDetail.json.cs b/src/Peering/generated/api/Models/Api20221001/ErrorDetail.json.cs new file mode 100644 index 000000000000..776fccc2ac37 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ErrorDetail.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The error detail that describes why an operation has failed. + public partial class ErrorDetail + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorDetail(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ErrorDetail(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ErrorResponse.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ErrorResponse.PowerShell.cs new file mode 100644 index 000000000000..e99c83c4c9e0 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ErrorResponse.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The error response that indicates why an operation has failed. + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial class ErrorResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The error response that indicates why an operation has failed. + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial interface IErrorResponse + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ErrorResponse.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ErrorResponse.TypeConverter.cs new file mode 100644 index 000000000000..7588db66569b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ErrorResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ErrorResponse.cs b/src/Peering/generated/api/Models/Api20221001/ErrorResponse.cs new file mode 100644 index 000000000000..c4476df0b3e4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ErrorResponse.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The error response that indicates why an operation has failed. + public partial class ErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal + { + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)Error).Code; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail _error; + + /// The error detail that describes why an operation has failed. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorDetail()); set => this._error = value; } + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)Error).Message; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)Error).Code = value; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorDetail()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetailInternal)Error).Message = value; } + + /// Creates an new instance. + public ErrorResponse() + { + + } + } + /// The error response that indicates why an operation has failed. + public partial interface IErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + + } + /// The error response that indicates why an operation has failed. + internal partial interface IErrorResponseInternal + + { + /// The error code. + string Code { get; set; } + /// The error detail that describes why an operation has failed. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorDetail Error { get; set; } + /// The error message. + string Message { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ErrorResponse.json.cs b/src/Peering/generated/api/Models/Api20221001/ErrorResponse.json.cs new file mode 100644 index 000000000000..3984c2545431 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ErrorResponse.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The error response that indicates why an operation has failed. + public partial class ErrorResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorDetail.FromJson(__jsonError) : Error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ErrorResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.PowerShell.cs new file mode 100644 index 000000000000..d546aab21568 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.PowerShell.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define an exchange connection. + [System.ComponentModel.TypeConverter(typeof(ExchangeConnectionTypeConverter))] + public partial class ExchangeConnection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExchangeConnection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExchangeConnection(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExchangeConnection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BgpSession")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSession = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession) content.GetValueForProperty("BgpSession",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSession, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSessionTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringDbFacilityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).PeeringDbFacilityId = (int?) content.GetValueForProperty("PeeringDbFacilityId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).PeeringDbFacilityId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ConnectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ConnectionState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState?) content.GetValueForProperty("ConnectionState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ConnectionState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState.CreateFrom); + } + if (content.Contains("ConnectionIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ConnectionIdentifier = (string) content.GetValueForProperty("ConnectionIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ConnectionIdentifier, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPrefixV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPrefixV4 = (string) content.GetValueForProperty("BgpSessionPrefixV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPrefixV4, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPrefixV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPrefixV6 = (string) content.GetValueForProperty("BgpSessionPrefixV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPrefixV6, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionMicrosoftSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMicrosoftSessionIPv4Address = (string) content.GetValueForProperty("BgpSessionMicrosoftSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMicrosoftSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionMicrosoftSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMicrosoftSessionIPv6Address = (string) content.GetValueForProperty("BgpSessionMicrosoftSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMicrosoftSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPeerSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPeerSessionIPv4Address = (string) content.GetValueForProperty("BgpSessionPeerSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPeerSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPeerSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPeerSessionIPv6Address = (string) content.GetValueForProperty("BgpSessionPeerSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPeerSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionStateV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionStateV4 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4?) content.GetValueForProperty("BgpSessionStateV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionStateV4, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4.CreateFrom); + } + if (content.Contains("BgpSessionStateV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionStateV6 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6?) content.GetValueForProperty("BgpSessionStateV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionStateV6, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6.CreateFrom); + } + if (content.Contains("BgpSessionMaxPrefixesAdvertisedV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV4 = (int?) content.GetValueForProperty("BgpSessionMaxPrefixesAdvertisedV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV4, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("BgpSessionMaxPrefixesAdvertisedV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV6 = (int?) content.GetValueForProperty("BgpSessionMaxPrefixesAdvertisedV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV6, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("BgpSessionMd5AuthenticationKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMd5AuthenticationKey = (string) content.GetValueForProperty("BgpSessionMd5AuthenticationKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMd5AuthenticationKey, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExchangeConnection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BgpSession")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSession = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession) content.GetValueForProperty("BgpSession",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSession, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSessionTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringDbFacilityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).PeeringDbFacilityId = (int?) content.GetValueForProperty("PeeringDbFacilityId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).PeeringDbFacilityId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ConnectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ConnectionState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState?) content.GetValueForProperty("ConnectionState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ConnectionState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState.CreateFrom); + } + if (content.Contains("ConnectionIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ConnectionIdentifier = (string) content.GetValueForProperty("ConnectionIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ConnectionIdentifier, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPrefixV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPrefixV4 = (string) content.GetValueForProperty("BgpSessionPrefixV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPrefixV4, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPrefixV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPrefixV6 = (string) content.GetValueForProperty("BgpSessionPrefixV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPrefixV6, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionMicrosoftSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMicrosoftSessionIPv4Address = (string) content.GetValueForProperty("BgpSessionMicrosoftSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMicrosoftSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionMicrosoftSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMicrosoftSessionIPv6Address = (string) content.GetValueForProperty("BgpSessionMicrosoftSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMicrosoftSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPeerSessionIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPeerSessionIPv4Address = (string) content.GetValueForProperty("BgpSessionPeerSessionIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPeerSessionIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionPeerSessionIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPeerSessionIPv6Address = (string) content.GetValueForProperty("BgpSessionPeerSessionIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionPeerSessionIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("BgpSessionStateV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionStateV4 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4?) content.GetValueForProperty("BgpSessionStateV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionStateV4, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4.CreateFrom); + } + if (content.Contains("BgpSessionStateV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionStateV6 = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6?) content.GetValueForProperty("BgpSessionStateV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionStateV6, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6.CreateFrom); + } + if (content.Contains("BgpSessionMaxPrefixesAdvertisedV4")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV4 = (int?) content.GetValueForProperty("BgpSessionMaxPrefixesAdvertisedV4",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV4, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("BgpSessionMaxPrefixesAdvertisedV6")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV6 = (int?) content.GetValueForProperty("BgpSessionMaxPrefixesAdvertisedV6",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMaxPrefixesAdvertisedV6, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("BgpSessionMd5AuthenticationKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMd5AuthenticationKey = (string) content.GetValueForProperty("BgpSessionMd5AuthenticationKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal)this).BgpSessionMd5AuthenticationKey, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define an exchange connection. + [System.ComponentModel.TypeConverter(typeof(ExchangeConnectionTypeConverter))] + public partial interface IExchangeConnection + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.TypeConverter.cs new file mode 100644 index 000000000000..a42594aad01c --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExchangeConnectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExchangeConnection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExchangeConnection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExchangeConnection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.cs b/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.cs new file mode 100644 index 000000000000..751d99ed8bf5 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define an exchange connection. + public partial class ExchangeConnection : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession _bgpSession; + + /// The BGP session associated with the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession BgpSession { get => (this._bgpSession = this._bgpSession ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSession()); set => this._bgpSession = value; } + + /// The maximum number of prefixes advertised over the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public int? BgpSessionMaxPrefixesAdvertisedV4 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MaxPrefixesAdvertisedV4; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MaxPrefixesAdvertisedV4 = value ?? default(int); } + + /// The maximum number of prefixes advertised over the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public int? BgpSessionMaxPrefixesAdvertisedV6 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MaxPrefixesAdvertisedV6; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MaxPrefixesAdvertisedV6 = value ?? default(int); } + + /// The MD5 authentication key of the session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionMd5AuthenticationKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).Md5AuthenticationKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).Md5AuthenticationKey = value ?? null; } + + /// The IPv4 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionMicrosoftSessionIPv4Address { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MicrosoftSessionIPv4Address; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MicrosoftSessionIPv4Address = value ?? null; } + + /// The IPv6 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionMicrosoftSessionIPv6Address { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MicrosoftSessionIPv6Address; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).MicrosoftSessionIPv6Address = value ?? null; } + + /// The IPv4 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionPeerSessionIPv4Address { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).PeerSessionIPv4Address; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).PeerSessionIPv4Address = value ?? null; } + + /// The IPv6 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionPeerSessionIPv6Address { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).PeerSessionIPv6Address; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).PeerSessionIPv6Address = value ?? null; } + + /// The IPv4 prefix that contains both ends' IPv4 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionPrefixV4 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionPrefixV4; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionPrefixV4 = value ?? null; } + + /// The IPv6 prefix that contains both ends' IPv6 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string BgpSessionPrefixV6 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionPrefixV6; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionPrefixV6 = value ?? null; } + + /// The state of the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? BgpSessionStateV4 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV4; } + + /// The state of the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? BgpSessionStateV6 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV6; } + + /// Backing field for property. + private string _connectionIdentifier; + + /// The unique identifier (GUID) for the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ConnectionIdentifier { get => this._connectionIdentifier; set => this._connectionIdentifier = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? _connectionState; + + /// The state of the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? ConnectionState { get => this._connectionState; } + + /// Backing field for property. + private string _errorMessage; + + /// The error message related to the connection state, if any. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Internal Acessors for BgpSession + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal.BgpSession { get => (this._bgpSession = this._bgpSession ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSession()); set { {_bgpSession = value;} } } + + /// Internal Acessors for BgpSessionStateV4 + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal.BgpSessionStateV4 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV4; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV4 = value; } + + /// Internal Acessors for BgpSessionStateV6 + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal.BgpSessionStateV6 { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV6; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSessionInternal)BgpSession).SessionStateV6 = value; } + + /// Internal Acessors for ConnectionState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal.ConnectionState { get => this._connectionState; set { {_connectionState = value;} } } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnectionInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Backing field for property. + private int? _peeringDbFacilityId; + + /// The PeeringDB.com ID of the facility at which the connection has to be set up. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? PeeringDbFacilityId { get => this._peeringDbFacilityId; set => this._peeringDbFacilityId = value; } + + /// Creates an new instance. + public ExchangeConnection() + { + + } + } + /// The properties that define an exchange connection. + public partial interface IExchangeConnection : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The maximum number of prefixes advertised over the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum number of prefixes advertised over the IPv4 session.", + SerializedName = @"maxPrefixesAdvertisedV4", + PossibleTypes = new [] { typeof(int) })] + int? BgpSessionMaxPrefixesAdvertisedV4 { get; set; } + /// The maximum number of prefixes advertised over the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum number of prefixes advertised over the IPv6 session.", + SerializedName = @"maxPrefixesAdvertisedV6", + PossibleTypes = new [] { typeof(int) })] + int? BgpSessionMaxPrefixesAdvertisedV6 { get; set; } + /// The MD5 authentication key of the session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The MD5 authentication key of the session.", + SerializedName = @"md5AuthenticationKey", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionMd5AuthenticationKey { get; set; } + /// The IPv4 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 session address on Microsoft's end.", + SerializedName = @"microsoftSessionIPv4Address", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionMicrosoftSessionIPv4Address { get; set; } + /// The IPv6 session address on Microsoft's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 session address on Microsoft's end.", + SerializedName = @"microsoftSessionIPv6Address", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionMicrosoftSessionIPv6Address { get; set; } + /// The IPv4 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 session address on peer's end.", + SerializedName = @"peerSessionIPv4Address", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionPeerSessionIPv4Address { get; set; } + /// The IPv6 session address on peer's end. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 session address on peer's end.", + SerializedName = @"peerSessionIPv6Address", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionPeerSessionIPv6Address { get; set; } + /// The IPv4 prefix that contains both ends' IPv4 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 prefix that contains both ends' IPv4 addresses.", + SerializedName = @"sessionPrefixV4", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionPrefixV4 { get; set; } + /// The IPv6 prefix that contains both ends' IPv6 addresses. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 prefix that contains both ends' IPv6 addresses.", + SerializedName = @"sessionPrefixV6", + PossibleTypes = new [] { typeof(string) })] + string BgpSessionPrefixV6 { get; set; } + /// The state of the IPv4 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The state of the IPv4 session.", + SerializedName = @"sessionStateV4", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? BgpSessionStateV4 { get; } + /// The state of the IPv6 session. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The state of the IPv6 session.", + SerializedName = @"sessionStateV6", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? BgpSessionStateV6 { get; } + /// The unique identifier (GUID) for the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique identifier (GUID) for the connection.", + SerializedName = @"connectionIdentifier", + PossibleTypes = new [] { typeof(string) })] + string ConnectionIdentifier { get; set; } + /// The state of the connection. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The state of the connection.", + SerializedName = @"connectionState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? ConnectionState { get; } + /// The error message related to the connection state, if any. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message related to the connection state, if any.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The PeeringDB.com ID of the facility at which the connection has to be set up. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PeeringDB.com ID of the facility at which the connection has to be set up.", + SerializedName = @"peeringDBFacilityId", + PossibleTypes = new [] { typeof(int) })] + int? PeeringDbFacilityId { get; set; } + + } + /// The properties that define an exchange connection. + internal partial interface IExchangeConnectionInternal + + { + /// The BGP session associated with the connection. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IBgpSession BgpSession { get; set; } + /// The maximum number of prefixes advertised over the IPv4 session. + int? BgpSessionMaxPrefixesAdvertisedV4 { get; set; } + /// The maximum number of prefixes advertised over the IPv6 session. + int? BgpSessionMaxPrefixesAdvertisedV6 { get; set; } + /// The MD5 authentication key of the session. + string BgpSessionMd5AuthenticationKey { get; set; } + /// The IPv4 session address on Microsoft's end. + string BgpSessionMicrosoftSessionIPv4Address { get; set; } + /// The IPv6 session address on Microsoft's end. + string BgpSessionMicrosoftSessionIPv6Address { get; set; } + /// The IPv4 session address on peer's end. + string BgpSessionPeerSessionIPv4Address { get; set; } + /// The IPv6 session address on peer's end. + string BgpSessionPeerSessionIPv6Address { get; set; } + /// The IPv4 prefix that contains both ends' IPv4 addresses. + string BgpSessionPrefixV4 { get; set; } + /// The IPv6 prefix that contains both ends' IPv6 addresses. + string BgpSessionPrefixV6 { get; set; } + /// The state of the IPv4 session. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4? BgpSessionStateV4 { get; set; } + /// The state of the IPv6 session. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6? BgpSessionStateV6 { get; set; } + /// The unique identifier (GUID) for the connection. + string ConnectionIdentifier { get; set; } + /// The state of the connection. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState? ConnectionState { get; set; } + /// The error message related to the connection state, if any. + string ErrorMessage { get; set; } + /// The PeeringDB.com ID of the facility at which the connection has to be set up. + int? PeeringDbFacilityId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.json.cs b/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.json.cs new file mode 100644 index 000000000000..ef61d4f99f5c --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ExchangeConnection.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define an exchange connection. + public partial class ExchangeConnection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ExchangeConnection(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_bgpSession = If( json?.PropertyT("bgpSession"), out var __jsonBgpSession) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.BgpSession.FromJson(__jsonBgpSession) : BgpSession;} + {_peeringDbFacilityId = If( json?.PropertyT("peeringDBFacilityId"), out var __jsonPeeringDbFacilityId) ? (int?)__jsonPeeringDbFacilityId : PeeringDbFacilityId;} + {_connectionState = If( json?.PropertyT("connectionState"), out var __jsonConnectionState) ? (string)__jsonConnectionState : (string)ConnectionState;} + {_connectionIdentifier = If( json?.PropertyT("connectionIdentifier"), out var __jsonConnectionIdentifier) ? (string)__jsonConnectionIdentifier : (string)ConnectionIdentifier;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ExchangeConnection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._bgpSession ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._bgpSession.ToJson(null,serializationMode) : null, "bgpSession" ,container.Add ); + AddIf( null != this._peeringDbFacilityId ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._peeringDbFacilityId) : null, "peeringDBFacilityId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._connectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._connectionState.ToString()) : null, "connectionState" ,container.Add ); + } + AddIf( null != (((object)this._connectionIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._connectionIdentifier.ToString()) : null, "connectionIdentifier" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.PowerShell.cs new file mode 100644 index 000000000000..4886450ba7f5 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.PowerShell.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define an exchange peering facility. + [System.ComponentModel.TypeConverter(typeof(ExchangePeeringFacilityTypeConverter))] + public partial class ExchangePeeringFacility + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExchangePeeringFacility(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExchangePeeringFacility(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExchangePeeringFacility(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExchangeName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).ExchangeName = (string) content.GetValueForProperty("ExchangeName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).ExchangeName, global::System.Convert.ToString); + } + if (content.Contains("BandwidthInMbps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).BandwidthInMbps = (int?) content.GetValueForProperty("BandwidthInMbps",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).BandwidthInMbps, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MicrosoftIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).MicrosoftIPv4Address = (string) content.GetValueForProperty("MicrosoftIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).MicrosoftIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("MicrosoftIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).MicrosoftIPv6Address = (string) content.GetValueForProperty("MicrosoftIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).MicrosoftIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("FacilityIPv4Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).FacilityIPv4Prefix = (string) content.GetValueForProperty("FacilityIPv4Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).FacilityIPv4Prefix, global::System.Convert.ToString); + } + if (content.Contains("FacilityIPv6Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).FacilityIPv6Prefix = (string) content.GetValueForProperty("FacilityIPv6Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).FacilityIPv6Prefix, global::System.Convert.ToString); + } + if (content.Contains("PeeringDbFacilityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).PeeringDbFacilityId = (int?) content.GetValueForProperty("PeeringDbFacilityId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).PeeringDbFacilityId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeeringDbFacilityLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).PeeringDbFacilityLink = (string) content.GetValueForProperty("PeeringDbFacilityLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).PeeringDbFacilityLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExchangePeeringFacility(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExchangeName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).ExchangeName = (string) content.GetValueForProperty("ExchangeName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).ExchangeName, global::System.Convert.ToString); + } + if (content.Contains("BandwidthInMbps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).BandwidthInMbps = (int?) content.GetValueForProperty("BandwidthInMbps",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).BandwidthInMbps, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MicrosoftIPv4Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).MicrosoftIPv4Address = (string) content.GetValueForProperty("MicrosoftIPv4Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).MicrosoftIPv4Address, global::System.Convert.ToString); + } + if (content.Contains("MicrosoftIPv6Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).MicrosoftIPv6Address = (string) content.GetValueForProperty("MicrosoftIPv6Address",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).MicrosoftIPv6Address, global::System.Convert.ToString); + } + if (content.Contains("FacilityIPv4Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).FacilityIPv4Prefix = (string) content.GetValueForProperty("FacilityIPv4Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).FacilityIPv4Prefix, global::System.Convert.ToString); + } + if (content.Contains("FacilityIPv6Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).FacilityIPv6Prefix = (string) content.GetValueForProperty("FacilityIPv6Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).FacilityIPv6Prefix, global::System.Convert.ToString); + } + if (content.Contains("PeeringDbFacilityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).PeeringDbFacilityId = (int?) content.GetValueForProperty("PeeringDbFacilityId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).PeeringDbFacilityId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeeringDbFacilityLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).PeeringDbFacilityLink = (string) content.GetValueForProperty("PeeringDbFacilityLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal)this).PeeringDbFacilityLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define an exchange peering facility. + [System.ComponentModel.TypeConverter(typeof(ExchangePeeringFacilityTypeConverter))] + public partial interface IExchangePeeringFacility + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.TypeConverter.cs new file mode 100644 index 000000000000..14cd83ea1965 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExchangePeeringFacilityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExchangePeeringFacility.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExchangePeeringFacility.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExchangePeeringFacility.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.cs b/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.cs new file mode 100644 index 000000000000..7175592d7ec5 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define an exchange peering facility. + public partial class ExchangePeeringFacility : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacilityInternal + { + + /// Backing field for property. + private int? _bandwidthInMbps; + + /// + /// The bandwidth of the connection between Microsoft and the exchange peering facility. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? BandwidthInMbps { get => this._bandwidthInMbps; set => this._bandwidthInMbps = value; } + + /// Backing field for property. + private string _exchangeName; + + /// The name of the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ExchangeName { get => this._exchangeName; set => this._exchangeName = value; } + + /// Backing field for property. + private string _facilityIPv4Prefix; + + /// The IPv4 prefixes associated with the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string FacilityIPv4Prefix { get => this._facilityIPv4Prefix; set => this._facilityIPv4Prefix = value; } + + /// Backing field for property. + private string _facilityIPv6Prefix; + + /// The IPv6 prefixes associated with the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string FacilityIPv6Prefix { get => this._facilityIPv6Prefix; set => this._facilityIPv6Prefix = value; } + + /// Backing field for property. + private string _microsoftIPv4Address; + + /// The IPv4 address of Microsoft at the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string MicrosoftIPv4Address { get => this._microsoftIPv4Address; set => this._microsoftIPv4Address = value; } + + /// Backing field for property. + private string _microsoftIPv6Address; + + /// The IPv6 address of Microsoft at the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string MicrosoftIPv6Address { get => this._microsoftIPv6Address; set => this._microsoftIPv6Address = value; } + + /// Backing field for property. + private int? _peeringDbFacilityId; + + /// The PeeringDB.com ID of the facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? PeeringDbFacilityId { get => this._peeringDbFacilityId; set => this._peeringDbFacilityId = value; } + + /// Backing field for property. + private string _peeringDbFacilityLink; + + /// The PeeringDB.com URL of the facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringDbFacilityLink { get => this._peeringDbFacilityLink; set => this._peeringDbFacilityLink = value; } + + /// Creates an new instance. + public ExchangePeeringFacility() + { + + } + } + /// The properties that define an exchange peering facility. + public partial interface IExchangePeeringFacility : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// + /// The bandwidth of the connection between Microsoft and the exchange peering facility. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The bandwidth of the connection between Microsoft and the exchange peering facility.", + SerializedName = @"bandwidthInMbps", + PossibleTypes = new [] { typeof(int) })] + int? BandwidthInMbps { get; set; } + /// The name of the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the exchange peering facility.", + SerializedName = @"exchangeName", + PossibleTypes = new [] { typeof(string) })] + string ExchangeName { get; set; } + /// The IPv4 prefixes associated with the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 prefixes associated with the exchange peering facility.", + SerializedName = @"facilityIPv4Prefix", + PossibleTypes = new [] { typeof(string) })] + string FacilityIPv4Prefix { get; set; } + /// The IPv6 prefixes associated with the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 prefixes associated with the exchange peering facility.", + SerializedName = @"facilityIPv6Prefix", + PossibleTypes = new [] { typeof(string) })] + string FacilityIPv6Prefix { get; set; } + /// The IPv4 address of Microsoft at the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv4 address of Microsoft at the exchange peering facility.", + SerializedName = @"microsoftIPv4Address", + PossibleTypes = new [] { typeof(string) })] + string MicrosoftIPv4Address { get; set; } + /// The IPv6 address of Microsoft at the exchange peering facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IPv6 address of Microsoft at the exchange peering facility.", + SerializedName = @"microsoftIPv6Address", + PossibleTypes = new [] { typeof(string) })] + string MicrosoftIPv6Address { get; set; } + /// The PeeringDB.com ID of the facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PeeringDB.com ID of the facility.", + SerializedName = @"peeringDBFacilityId", + PossibleTypes = new [] { typeof(int) })] + int? PeeringDbFacilityId { get; set; } + /// The PeeringDB.com URL of the facility. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PeeringDB.com URL of the facility.", + SerializedName = @"peeringDBFacilityLink", + PossibleTypes = new [] { typeof(string) })] + string PeeringDbFacilityLink { get; set; } + + } + /// The properties that define an exchange peering facility. + internal partial interface IExchangePeeringFacilityInternal + + { + /// + /// The bandwidth of the connection between Microsoft and the exchange peering facility. + /// + int? BandwidthInMbps { get; set; } + /// The name of the exchange peering facility. + string ExchangeName { get; set; } + /// The IPv4 prefixes associated with the exchange peering facility. + string FacilityIPv4Prefix { get; set; } + /// The IPv6 prefixes associated with the exchange peering facility. + string FacilityIPv6Prefix { get; set; } + /// The IPv4 address of Microsoft at the exchange peering facility. + string MicrosoftIPv4Address { get; set; } + /// The IPv6 address of Microsoft at the exchange peering facility. + string MicrosoftIPv6Address { get; set; } + /// The PeeringDB.com ID of the facility. + int? PeeringDbFacilityId { get; set; } + /// The PeeringDB.com URL of the facility. + string PeeringDbFacilityLink { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.json.cs b/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.json.cs new file mode 100644 index 000000000000..9cfe73460ac8 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ExchangePeeringFacility.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define an exchange peering facility. + public partial class ExchangePeeringFacility + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ExchangePeeringFacility(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_exchangeName = If( json?.PropertyT("exchangeName"), out var __jsonExchangeName) ? (string)__jsonExchangeName : (string)ExchangeName;} + {_bandwidthInMbps = If( json?.PropertyT("bandwidthInMbps"), out var __jsonBandwidthInMbps) ? (int?)__jsonBandwidthInMbps : BandwidthInMbps;} + {_microsoftIPv4Address = If( json?.PropertyT("microsoftIPv4Address"), out var __jsonMicrosoftIPv4Address) ? (string)__jsonMicrosoftIPv4Address : (string)MicrosoftIPv4Address;} + {_microsoftIPv6Address = If( json?.PropertyT("microsoftIPv6Address"), out var __jsonMicrosoftIPv6Address) ? (string)__jsonMicrosoftIPv6Address : (string)MicrosoftIPv6Address;} + {_facilityIPv4Prefix = If( json?.PropertyT("facilityIPv4Prefix"), out var __jsonFacilityIPv4Prefix) ? (string)__jsonFacilityIPv4Prefix : (string)FacilityIPv4Prefix;} + {_facilityIPv6Prefix = If( json?.PropertyT("facilityIPv6Prefix"), out var __jsonFacilityIPv6Prefix) ? (string)__jsonFacilityIPv6Prefix : (string)FacilityIPv6Prefix;} + {_peeringDbFacilityId = If( json?.PropertyT("peeringDBFacilityId"), out var __jsonPeeringDbFacilityId) ? (int?)__jsonPeeringDbFacilityId : PeeringDbFacilityId;} + {_peeringDbFacilityLink = If( json?.PropertyT("peeringDBFacilityLink"), out var __jsonPeeringDbFacilityLink) ? (string)__jsonPeeringDbFacilityLink : (string)PeeringDbFacilityLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ExchangePeeringFacility(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._exchangeName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._exchangeName.ToString()) : null, "exchangeName" ,container.Add ); + AddIf( null != this._bandwidthInMbps ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._bandwidthInMbps) : null, "bandwidthInMbps" ,container.Add ); + AddIf( null != (((object)this._microsoftIPv4Address)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._microsoftIPv4Address.ToString()) : null, "microsoftIPv4Address" ,container.Add ); + AddIf( null != (((object)this._microsoftIPv6Address)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._microsoftIPv6Address.ToString()) : null, "microsoftIPv6Address" ,container.Add ); + AddIf( null != (((object)this._facilityIPv4Prefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._facilityIPv4Prefix.ToString()) : null, "facilityIPv4Prefix" ,container.Add ); + AddIf( null != (((object)this._facilityIPv6Prefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._facilityIPv6Prefix.ToString()) : null, "facilityIPv6Prefix" ,container.Add ); + AddIf( null != this._peeringDbFacilityId ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._peeringDbFacilityId) : null, "peeringDBFacilityId" ,container.Add ); + AddIf( null != (((object)this._peeringDbFacilityLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringDbFacilityLink.ToString()) : null, "peeringDBFacilityLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.PowerShell.cs new file mode 100644 index 000000000000..462ad8a69274 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.PowerShell.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a Log Analytics Workspace. + [System.ComponentModel.TypeConverter(typeof(LogAnalyticsWorkspacePropertiesTypeConverter))] + public partial class LogAnalyticsWorkspaceProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogAnalyticsWorkspaceProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogAnalyticsWorkspaceProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogAnalyticsWorkspaceProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkspaceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).WorkspaceId = (string) content.GetValueForProperty("WorkspaceId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).WorkspaceId, global::System.Convert.ToString); + } + if (content.Contains("Key")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).Key = (string) content.GetValueForProperty("Key",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).Key, global::System.Convert.ToString); + } + if (content.Contains("ConnectedAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).ConnectedAgent = (string[]) content.GetValueForProperty("ConnectedAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).ConnectedAgent, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogAnalyticsWorkspaceProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkspaceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).WorkspaceId = (string) content.GetValueForProperty("WorkspaceId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).WorkspaceId, global::System.Convert.ToString); + } + if (content.Contains("Key")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).Key = (string) content.GetValueForProperty("Key",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).Key, global::System.Convert.ToString); + } + if (content.Contains("ConnectedAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).ConnectedAgent = (string[]) content.GetValueForProperty("ConnectedAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)this).ConnectedAgent, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a Log Analytics Workspace. + [System.ComponentModel.TypeConverter(typeof(LogAnalyticsWorkspacePropertiesTypeConverter))] + public partial interface ILogAnalyticsWorkspaceProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.TypeConverter.cs new file mode 100644 index 000000000000..977598200797 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogAnalyticsWorkspacePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogAnalyticsWorkspaceProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogAnalyticsWorkspaceProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogAnalyticsWorkspaceProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.cs b/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.cs new file mode 100644 index 000000000000..cad04183e0b3 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a Log Analytics Workspace. + public partial class LogAnalyticsWorkspaceProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal + { + + /// Backing field for property. + private string[] _connectedAgent; + + /// The list of connected agents. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string[] ConnectedAgent { get => this._connectedAgent; } + + /// Backing field for property. + private string _key; + + /// The Workspace Key. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Key { get => this._key; } + + /// Internal Acessors for ConnectedAgent + string[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal.ConnectedAgent { get => this._connectedAgent; set { {_connectedAgent = value;} } } + + /// Internal Acessors for Key + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal.Key { get => this._key; set { {_key = value;} } } + + /// Internal Acessors for WorkspaceId + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal.WorkspaceId { get => this._workspaceId; set { {_workspaceId = value;} } } + + /// Backing field for property. + private string _workspaceId; + + /// The Workspace ID. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string WorkspaceId { get => this._workspaceId; } + + /// Creates an new instance. + public LogAnalyticsWorkspaceProperties() + { + + } + } + /// The properties that define a Log Analytics Workspace. + public partial interface ILogAnalyticsWorkspaceProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The list of connected agents. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of connected agents.", + SerializedName = @"connectedAgents", + PossibleTypes = new [] { typeof(string) })] + string[] ConnectedAgent { get; } + /// The Workspace Key. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Workspace Key.", + SerializedName = @"key", + PossibleTypes = new [] { typeof(string) })] + string Key { get; } + /// The Workspace ID. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Workspace ID.", + SerializedName = @"workspaceID", + PossibleTypes = new [] { typeof(string) })] + string WorkspaceId { get; } + + } + /// The properties that define a Log Analytics Workspace. + internal partial interface ILogAnalyticsWorkspacePropertiesInternal + + { + /// The list of connected agents. + string[] ConnectedAgent { get; set; } + /// The Workspace Key. + string Key { get; set; } + /// The Workspace ID. + string WorkspaceId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.json.cs new file mode 100644 index 000000000000..cd0e72cc2c80 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/LogAnalyticsWorkspaceProperties.json.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a Log Analytics Workspace. + public partial class LogAnalyticsWorkspaceProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new LogAnalyticsWorkspaceProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal LogAnalyticsWorkspaceProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_workspaceId = If( json?.PropertyT("workspaceID"), out var __jsonWorkspaceId) ? (string)__jsonWorkspaceId : (string)WorkspaceId;} + {_key = If( json?.PropertyT("key"), out var __jsonKey) ? (string)__jsonKey : (string)Key;} + {_connectedAgent = If( json?.PropertyT("connectedAgents"), out var __jsonConnectedAgents) ? If( __jsonConnectedAgents as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : ConnectedAgent;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._workspaceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._workspaceId.ToString()) : null, "workspaceID" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._key)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._key.ToString()) : null, "key" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._connectedAgent) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._connectedAgent ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("connectedAgents",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.PowerShell.cs new file mode 100644 index 000000000000..7c9ec94e59b3 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// Looking glass output model + [System.ComponentModel.TypeConverter(typeof(LookingGlassOutputTypeConverter))] + public partial class LookingGlassOutput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LookingGlassOutput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LookingGlassOutput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LookingGlassOutput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Command")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutputInternal)this).Command = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command?) content.GetValueForProperty("Command",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutputInternal)this).Command, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command.CreateFrom); + } + if (content.Contains("Output")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutputInternal)this).Output = (string) content.GetValueForProperty("Output",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutputInternal)this).Output, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LookingGlassOutput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Command")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutputInternal)this).Command = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command?) content.GetValueForProperty("Command",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutputInternal)this).Command, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command.CreateFrom); + } + if (content.Contains("Output")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutputInternal)this).Output = (string) content.GetValueForProperty("Output",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutputInternal)this).Output, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Looking glass output model + [System.ComponentModel.TypeConverter(typeof(LookingGlassOutputTypeConverter))] + public partial interface ILookingGlassOutput + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.TypeConverter.cs new file mode 100644 index 000000000000..69492da79482 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LookingGlassOutputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LookingGlassOutput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LookingGlassOutput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LookingGlassOutput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.cs b/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.cs new file mode 100644 index 000000000000..00fc0e97274e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Looking glass output model + public partial class LookingGlassOutput : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutputInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command? _command; + + /// Invoked command + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command? Command { get => this._command; set => this._command = value; } + + /// Backing field for property. + private string _output; + + /// Output of the command + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Output { get => this._output; set => this._output = value; } + + /// Creates an new instance. + public LookingGlassOutput() + { + + } + } + /// Looking glass output model + public partial interface ILookingGlassOutput : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// Invoked command + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Invoked command", + SerializedName = @"command", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command? Command { get; set; } + /// Output of the command + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Output of the command", + SerializedName = @"output", + PossibleTypes = new [] { typeof(string) })] + string Output { get; set; } + + } + /// Looking glass output model + internal partial interface ILookingGlassOutputInternal + + { + /// Invoked command + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command? Command { get; set; } + /// Output of the command + string Output { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.json.cs b/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.json.cs new file mode 100644 index 000000000000..6b61b7354648 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/LookingGlassOutput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Looking glass output model + public partial class LookingGlassOutput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new LookingGlassOutput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal LookingGlassOutput(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_command = If( json?.PropertyT("command"), out var __jsonCommand) ? (string)__jsonCommand : (string)Command;} + {_output = If( json?.PropertyT("output"), out var __jsonOutput) ? (string)__jsonOutput : (string)Output;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._command)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._command.ToString()) : null, "command" ,container.Add ); + AddIf( null != (((object)this._output)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._output.ToString()) : null, "output" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/MetricDimension.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/MetricDimension.PowerShell.cs new file mode 100644 index 000000000000..2afcfd758c3a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/MetricDimension.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// Dimensions of the metric. + [System.ComponentModel.TypeConverter(typeof(MetricDimensionTypeConverter))] + public partial class MetricDimension + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MetricDimension(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MetricDimension(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MetricDimension(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal)this).DisplayName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MetricDimension(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal)this).DisplayName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Dimensions of the metric. + [System.ComponentModel.TypeConverter(typeof(MetricDimensionTypeConverter))] + public partial interface IMetricDimension + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/MetricDimension.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/MetricDimension.TypeConverter.cs new file mode 100644 index 000000000000..5e5e8eb965d4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/MetricDimension.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MetricDimensionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MetricDimension.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MetricDimension.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MetricDimension.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/MetricDimension.cs b/src/Peering/generated/api/Models/Api20221001/MetricDimension.cs new file mode 100644 index 000000000000..e14b3390fa40 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/MetricDimension.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Dimensions of the metric. + public partial class MetricDimension : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal + { + + /// Backing field for property. + private string _displayName; + + /// Localized friendly display name of the dimension. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimensionInternal.Name { get => this._name; set { {_name = value;} } } + + /// Backing field for property. + private string _name; + + /// Name of the dimension. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Creates an new instance. + public MetricDimension() + { + + } + } + /// Dimensions of the metric. + public partial interface IMetricDimension : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// Localized friendly display name of the dimension. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Localized friendly display name of the dimension.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// Name of the dimension. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Name of the dimension.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + + } + /// Dimensions of the metric. + internal partial interface IMetricDimensionInternal + + { + /// Localized friendly display name of the dimension. + string DisplayName { get; set; } + /// Name of the dimension. + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/MetricDimension.json.cs b/src/Peering/generated/api/Models/Api20221001/MetricDimension.json.cs new file mode 100644 index 000000000000..e3c7fc6c1a56 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/MetricDimension.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Dimensions of the metric. + public partial class MetricDimension + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new MetricDimension(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal MetricDimension(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/MetricSpecification.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/MetricSpecification.PowerShell.cs new file mode 100644 index 000000000000..98808b17dad2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/MetricSpecification.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// Specifications of the Metrics for Azure Monitoring. + [System.ComponentModel.TypeConverter(typeof(MetricSpecificationTypeConverter))] + public partial class MetricSpecification + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MetricSpecification(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MetricSpecification(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MetricSpecification(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).DisplayDescription, global::System.Convert.ToString); + } + if (content.Contains("Unit")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Unit = (string) content.GetValueForProperty("Unit",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Unit, global::System.Convert.ToString); + } + if (content.Contains("AggregationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).AggregationType = (string) content.GetValueForProperty("AggregationType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).AggregationType, global::System.Convert.ToString); + } + if (content.Contains("SupportedTimeGrainType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).SupportedTimeGrainType = (string[]) content.GetValueForProperty("SupportedTimeGrainType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).SupportedTimeGrainType, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Dimension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Dimension = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension[]) content.GetValueForProperty("Dimension",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Dimension, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricDimensionTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MetricSpecification(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).DisplayDescription, global::System.Convert.ToString); + } + if (content.Contains("Unit")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Unit = (string) content.GetValueForProperty("Unit",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Unit, global::System.Convert.ToString); + } + if (content.Contains("AggregationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).AggregationType = (string) content.GetValueForProperty("AggregationType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).AggregationType, global::System.Convert.ToString); + } + if (content.Contains("SupportedTimeGrainType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).SupportedTimeGrainType = (string[]) content.GetValueForProperty("SupportedTimeGrainType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).SupportedTimeGrainType, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Dimension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Dimension = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension[]) content.GetValueForProperty("Dimension",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal)this).Dimension, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricDimensionTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Specifications of the Metrics for Azure Monitoring. + [System.ComponentModel.TypeConverter(typeof(MetricSpecificationTypeConverter))] + public partial interface IMetricSpecification + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/MetricSpecification.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/MetricSpecification.TypeConverter.cs new file mode 100644 index 000000000000..9f5163bb2ef6 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/MetricSpecification.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MetricSpecificationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MetricSpecification.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MetricSpecification.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MetricSpecification.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/MetricSpecification.cs b/src/Peering/generated/api/Models/Api20221001/MetricSpecification.cs new file mode 100644 index 000000000000..b1ababa76efb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/MetricSpecification.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Specifications of the Metrics for Azure Monitoring. + public partial class MetricSpecification : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal + { + + /// Backing field for property. + private string _aggregationType; + + /// + /// Aggregation type will be set to one of the values: Average, Minimum, Maximum, Total, Count. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string AggregationType { get => this._aggregationType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension[] _dimension; + + /// Dimensions of the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension[] Dimension { get => this._dimension; } + + /// Backing field for property. + private string _displayDescription; + + /// Localized friendly description of the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string DisplayDescription { get => this._displayDescription; } + + /// Backing field for property. + private string _displayName; + + /// Localized friendly display name of the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; } + + /// Internal Acessors for AggregationType + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal.AggregationType { get => this._aggregationType; set { {_aggregationType = value;} } } + + /// Internal Acessors for Dimension + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal.Dimension { get => this._dimension; set { {_dimension = value;} } } + + /// Internal Acessors for DisplayDescription + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal.DisplayDescription { get => this._displayDescription; set { {_displayDescription = value;} } } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for SupportedTimeGrainType + string[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal.SupportedTimeGrainType { get => this._supportedTimeGrainType; set { {_supportedTimeGrainType = value;} } } + + /// Internal Acessors for Unit + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecificationInternal.Unit { get => this._unit; set { {_unit = value;} } } + + /// Backing field for property. + private string _name; + + /// Name of the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string[] _supportedTimeGrainType; + + /// Supported time grain types for the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string[] SupportedTimeGrainType { get => this._supportedTimeGrainType; } + + /// Backing field for property. + private string _unit; + + /// Unit that makes sense for the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Unit { get => this._unit; } + + /// Creates an new instance. + public MetricSpecification() + { + + } + } + /// Specifications of the Metrics for Azure Monitoring. + public partial interface IMetricSpecification : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// + /// Aggregation type will be set to one of the values: Average, Minimum, Maximum, Total, Count. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Aggregation type will be set to one of the values: Average, Minimum, Maximum, Total, Count.", + SerializedName = @"aggregationType", + PossibleTypes = new [] { typeof(string) })] + string AggregationType { get; } + /// Dimensions of the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Dimensions of the metric.", + SerializedName = @"dimensions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension[] Dimension { get; } + /// Localized friendly description of the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Localized friendly description of the metric.", + SerializedName = @"displayDescription", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; } + /// Localized friendly display name of the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Localized friendly display name of the metric.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// Name of the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Name of the metric.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Supported time grain types for the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Supported time grain types for the metric.", + SerializedName = @"supportedTimeGrainTypes", + PossibleTypes = new [] { typeof(string) })] + string[] SupportedTimeGrainType { get; } + /// Unit that makes sense for the metric. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Unit that makes sense for the metric.", + SerializedName = @"unit", + PossibleTypes = new [] { typeof(string) })] + string Unit { get; } + + } + /// Specifications of the Metrics for Azure Monitoring. + internal partial interface IMetricSpecificationInternal + + { + /// + /// Aggregation type will be set to one of the values: Average, Minimum, Maximum, Total, Count. + /// + string AggregationType { get; set; } + /// Dimensions of the metric. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension[] Dimension { get; set; } + /// Localized friendly description of the metric. + string DisplayDescription { get; set; } + /// Localized friendly display name of the metric. + string DisplayName { get; set; } + /// Name of the metric. + string Name { get; set; } + /// Supported time grain types for the metric. + string[] SupportedTimeGrainType { get; set; } + /// Unit that makes sense for the metric. + string Unit { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/MetricSpecification.json.cs b/src/Peering/generated/api/Models/Api20221001/MetricSpecification.json.cs new file mode 100644 index 000000000000..42b0b60bf75d --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/MetricSpecification.json.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Specifications of the Metrics for Azure Monitoring. + public partial class MetricSpecification + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new MetricSpecification(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal MetricSpecification(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} + {_displayDescription = If( json?.PropertyT("displayDescription"), out var __jsonDisplayDescription) ? (string)__jsonDisplayDescription : (string)DisplayDescription;} + {_unit = If( json?.PropertyT("unit"), out var __jsonUnit) ? (string)__jsonUnit : (string)Unit;} + {_aggregationType = If( json?.PropertyT("aggregationType"), out var __jsonAggregationType) ? (string)__jsonAggregationType : (string)AggregationType;} + {_supportedTimeGrainType = If( json?.PropertyT("supportedTimeGrainTypes"), out var __jsonSupportedTimeGrainTypes) ? If( __jsonSupportedTimeGrainTypes as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : SupportedTimeGrainType;} + {_dimension = If( json?.PropertyT("dimensions"), out var __jsonDimensions) ? If( __jsonDimensions as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricDimension) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricDimension.FromJson(__p) )) ))() : null : Dimension;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._displayDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._displayDescription.ToString()) : null, "displayDescription" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._unit)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._unit.ToString()) : null, "unit" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._aggregationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._aggregationType.ToString()) : null, "aggregationType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._supportedTimeGrainType) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._supportedTimeGrainType ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("supportedTimeGrainTypes",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._dimension) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __s in this._dimension ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("dimensions",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Operation.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/Operation.PowerShell.cs new file mode 100644 index 000000000000..80d625face7b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Operation.PowerShell.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The peering API operation. + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial class Operation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Operation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Operation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Operation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationDisplayInfoTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ServiceSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).ServiceSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification) content.GetValueForProperty("ServiceSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).ServiceSpecification, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ServiceSpecificationTypeConverter.ConvertFrom); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + } + if (content.Contains("ServiceSpecificationMetricSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).ServiceSpecificationMetricSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[]) content.GetValueForProperty("ServiceSpecificationMetricSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).ServiceSpecificationMetricSpecification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricSpecificationTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Operation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationDisplayInfoTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ServiceSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).ServiceSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification) content.GetValueForProperty("ServiceSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).ServiceSpecification, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ServiceSpecificationTypeConverter.ConvertFrom); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + } + if (content.Contains("ServiceSpecificationMetricSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).ServiceSpecificationMetricSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[]) content.GetValueForProperty("ServiceSpecificationMetricSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal)this).ServiceSpecificationMetricSpecification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricSpecificationTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The peering API operation. + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial interface IOperation + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Operation.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/Operation.TypeConverter.cs new file mode 100644 index 000000000000..e28a7080f73e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Operation.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Operation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Operation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Operation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Operation.cs b/src/Peering/generated/api/Models/Api20221001/Operation.cs new file mode 100644 index 000000000000..3c68992e6be2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Operation.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering API operation. + public partial class Operation : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo _display; + + /// The information related to the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationDisplayInfo()); } + + /// The description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Description; } + + /// The name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Operation; } + + /// The name of the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Provider; } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Resource; } + + /// Backing field for property. + private bool? _isDataAction; + + /// The flag that indicates whether the operation applies to data plane. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public bool? IsDataAction { get => this._isDataAction; } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationDisplayInfo()); set { {_display = value;} } } + + /// Internal Acessors for DisplayDescription + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Description = value; } + + /// Internal Acessors for DisplayOperation + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Operation = value; } + + /// Internal Acessors for DisplayProvider + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Provider = value; } + + /// Internal Acessors for DisplayResource + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)Display).Resource = value; } + + /// Internal Acessors for IsDataAction + bool? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationProperties()); set { {_property = value;} } } + + /// Internal Acessors for ServiceSpecification + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.ServiceSpecification { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)Property).ServiceSpecification; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)Property).ServiceSpecification = value; } + + /// Internal Acessors for ServiceSpecificationMetricSpecification + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationInternal.ServiceSpecificationMetricSpecification { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)Property).ServiceSpecificationMetricSpecification; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)Property).ServiceSpecificationMetricSpecification = value; } + + /// Backing field for property. + private string _name; + + /// The name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties _property; + + /// The properties of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationProperties()); } + + /// Specifications of the Metrics for Azure Monitoring. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] ServiceSpecificationMetricSpecification { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)Property).ServiceSpecificationMetricSpecification; } + + /// Creates an new instance. + public Operation() + { + + } + } + /// The peering API operation. + public partial interface IOperation : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The description of the operation.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; } + /// The name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the operation.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; } + /// The name of the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the resource provider.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; } + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the resource.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; } + /// The flag that indicates whether the operation applies to data plane. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The flag that indicates whether the operation applies to data plane.", + SerializedName = @"isDataAction", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDataAction { get; } + /// The name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the operation.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Specifications of the Metrics for Azure Monitoring. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifications of the Metrics for Azure Monitoring.", + SerializedName = @"metricSpecifications", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] ServiceSpecificationMetricSpecification { get; } + + } + /// The peering API operation. + internal partial interface IOperationInternal + + { + /// The information related to the operation. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo Display { get; set; } + /// The description of the operation. + string DisplayDescription { get; set; } + /// The name of the operation. + string DisplayOperation { get; set; } + /// The name of the resource provider. + string DisplayProvider { get; set; } + /// The type of the resource. + string DisplayResource { get; set; } + /// The flag that indicates whether the operation applies to data plane. + bool? IsDataAction { get; set; } + /// The name of the operation. + string Name { get; set; } + /// The properties of the operation. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties Property { get; set; } + /// Service specification payload. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification ServiceSpecification { get; set; } + /// Specifications of the Metrics for Azure Monitoring. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] ServiceSpecificationMetricSpecification { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Operation.json.cs b/src/Peering/generated/api/Models/Api20221001/Operation.json.cs new file mode 100644 index 000000000000..d4a50670e334 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Operation.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering API operation. + public partial class Operation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new Operation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal Operation(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationDisplayInfo.FromJson(__jsonDisplay) : Display;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationProperties.FromJson(__jsonProperties) : Property;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.PowerShell.cs new file mode 100644 index 000000000000..be69ba2cb512 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The information related to the operation. + [System.ComponentModel.TypeConverter(typeof(OperationDisplayInfoTypeConverter))] + public partial class OperationDisplayInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationDisplayInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationDisplayInfo(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationDisplayInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationDisplayInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The information related to the operation. + [System.ComponentModel.TypeConverter(typeof(OperationDisplayInfoTypeConverter))] + public partial interface IOperationDisplayInfo + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.TypeConverter.cs new file mode 100644 index 000000000000..69d95dceacf9 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationDisplayInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationDisplayInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationDisplayInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationDisplayInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.cs b/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.cs new file mode 100644 index 000000000000..44a085fe7dca --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The information related to the operation. + public partial class OperationDisplayInfo : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal + { + + /// Backing field for property. + private string _description; + + /// The description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Description { get => this._description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal.Description { get => this._description; set { {_description = value;} } } + + /// Internal Acessors for Operation + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal.Operation { get => this._operation; set { {_operation = value;} } } + + /// Internal Acessors for Provider + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal.Provider { get => this._provider; set { {_provider = value;} } } + + /// Internal Acessors for Resource + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfoInternal.Resource { get => this._resource; set { {_resource = value;} } } + + /// Backing field for property. + private string _operation; + + /// The name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Operation { get => this._operation; } + + /// Backing field for property. + private string _provider; + + /// The name of the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Provider { get => this._provider; } + + /// Backing field for property. + private string _resource; + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Resource { get => this._resource; } + + /// Creates an new instance. + public OperationDisplayInfo() + { + + } + } + /// The information related to the operation. + public partial interface IOperationDisplayInfo : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The description of the operation.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; } + /// The name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the operation.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; } + /// The name of the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the resource provider.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; } + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the resource.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; } + + } + /// The information related to the operation. + internal partial interface IOperationDisplayInfoInternal + + { + /// The description of the operation. + string Description { get; set; } + /// The name of the operation. + string Operation { get; set; } + /// The name of the resource provider. + string Provider { get; set; } + /// The type of the resource. + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.json.cs b/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.json.cs new file mode 100644 index 000000000000..a72038871cab --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationDisplayInfo.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The information related to the operation. + public partial class OperationDisplayInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationDisplayInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new OperationDisplayInfo(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal OperationDisplayInfo(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/OperationListResult.PowerShell.cs new file mode 100644 index 000000000000..3fc7eaa369e0 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationListResult.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peering API operations. + [System.ComponentModel.TypeConverter(typeof(OperationListResultTypeConverter))] + public partial class OperationListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peering API operations. + [System.ComponentModel.TypeConverter(typeof(OperationListResultTypeConverter))] + public partial interface IOperationListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/OperationListResult.TypeConverter.cs new file mode 100644 index 000000000000..b246e2b51795 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationListResult.cs b/src/Peering/generated/api/Models/Api20221001/OperationListResult.cs new file mode 100644 index 000000000000..ddbc99b2829b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering API operations. + public partial class OperationListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peering API operations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation[] _value; + + /// The list of peering API operations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public OperationListResult() + { + + } + } + /// The paginated list of peering API operations. + public partial interface IOperationListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peering API operations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peering API operations.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peering API operations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peering API operations.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation[] Value { get; set; } + + } + /// The paginated list of peering API operations. + internal partial interface IOperationListResultInternal + + { + /// The link to fetch the next page of peering API operations. + string NextLink { get; set; } + /// The list of peering API operations. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/OperationListResult.json.cs new file mode 100644 index 000000000000..496d43e5f937 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering API operations. + public partial class OperationListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new OperationListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal OperationListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Operation.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/OperationProperties.PowerShell.cs new file mode 100644 index 000000000000..d2402baa6255 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationProperties.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties of the operation. + [System.ComponentModel.TypeConverter(typeof(OperationPropertiesTypeConverter))] + public partial class OperationProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)this).ServiceSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification) content.GetValueForProperty("ServiceSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)this).ServiceSpecification, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ServiceSpecificationTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceSpecificationMetricSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)this).ServiceSpecificationMetricSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[]) content.GetValueForProperty("ServiceSpecificationMetricSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)this).ServiceSpecificationMetricSpecification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricSpecificationTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)this).ServiceSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification) content.GetValueForProperty("ServiceSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)this).ServiceSpecification, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ServiceSpecificationTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceSpecificationMetricSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)this).ServiceSpecificationMetricSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[]) content.GetValueForProperty("ServiceSpecificationMetricSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal)this).ServiceSpecificationMetricSpecification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricSpecificationTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties of the operation. + [System.ComponentModel.TypeConverter(typeof(OperationPropertiesTypeConverter))] + public partial interface IOperationProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/OperationProperties.TypeConverter.cs new file mode 100644 index 000000000000..9133025410f2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationProperties.cs b/src/Peering/generated/api/Models/Api20221001/OperationProperties.cs new file mode 100644 index 000000000000..e89f41d6c77e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationProperties.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties of the operation. + public partial class OperationProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal + { + + /// Internal Acessors for ServiceSpecification + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal.ServiceSpecification { get => (this._serviceSpecification = this._serviceSpecification ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ServiceSpecification()); set { {_serviceSpecification = value;} } } + + /// Internal Acessors for ServiceSpecificationMetricSpecification + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationPropertiesInternal.ServiceSpecificationMetricSpecification { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecificationInternal)ServiceSpecification).MetricSpecification; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecificationInternal)ServiceSpecification).MetricSpecification = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification _serviceSpecification; + + /// Service specification payload. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification ServiceSpecification { get => (this._serviceSpecification = this._serviceSpecification ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ServiceSpecification()); } + + /// Specifications of the Metrics for Azure Monitoring. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] ServiceSpecificationMetricSpecification { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecificationInternal)ServiceSpecification).MetricSpecification; } + + /// Creates an new instance. + public OperationProperties() + { + + } + } + /// The properties of the operation. + public partial interface IOperationProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// Specifications of the Metrics for Azure Monitoring. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifications of the Metrics for Azure Monitoring.", + SerializedName = @"metricSpecifications", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] ServiceSpecificationMetricSpecification { get; } + + } + /// The properties of the operation. + internal partial interface IOperationPropertiesInternal + + { + /// Service specification payload. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification ServiceSpecification { get; set; } + /// Specifications of the Metrics for Azure Monitoring. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] ServiceSpecificationMetricSpecification { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/OperationProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/OperationProperties.json.cs new file mode 100644 index 000000000000..d9ba2a408be5 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/OperationProperties.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties of the operation. + public partial class OperationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new OperationProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal OperationProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_serviceSpecification = If( json?.PropertyT("serviceSpecification"), out var __jsonServiceSpecification) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ServiceSpecification.FromJson(__jsonServiceSpecification) : ServiceSpecification;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._serviceSpecification ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._serviceSpecification.ToJson(null,serializationMode) : null, "serviceSpecification" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsn.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsn.PowerShell.cs new file mode 100644 index 000000000000..204e64da7e6c --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsn.PowerShell.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The essential information related to the peer's ASN. + [System.ComponentModel.TypeConverter(typeof(PeerAsnTypeConverter))] + public partial class PeerAsn + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeerAsn(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeerAsn(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeerAsn(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).ValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState?) content.GetValueForProperty("ValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).ValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState.CreateFrom); + } + if (content.Contains("PropertiesPeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PropertiesPeerAsn = (int?) content.GetValueForProperty("PropertiesPeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PropertiesPeerAsn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeerContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PeerContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[]) content.GetValueForProperty("PeerContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PeerContactDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("PeerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PeerName = (string) content.GetValueForProperty("PeerName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PeerName, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).ErrorMessage, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeerAsn(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).ValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState?) content.GetValueForProperty("ValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).ValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState.CreateFrom); + } + if (content.Contains("PropertiesPeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PropertiesPeerAsn = (int?) content.GetValueForProperty("PropertiesPeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PropertiesPeerAsn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeerContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PeerContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[]) content.GetValueForProperty("PeerContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PeerContactDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("PeerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PeerName = (string) content.GetValueForProperty("PeerName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).PeerName, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal)this).ErrorMessage, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The essential information related to the peer's ASN. + [System.ComponentModel.TypeConverter(typeof(PeerAsnTypeConverter))] + public partial interface IPeerAsn + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsn.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsn.TypeConverter.cs new file mode 100644 index 000000000000..c356cf9f1401 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsn.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeerAsnTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeerAsn.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeerAsn.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeerAsn.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsn.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsn.cs new file mode 100644 index 000000000000..cf42a6b74174 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsn.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The essential information related to the peer's ASN. + public partial class PeerAsn : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The error message for the validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).ErrorMessage; } + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal.ErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).ErrorMessage = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnProperties()); set { {_property = value;} } } + + /// Internal Acessors for ValidationState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnInternal.ValidationState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).ValidationState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).ValidationState = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The contact details of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 4)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[] PeerContactDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).PeerContactDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).PeerContactDetail = value ?? null /* arrayOf */; } + + /// The name of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string PeerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).PeerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).PeerName = value ?? null; } + + /// The Autonomous System Number (ASN) of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public int? PropertiesPeerAsn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).PeerAsn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).PeerAsn = value ?? default(int); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties _property; + + /// The properties that define a peer's ASN. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnProperties()); set => this._property = value; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// The validation state of the ASN associated with the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 3)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState? ValidationState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)Property).ValidationState; } + + /// Creates an new instance. + public PeerAsn() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The essential information related to the peer's ASN. + public partial interface IPeerAsn : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The error message for the validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message for the validation state", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The contact details of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The contact details of the peer.", + SerializedName = @"peerContactDetail", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[] PeerContactDetail { get; set; } + /// The name of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peer.", + SerializedName = @"peerName", + PossibleTypes = new [] { typeof(string) })] + string PeerName { get; set; } + /// The Autonomous System Number (ASN) of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Autonomous System Number (ASN) of the peer.", + SerializedName = @"peerAsn", + PossibleTypes = new [] { typeof(int) })] + int? PropertiesPeerAsn { get; set; } + /// The validation state of the ASN associated with the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The validation state of the ASN associated with the peer.", + SerializedName = @"validationState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState? ValidationState { get; } + + } + /// The essential information related to the peer's ASN. + internal partial interface IPeerAsnInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The error message for the validation state + string ErrorMessage { get; set; } + /// The contact details of the peer. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[] PeerContactDetail { get; set; } + /// The name of the peer. + string PeerName { get; set; } + /// The Autonomous System Number (ASN) of the peer. + int? PropertiesPeerAsn { get; set; } + /// The properties that define a peer's ASN. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties Property { get; set; } + /// The validation state of the ASN associated with the peer. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState? ValidationState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsn.json.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsn.json.cs new file mode 100644 index 000000000000..a6349b35bfc2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsn.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The essential information related to the peer's ASN. + public partial class PeerAsn + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeerAsn(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeerAsn(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.PowerShell.cs new file mode 100644 index 000000000000..becc4627485f --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peer ASNs. + [System.ComponentModel.TypeConverter(typeof(PeerAsnListResultTypeConverter))] + public partial class PeerAsnListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeerAsnListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeerAsnListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeerAsnListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeerAsnListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peer ASNs. + [System.ComponentModel.TypeConverter(typeof(PeerAsnListResultTypeConverter))] + public partial interface IPeerAsnListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.TypeConverter.cs new file mode 100644 index 000000000000..00e44925d9be --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeerAsnListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeerAsnListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeerAsnListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeerAsnListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.cs new file mode 100644 index 000000000000..45da8950a4d5 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peer ASNs. + public partial class PeerAsnListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peer ASNs. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn[] _value; + + /// The list of peer ASNs. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeerAsnListResult() + { + + } + } + /// The paginated list of peer ASNs. + public partial interface IPeerAsnListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peer ASNs. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peer ASNs.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peer ASNs. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peer ASNs.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn[] Value { get; set; } + + } + /// The paginated list of peer ASNs. + internal partial interface IPeerAsnListResultInternal + + { + /// The link to fetch the next page of peer ASNs. + string NextLink { get; set; } + /// The list of peer ASNs. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.json.cs new file mode 100644 index 000000000000..f50fc640105a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsnListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peer ASNs. + public partial class PeerAsnListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeerAsnListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeerAsnListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsn.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.PowerShell.cs new file mode 100644 index 000000000000..a90d73438296 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a peer's ASN. + [System.ComponentModel.TypeConverter(typeof(PeerAsnPropertiesTypeConverter))] + public partial class PeerAsnProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeerAsnProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeerAsnProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeerAsnProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerAsn = (int?) content.GetValueForProperty("PeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerAsn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeerContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[]) content.GetValueForProperty("PeerContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerContactDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("PeerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerName = (string) content.GetValueForProperty("PeerName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerName, global::System.Convert.ToString); + } + if (content.Contains("ValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).ValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState?) content.GetValueForProperty("ValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).ValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState.CreateFrom); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).ErrorMessage, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeerAsnProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerAsn = (int?) content.GetValueForProperty("PeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerAsn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeerContactDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerContactDetail = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[]) content.GetValueForProperty("PeerContactDetail",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerContactDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("PeerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerName = (string) content.GetValueForProperty("PeerName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).PeerName, global::System.Convert.ToString); + } + if (content.Contains("ValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).ValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState?) content.GetValueForProperty("ValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).ValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState.CreateFrom); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal)this).ErrorMessage, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a peer's ASN. + [System.ComponentModel.TypeConverter(typeof(PeerAsnPropertiesTypeConverter))] + public partial interface IPeerAsnProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.TypeConverter.cs new file mode 100644 index 000000000000..ec7d94f67c18 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeerAsnPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeerAsnProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeerAsnProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeerAsnProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.cs new file mode 100644 index 000000000000..1a4a721784f8 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a peer's ASN. + public partial class PeerAsnProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal + { + + /// Backing field for property. + private string _errorMessage; + + /// The error message for the validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Internal Acessors for ValidationState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnPropertiesInternal.ValidationState { get => this._validationState; set { {_validationState = value;} } } + + /// Backing field for property. + private int? _peerAsn; + + /// The Autonomous System Number (ASN) of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? PeerAsn { get => this._peerAsn; set => this._peerAsn = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[] _peerContactDetail; + + /// The contact details of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[] PeerContactDetail { get => this._peerContactDetail; set => this._peerContactDetail = value; } + + /// Backing field for property. + private string _peerName; + + /// The name of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeerName { get => this._peerName; set => this._peerName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState? _validationState; + + /// The validation state of the ASN associated with the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState? ValidationState { get => this._validationState; } + + /// Creates an new instance. + public PeerAsnProperties() + { + + } + } + /// The properties that define a peer's ASN. + public partial interface IPeerAsnProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The error message for the validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message for the validation state", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The Autonomous System Number (ASN) of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Autonomous System Number (ASN) of the peer.", + SerializedName = @"peerAsn", + PossibleTypes = new [] { typeof(int) })] + int? PeerAsn { get; set; } + /// The contact details of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The contact details of the peer.", + SerializedName = @"peerContactDetail", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[] PeerContactDetail { get; set; } + /// The name of the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peer.", + SerializedName = @"peerName", + PossibleTypes = new [] { typeof(string) })] + string PeerName { get; set; } + /// The validation state of the ASN associated with the peer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The validation state of the ASN associated with the peer.", + SerializedName = @"validationState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState? ValidationState { get; } + + } + /// The properties that define a peer's ASN. + internal partial interface IPeerAsnPropertiesInternal + + { + /// The error message for the validation state + string ErrorMessage { get; set; } + /// The Autonomous System Number (ASN) of the peer. + int? PeerAsn { get; set; } + /// The contact details of the peer. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[] PeerContactDetail { get; set; } + /// The name of the peer. + string PeerName { get; set; } + /// The validation state of the ASN associated with the peer. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState? ValidationState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.json.cs new file mode 100644 index 000000000000..fa26b4bf79e1 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeerAsnProperties.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a peer's ASN. + public partial class PeerAsnProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeerAsnProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeerAsnProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_peerAsn = If( json?.PropertyT("peerAsn"), out var __jsonPeerAsn) ? (int?)__jsonPeerAsn : PeerAsn;} + {_peerContactDetail = If( json?.PropertyT("peerContactDetail"), out var __jsonPeerContactDetail) ? If( __jsonPeerContactDetail as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail.FromJson(__u) )) ))() : null : PeerContactDetail;} + {_peerName = If( json?.PropertyT("peerName"), out var __jsonPeerName) ? (string)__jsonPeerName : (string)PeerName;} + {_validationState = If( json?.PropertyT("validationState"), out var __jsonValidationState) ? (string)__jsonValidationState : (string)ValidationState;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._peerAsn ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._peerAsn) : null, "peerAsn" ,container.Add ); + if (null != this._peerContactDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._peerContactDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("peerContactDetail",__w); + } + AddIf( null != (((object)this._peerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peerName.ToString()) : null, "peerName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._validationState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._validationState.ToString()) : null, "validationState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Peering.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/Peering.PowerShell.cs new file mode 100644 index 000000000000..d9b325fdd335 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Peering.PowerShell.cs @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// Peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + /// + [System.ComponentModel.TypeConverter(typeof(PeeringTypeConverter))] + public partial class Peering + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Peering(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Peering(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Peering(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringSkuTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Kind = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Kind, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind.CreateFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SkuTier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuTier = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier?) content.GetValueForProperty("SkuTier",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuTier, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier.CreateFrom); + } + if (content.Contains("SkuFamily")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuFamily = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family?) content.GetValueForProperty("SkuFamily",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuFamily, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family.CreateFrom); + } + if (content.Contains("SkuSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuSize = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size?) content.GetValueForProperty("SkuSize",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuSize, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Direct")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Direct = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect) content.GetValueForProperty("Direct",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Direct, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesDirectTypeConverter.ConvertFrom); + } + if (content.Contains("Exchange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Exchange = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange) content.GetValueForProperty("Exchange",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Exchange, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesExchangeTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).PeeringLocation = (string) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).PeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("DirectPeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("DirectPeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("DirectConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectConnection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[]) content.GetValueForProperty("DirectConnection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectConnection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectUseForPeeringService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectUseForPeeringService = (bool?) content.GetValueForProperty("DirectUseForPeeringService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectUseForPeeringService, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DirectPeeringType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeeringType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType?) content.GetValueForProperty("DirectPeeringType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeeringType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType.CreateFrom); + } + if (content.Contains("ExchangePeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangePeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("ExchangePeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangePeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("ExchangeConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangeConnection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[]) content.GetValueForProperty("ExchangeConnection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangeConnection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectPeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeerAsnId = (string) content.GetValueForProperty("DirectPeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeerAsnId, global::System.Convert.ToString); + } + if (content.Contains("ExchangePeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangePeerAsnId = (string) content.GetValueForProperty("ExchangePeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangePeerAsnId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Peering(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringSkuTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Kind = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Kind, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind.CreateFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SkuTier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuTier = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier?) content.GetValueForProperty("SkuTier",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuTier, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier.CreateFrom); + } + if (content.Contains("SkuFamily")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuFamily = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family?) content.GetValueForProperty("SkuFamily",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuFamily, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family.CreateFrom); + } + if (content.Contains("SkuSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuSize = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size?) content.GetValueForProperty("SkuSize",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuSize, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("Direct")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Direct = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect) content.GetValueForProperty("Direct",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Direct, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesDirectTypeConverter.ConvertFrom); + } + if (content.Contains("Exchange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Exchange = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange) content.GetValueForProperty("Exchange",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).Exchange, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesExchangeTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).PeeringLocation = (string) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).PeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("DirectPeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("DirectPeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("DirectConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectConnection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[]) content.GetValueForProperty("DirectConnection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectConnection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectUseForPeeringService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectUseForPeeringService = (bool?) content.GetValueForProperty("DirectUseForPeeringService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectUseForPeeringService, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DirectPeeringType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeeringType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType?) content.GetValueForProperty("DirectPeeringType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeeringType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType.CreateFrom); + } + if (content.Contains("ExchangePeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangePeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("ExchangePeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangePeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("ExchangeConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangeConnection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[]) content.GetValueForProperty("ExchangeConnection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangeConnection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectPeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeerAsnId = (string) content.GetValueForProperty("DirectPeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).DirectPeerAsnId, global::System.Convert.ToString); + } + if (content.Contains("ExchangePeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangePeerAsnId = (string) content.GetValueForProperty("ExchangePeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal)this).ExchangePeerAsnId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + [System.ComponentModel.TypeConverter(typeof(PeeringTypeConverter))] + public partial interface IPeering + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Peering.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/Peering.TypeConverter.cs new file mode 100644 index 000000000000..6291f02cdd26 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Peering.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Peering.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Peering.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Peering.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Peering.cs b/src/Peering/generated/api/Models/Api20221001/Peering.cs new file mode 100644 index 000000000000..1e91f9c78dc4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Peering.cs @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// + /// Peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + /// + public partial class Peering : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The set of connections that constitute a direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] DirectConnection { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectConnection; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectConnection = value ?? null /* arrayOf */; } + + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string DirectPeerAsnId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectPeerAsnId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectPeerAsnId = value ?? null; } + + /// The type of direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectPeeringType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectPeeringType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType)""); } + + /// The flag that indicates whether or not the peering is used for peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public bool? DirectUseForPeeringService { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectUseForPeeringService; } + + /// The set of connections that constitute an exchange peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] ExchangeConnection { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).ExchangeConnection; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).ExchangeConnection = value ?? null /* arrayOf */; } + + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ExchangePeerAsnId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).ExchangePeerAsnId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).ExchangePeerAsnId = value ?? null; } + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind _kind; + + /// The kind of the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind Kind { get => this._kind; set => this._kind = value; } + + /// Backing field for property. + private string _location; + + /// The location of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 5)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Direct + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.Direct { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).Direct; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).Direct = value; } + + /// Internal Acessors for DirectPeerAsn + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.DirectPeerAsn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectPeerAsn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectPeerAsn = value; } + + /// Internal Acessors for DirectUseForPeeringService + bool? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.DirectUseForPeeringService { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectUseForPeeringService; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).DirectUseForPeeringService = value; } + + /// Internal Acessors for Exchange + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.Exchange { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).Exchange; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).Exchange = value; } + + /// Internal Acessors for ExchangePeerAsn + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.ExchangePeerAsn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).ExchangePeerAsn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).ExchangePeerAsn = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Sku + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringSku()); set { {_sku = value;} } } + + /// Internal Acessors for SkuFamily + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.SkuFamily { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Family; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Family = value; } + + /// Internal Acessors for SkuSize + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.SkuSize { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Size; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Size = value; } + + /// Internal Acessors for SkuTier + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringInternal.SkuTier { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Tier; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Tier = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The location of the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 3)] + public string PeeringLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).PeeringLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).PeeringLocation = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties _property; + + /// The properties that define a peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringProperties()); set => this._property = value; } + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 4)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku _sku; + + /// The SKU that defines the tier and kind of the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringSku()); set => this._sku = value; } + + /// The family of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family? SkuFamily { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Family; } + + /// The name of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Name = value ?? null; } + + /// The size of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size? SkuSize { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Size; } + + /// The tier of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier? SkuTier { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)Sku).Tier; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags _tag; + + /// The resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringTags()); set => this._tag = value; } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public Peering() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + public partial interface IPeering : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The set of connections that constitute a direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The set of connections that constitute a direct peering.", + SerializedName = @"connections", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] DirectConnection { get; set; } + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identifier of the referenced resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string DirectPeerAsnId { get; set; } + /// The type of direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of direct peering.", + SerializedName = @"directPeeringType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get; set; } + /// The flag that indicates whether or not the peering is used for peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The flag that indicates whether or not the peering is used for peering service.", + SerializedName = @"useForPeeringService", + PossibleTypes = new [] { typeof(bool) })] + bool? DirectUseForPeeringService { get; } + /// The set of connections that constitute an exchange peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The set of connections that constitute an exchange peering.", + SerializedName = @"connections", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] ExchangeConnection { get; set; } + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identifier of the referenced resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string ExchangePeerAsnId { get; set; } + /// The kind of the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The kind of the peering.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind Kind { get; set; } + /// The location of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The location of the resource.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// The location of the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The location of the peering.", + SerializedName = @"peeringLocation", + PossibleTypes = new [] { typeof(string) })] + string PeeringLocation { get; set; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + /// The family of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The family of the peering SKU.", + SerializedName = @"family", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family? SkuFamily { get; } + /// The name of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering SKU.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string SkuName { get; set; } + /// The size of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The size of the peering SKU.", + SerializedName = @"size", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size? SkuSize { get; } + /// The tier of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tier of the peering SKU.", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier? SkuTier { get; } + /// The resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags Tag { get; set; } + + } + /// Peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + internal partial interface IPeeringInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The properties that define a direct peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect Direct { get; set; } + /// The set of connections that constitute a direct peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] DirectConnection { get; set; } + /// The reference of the peer ASN. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource DirectPeerAsn { get; set; } + /// The identifier of the referenced resource. + string DirectPeerAsnId { get; set; } + /// The type of direct peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get; set; } + /// The flag that indicates whether or not the peering is used for peering service. + bool? DirectUseForPeeringService { get; set; } + /// The properties that define an exchange peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange Exchange { get; set; } + /// The set of connections that constitute an exchange peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] ExchangeConnection { get; set; } + /// The reference of the peer ASN. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource ExchangePeerAsn { get; set; } + /// The identifier of the referenced resource. + string ExchangePeerAsnId { get; set; } + /// The kind of the peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind Kind { get; set; } + /// The location of the resource. + string Location { get; set; } + /// The location of the peering. + string PeeringLocation { get; set; } + /// The properties that define a peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties Property { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + /// The SKU that defines the tier and kind of the peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku Sku { get; set; } + /// The family of the peering SKU. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family? SkuFamily { get; set; } + /// The name of the peering SKU. + string SkuName { get; set; } + /// The size of the peering SKU. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size? SkuSize { get; set; } + /// The tier of the peering SKU. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier? SkuTier { get; set; } + /// The resource tags. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Peering.json.cs b/src/Peering/generated/api/Models/Api20221001/Peering.json.cs new file mode 100644 index 000000000000..3ee94efd9e71 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Peering.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// + /// Peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + /// + public partial class Peering + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new Peering(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal Peering(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringSku.FromJson(__jsonSku) : Sku;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringProperties.FromJson(__jsonProperties) : Property;} + {_kind = If( json?.PropertyT("kind"), out var __jsonKind) ? (string)__jsonKind : (string)Kind;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._sku ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._sku.ToJson(null,serializationMode) : null, "sku" ,container.Add ); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._kind)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._kind.ToString()) : null, "kind" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.PowerShell.cs new file mode 100644 index 000000000000..9a590c32a6c0 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a peering bandwidth offer. + [System.ComponentModel.TypeConverter(typeof(PeeringBandwidthOfferTypeConverter))] + public partial class PeeringBandwidthOffer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringBandwidthOffer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringBandwidthOffer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringBandwidthOffer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOfferInternal)this).OfferName = (string) content.GetValueForProperty("OfferName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOfferInternal)this).OfferName, global::System.Convert.ToString); + } + if (content.Contains("ValueInMbps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOfferInternal)this).ValueInMbps = (int?) content.GetValueForProperty("ValueInMbps",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOfferInternal)this).ValueInMbps, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringBandwidthOffer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOfferInternal)this).OfferName = (string) content.GetValueForProperty("OfferName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOfferInternal)this).OfferName, global::System.Convert.ToString); + } + if (content.Contains("ValueInMbps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOfferInternal)this).ValueInMbps = (int?) content.GetValueForProperty("ValueInMbps",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOfferInternal)this).ValueInMbps, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a peering bandwidth offer. + [System.ComponentModel.TypeConverter(typeof(PeeringBandwidthOfferTypeConverter))] + public partial interface IPeeringBandwidthOffer + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.TypeConverter.cs new file mode 100644 index 000000000000..dd3ebab68869 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringBandwidthOfferTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringBandwidthOffer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringBandwidthOffer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringBandwidthOffer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.cs b/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.cs new file mode 100644 index 000000000000..617cb08304bc --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a peering bandwidth offer. + public partial class PeeringBandwidthOffer : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOfferInternal + { + + /// Backing field for property. + private string _offerName; + + /// The name of the bandwidth offer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string OfferName { get => this._offerName; set => this._offerName = value; } + + /// Backing field for property. + private int? _valueInMbps; + + /// The value of the bandwidth offer in Mbps. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? ValueInMbps { get => this._valueInMbps; set => this._valueInMbps = value; } + + /// Creates an new instance. + public PeeringBandwidthOffer() + { + + } + } + /// The properties that define a peering bandwidth offer. + public partial interface IPeeringBandwidthOffer : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The name of the bandwidth offer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the bandwidth offer.", + SerializedName = @"offerName", + PossibleTypes = new [] { typeof(string) })] + string OfferName { get; set; } + /// The value of the bandwidth offer in Mbps. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of the bandwidth offer in Mbps.", + SerializedName = @"valueInMbps", + PossibleTypes = new [] { typeof(int) })] + int? ValueInMbps { get; set; } + + } + /// The properties that define a peering bandwidth offer. + internal partial interface IPeeringBandwidthOfferInternal + + { + /// The name of the bandwidth offer. + string OfferName { get; set; } + /// The value of the bandwidth offer in Mbps. + int? ValueInMbps { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.json.cs new file mode 100644 index 000000000000..a2abfc1a3053 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringBandwidthOffer.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a peering bandwidth offer. + public partial class PeeringBandwidthOffer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringBandwidthOffer(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringBandwidthOffer(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_offerName = If( json?.PropertyT("offerName"), out var __jsonOfferName) ? (string)__jsonOfferName : (string)OfferName;} + {_valueInMbps = If( json?.PropertyT("valueInMbps"), out var __jsonValueInMbps) ? (int?)__jsonValueInMbps : ValueInMbps;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._offerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._offerName.ToString()) : null, "offerName" ,container.Add ); + AddIf( null != this._valueInMbps ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._valueInMbps) : null, "valueInMbps" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringListResult.PowerShell.cs new file mode 100644 index 000000000000..941c21c3744e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringListResult.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peerings. + [System.ComponentModel.TypeConverter(typeof(PeeringListResultTypeConverter))] + public partial class PeeringListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peerings. + [System.ComponentModel.TypeConverter(typeof(PeeringListResultTypeConverter))] + public partial interface IPeeringListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringListResult.TypeConverter.cs new file mode 100644 index 000000000000..b2557e885df8 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringListResult.cs new file mode 100644 index 000000000000..ef2001cbfb11 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peerings. + public partial class PeeringListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peerings. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering[] _value; + + /// The list of peerings. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringListResult() + { + + } + } + /// The paginated list of peerings. + public partial interface IPeeringListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peerings. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peerings.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peerings. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peerings.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering[] Value { get; set; } + + } + /// The paginated list of peerings. + internal partial interface IPeeringListResultInternal + + { + /// The link to fetch the next page of peerings. + string NextLink { get; set; } + /// The list of peerings. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringListResult.json.cs new file mode 100644 index 000000000000..d58d1df7ae2d --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peerings. + public partial class PeeringListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Peering.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocation.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocation.PowerShell.cs new file mode 100644 index 000000000000..23c9b4b3ba66 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocation.PowerShell.cs @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// Peering location is where connectivity could be established to the Microsoft Cloud Edge. + /// + [System.ComponentModel.TypeConverter(typeof(PeeringLocationTypeConverter))] + public partial class PeeringLocation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringLocation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringLocation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringLocation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Kind = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind?) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Kind, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind.CreateFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Direct")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Direct = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect) content.GetValueForProperty("Direct",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Direct, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesDirectTypeConverter.ConvertFrom); + } + if (content.Contains("Exchange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Exchange = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange) content.GetValueForProperty("Exchange",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Exchange, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesExchangeTypeConverter.ConvertFrom); + } + if (content.Contains("PropertiesPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).PropertiesPeeringLocation = (string) content.GetValueForProperty("PropertiesPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).PropertiesPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("DirectPeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).DirectPeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[]) content.GetValueForProperty("DirectPeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).DirectPeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectPeeringFacilityTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectBandwidthOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).DirectBandwidthOffer = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[]) content.GetValueForProperty("DirectBandwidthOffer",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).DirectBandwidthOffer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringBandwidthOfferTypeConverter.ConvertFrom)); + } + if (content.Contains("ExchangePeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).ExchangePeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[]) content.GetValueForProperty("ExchangePeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).ExchangePeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangePeeringFacilityTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringLocation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Kind = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind?) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Kind, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind.CreateFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Direct")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Direct = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect) content.GetValueForProperty("Direct",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Direct, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesDirectTypeConverter.ConvertFrom); + } + if (content.Contains("Exchange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Exchange = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange) content.GetValueForProperty("Exchange",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Exchange, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesExchangeTypeConverter.ConvertFrom); + } + if (content.Contains("PropertiesPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).PropertiesPeeringLocation = (string) content.GetValueForProperty("PropertiesPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).PropertiesPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("DirectPeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).DirectPeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[]) content.GetValueForProperty("DirectPeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).DirectPeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectPeeringFacilityTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectBandwidthOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).DirectBandwidthOffer = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[]) content.GetValueForProperty("DirectBandwidthOffer",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).DirectBandwidthOffer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringBandwidthOfferTypeConverter.ConvertFrom)); + } + if (content.Contains("ExchangePeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).ExchangePeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[]) content.GetValueForProperty("ExchangePeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal)this).ExchangePeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangePeeringFacilityTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Peering location is where connectivity could be established to the Microsoft Cloud Edge. + [System.ComponentModel.TypeConverter(typeof(PeeringLocationTypeConverter))] + public partial interface IPeeringLocation + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocation.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocation.TypeConverter.cs new file mode 100644 index 000000000000..781789472f64 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocation.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringLocationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringLocation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringLocation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringLocation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocation.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocation.cs new file mode 100644 index 000000000000..a3475ef08e30 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocation.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// + /// Peering location is where connectivity could be established to the Microsoft Cloud Edge. + /// + public partial class PeeringLocation : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The Azure region associated with the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public string AzureRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).AzureRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).AzureRegion = value ?? null; } + + /// The country in which the peering location exists. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).Country = value ?? null; } + + /// The list of bandwidth offers available at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] DirectBandwidthOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).DirectBandwidthOffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).DirectBandwidthOffer = value ?? null /* arrayOf */; } + + /// The list of direct peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] DirectPeeringFacility { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).DirectPeeringFacility; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).DirectPeeringFacility = value ?? null /* arrayOf */; } + + /// The list of exchange peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] ExchangePeeringFacility { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).ExchangePeeringFacility; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).ExchangePeeringFacility = value ?? null /* arrayOf */; } + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind? _kind; + + /// The kind of peering that the peering location supports. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 3)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind? Kind { get => this._kind; set => this._kind = value; } + + /// Internal Acessors for Direct + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal.Direct { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).Direct; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).Direct = value; } + + /// Internal Acessors for Exchange + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal.Exchange { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).Exchange; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).Exchange = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The name of the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string PropertiesPeeringLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).PeeringLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)Property).PeeringLocation = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties _property; + + /// The properties that define a peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationProperties()); set => this._property = value; } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public PeeringLocation() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Peering location is where connectivity could be established to the Microsoft Cloud Edge. + public partial interface IPeeringLocation : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The Azure region associated with the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure region associated with the peering location.", + SerializedName = @"azureRegion", + PossibleTypes = new [] { typeof(string) })] + string AzureRegion { get; set; } + /// The country in which the peering location exists. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country in which the peering location exists.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// The list of bandwidth offers available at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of bandwidth offers available at the peering location.", + SerializedName = @"bandwidthOffers", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] DirectBandwidthOffer { get; set; } + /// The list of direct peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of direct peering facilities at the peering location.", + SerializedName = @"peeringFacilities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] DirectPeeringFacility { get; set; } + /// The list of exchange peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of exchange peering facilities at the peering location.", + SerializedName = @"peeringFacilities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] ExchangePeeringFacility { get; set; } + /// The kind of peering that the peering location supports. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The kind of peering that the peering location supports.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind? Kind { get; set; } + /// The name of the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering location.", + SerializedName = @"peeringLocation", + PossibleTypes = new [] { typeof(string) })] + string PropertiesPeeringLocation { get; set; } + + } + /// Peering location is where connectivity could be established to the Microsoft Cloud Edge. + internal partial interface IPeeringLocationInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The Azure region associated with the peering location. + string AzureRegion { get; set; } + /// The country in which the peering location exists. + string Country { get; set; } + /// The properties that define a direct peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect Direct { get; set; } + /// The list of bandwidth offers available at the peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] DirectBandwidthOffer { get; set; } + /// The list of direct peering facilities at the peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] DirectPeeringFacility { get; set; } + /// The properties that define an exchange peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange Exchange { get; set; } + /// The list of exchange peering facilities at the peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] ExchangePeeringFacility { get; set; } + /// The kind of peering that the peering location supports. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind? Kind { get; set; } + /// The name of the peering location. + string PropertiesPeeringLocation { get; set; } + /// The properties that define a peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocation.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocation.json.cs new file mode 100644 index 000000000000..6725496f7e12 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocation.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// + /// Peering location is where connectivity could be established to the Microsoft Cloud Edge. + /// + public partial class PeeringLocation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringLocation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringLocation(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationProperties.FromJson(__jsonProperties) : Property;} + {_kind = If( json?.PropertyT("kind"), out var __jsonKind) ? (string)__jsonKind : (string)Kind;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._kind)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._kind.ToString()) : null, "kind" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.PowerShell.cs new file mode 100644 index 000000000000..e9a4c81f90c2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peering locations. + [System.ComponentModel.TypeConverter(typeof(PeeringLocationListResultTypeConverter))] + public partial class PeeringLocationListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringLocationListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringLocationListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringLocationListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringLocationListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peering locations. + [System.ComponentModel.TypeConverter(typeof(PeeringLocationListResultTypeConverter))] + public partial interface IPeeringLocationListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.TypeConverter.cs new file mode 100644 index 000000000000..ea5ac3a6e0ee --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringLocationListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringLocationListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringLocationListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringLocationListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.cs new file mode 100644 index 000000000000..7ed7ced71a6f --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering locations. + public partial class PeeringLocationListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peering locations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation[] _value; + + /// The list of peering locations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringLocationListResult() + { + + } + } + /// The paginated list of peering locations. + public partial interface IPeeringLocationListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peering locations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peering locations.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peering locations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peering locations.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation[] Value { get; set; } + + } + /// The paginated list of peering locations. + internal partial interface IPeeringLocationListResultInternal + + { + /// The link to fetch the next page of peering locations. + string NextLink { get; set; } + /// The list of peering locations. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.json.cs new file mode 100644 index 000000000000..d9f7ae9a58c6 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering locations. + public partial class PeeringLocationListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringLocationListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringLocationListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocation.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.PowerShell.cs new file mode 100644 index 000000000000..16d5f2ee1d0e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.PowerShell.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a peering location. + [System.ComponentModel.TypeConverter(typeof(PeeringLocationPropertiesTypeConverter))] + public partial class PeeringLocationProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringLocationProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringLocationProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringLocationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Direct")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Direct = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect) content.GetValueForProperty("Direct",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Direct, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesDirectTypeConverter.ConvertFrom); + } + if (content.Contains("Exchange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Exchange = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange) content.GetValueForProperty("Exchange",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Exchange, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesExchangeTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).PeeringLocation = (string) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).PeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("DirectPeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).DirectPeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[]) content.GetValueForProperty("DirectPeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).DirectPeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectPeeringFacilityTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectBandwidthOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).DirectBandwidthOffer = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[]) content.GetValueForProperty("DirectBandwidthOffer",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).DirectBandwidthOffer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringBandwidthOfferTypeConverter.ConvertFrom)); + } + if (content.Contains("ExchangePeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).ExchangePeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[]) content.GetValueForProperty("ExchangePeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).ExchangePeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangePeeringFacilityTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringLocationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Direct")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Direct = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect) content.GetValueForProperty("Direct",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Direct, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesDirectTypeConverter.ConvertFrom); + } + if (content.Contains("Exchange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Exchange = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange) content.GetValueForProperty("Exchange",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Exchange, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesExchangeTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).PeeringLocation = (string) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).PeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("DirectPeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).DirectPeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[]) content.GetValueForProperty("DirectPeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).DirectPeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectPeeringFacilityTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectBandwidthOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).DirectBandwidthOffer = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[]) content.GetValueForProperty("DirectBandwidthOffer",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).DirectBandwidthOffer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringBandwidthOfferTypeConverter.ConvertFrom)); + } + if (content.Contains("ExchangePeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).ExchangePeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[]) content.GetValueForProperty("ExchangePeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal)this).ExchangePeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangePeeringFacilityTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a peering location. + [System.ComponentModel.TypeConverter(typeof(PeeringLocationPropertiesTypeConverter))] + public partial interface IPeeringLocationProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.TypeConverter.cs new file mode 100644 index 000000000000..b254208075bb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringLocationPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringLocationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringLocationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringLocationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.cs new file mode 100644 index 000000000000..faa4bd93d857 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a peering location. + public partial class PeeringLocationProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal + { + + /// Backing field for property. + private string _azureRegion; + + /// The Azure region associated with the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string AzureRegion { get => this._azureRegion; set => this._azureRegion = value; } + + /// Backing field for property. + private string _country; + + /// The country in which the peering location exists. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Country { get => this._country; set => this._country = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect _direct; + + /// The properties that define a direct peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect Direct { get => (this._direct = this._direct ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesDirect()); set => this._direct = value; } + + /// The list of bandwidth offers available at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] DirectBandwidthOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)Direct).BandwidthOffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)Direct).BandwidthOffer = value ?? null /* arrayOf */; } + + /// The list of direct peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] DirectPeeringFacility { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)Direct).PeeringFacility; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)Direct).PeeringFacility = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange _exchange; + + /// The properties that define an exchange peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange Exchange { get => (this._exchange = this._exchange ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesExchange()); set => this._exchange = value; } + + /// The list of exchange peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] ExchangePeeringFacility { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchangeInternal)Exchange).PeeringFacility; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchangeInternal)Exchange).PeeringFacility = value ?? null /* arrayOf */; } + + /// Internal Acessors for Direct + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal.Direct { get => (this._direct = this._direct ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesDirect()); set { {_direct = value;} } } + + /// Internal Acessors for Exchange + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesInternal.Exchange { get => (this._exchange = this._exchange ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesExchange()); set { {_exchange = value;} } } + + /// Backing field for property. + private string _peeringLocation; + + /// The name of the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringLocation { get => this._peeringLocation; set => this._peeringLocation = value; } + + /// Creates an new instance. + public PeeringLocationProperties() + { + + } + } + /// The properties that define a peering location. + public partial interface IPeeringLocationProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The Azure region associated with the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure region associated with the peering location.", + SerializedName = @"azureRegion", + PossibleTypes = new [] { typeof(string) })] + string AzureRegion { get; set; } + /// The country in which the peering location exists. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country in which the peering location exists.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// The list of bandwidth offers available at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of bandwidth offers available at the peering location.", + SerializedName = @"bandwidthOffers", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] DirectBandwidthOffer { get; set; } + /// The list of direct peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of direct peering facilities at the peering location.", + SerializedName = @"peeringFacilities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] DirectPeeringFacility { get; set; } + /// The list of exchange peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of exchange peering facilities at the peering location.", + SerializedName = @"peeringFacilities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] ExchangePeeringFacility { get; set; } + /// The name of the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering location.", + SerializedName = @"peeringLocation", + PossibleTypes = new [] { typeof(string) })] + string PeeringLocation { get; set; } + + } + /// The properties that define a peering location. + internal partial interface IPeeringLocationPropertiesInternal + + { + /// The Azure region associated with the peering location. + string AzureRegion { get; set; } + /// The country in which the peering location exists. + string Country { get; set; } + /// The properties that define a direct peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect Direct { get; set; } + /// The list of bandwidth offers available at the peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] DirectBandwidthOffer { get; set; } + /// The list of direct peering facilities at the peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] DirectPeeringFacility { get; set; } + /// The properties that define an exchange peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange Exchange { get; set; } + /// The list of exchange peering facilities at the peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] ExchangePeeringFacility { get; set; } + /// The name of the peering location. + string PeeringLocation { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.json.cs new file mode 100644 index 000000000000..8e9b4f305489 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationProperties.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a peering location. + public partial class PeeringLocationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringLocationProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringLocationProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_direct = If( json?.PropertyT("direct"), out var __jsonDirect) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesDirect.FromJson(__jsonDirect) : Direct;} + {_exchange = If( json?.PropertyT("exchange"), out var __jsonExchange) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationPropertiesExchange.FromJson(__jsonExchange) : Exchange;} + {_peeringLocation = If( json?.PropertyT("peeringLocation"), out var __jsonPeeringLocation) ? (string)__jsonPeeringLocation : (string)PeeringLocation;} + {_country = If( json?.PropertyT("country"), out var __jsonCountry) ? (string)__jsonCountry : (string)Country;} + {_azureRegion = If( json?.PropertyT("azureRegion"), out var __jsonAzureRegion) ? (string)__jsonAzureRegion : (string)AzureRegion;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._direct ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._direct.ToJson(null,serializationMode) : null, "direct" ,container.Add ); + AddIf( null != this._exchange ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._exchange.ToJson(null,serializationMode) : null, "exchange" ,container.Add ); + AddIf( null != (((object)this._peeringLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringLocation.ToString()) : null, "peeringLocation" ,container.Add ); + AddIf( null != (((object)this._country)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._country.ToString()) : null, "country" ,container.Add ); + AddIf( null != (((object)this._azureRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._azureRegion.ToString()) : null, "azureRegion" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.PowerShell.cs new file mode 100644 index 000000000000..5d6cc7b4b186 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a direct peering location. + [System.ComponentModel.TypeConverter(typeof(PeeringLocationPropertiesDirectTypeConverter))] + public partial class PeeringLocationPropertiesDirect + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringLocationPropertiesDirect(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringLocationPropertiesDirect(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringLocationPropertiesDirect(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)this).PeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[]) content.GetValueForProperty("PeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)this).PeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectPeeringFacilityTypeConverter.ConvertFrom)); + } + if (content.Contains("BandwidthOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)this).BandwidthOffer = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[]) content.GetValueForProperty("BandwidthOffer",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)this).BandwidthOffer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringBandwidthOfferTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringLocationPropertiesDirect(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)this).PeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[]) content.GetValueForProperty("PeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)this).PeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectPeeringFacilityTypeConverter.ConvertFrom)); + } + if (content.Contains("BandwidthOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)this).BandwidthOffer = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[]) content.GetValueForProperty("BandwidthOffer",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal)this).BandwidthOffer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringBandwidthOfferTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a direct peering location. + [System.ComponentModel.TypeConverter(typeof(PeeringLocationPropertiesDirectTypeConverter))] + public partial interface IPeeringLocationPropertiesDirect + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.TypeConverter.cs new file mode 100644 index 000000000000..4f2797ce4134 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringLocationPropertiesDirectTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringLocationPropertiesDirect.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringLocationPropertiesDirect.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringLocationPropertiesDirect.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.cs new file mode 100644 index 000000000000..e4174441c675 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a direct peering location. + public partial class PeeringLocationPropertiesDirect : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirectInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] _bandwidthOffer; + + /// The list of bandwidth offers available at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] BandwidthOffer { get => this._bandwidthOffer; set => this._bandwidthOffer = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] _peeringFacility; + + /// The list of direct peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] PeeringFacility { get => this._peeringFacility; set => this._peeringFacility = value; } + + /// Creates an new instance. + public PeeringLocationPropertiesDirect() + { + + } + } + /// The properties that define a direct peering location. + public partial interface IPeeringLocationPropertiesDirect : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The list of bandwidth offers available at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of bandwidth offers available at the peering location.", + SerializedName = @"bandwidthOffers", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] BandwidthOffer { get; set; } + /// The list of direct peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of direct peering facilities at the peering location.", + SerializedName = @"peeringFacilities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] PeeringFacility { get; set; } + + } + /// The properties that define a direct peering location. + internal partial interface IPeeringLocationPropertiesDirectInternal + + { + /// The list of bandwidth offers available at the peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer[] BandwidthOffer { get; set; } + /// The list of direct peering facilities at the peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility[] PeeringFacility { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.json.cs new file mode 100644 index 000000000000..b7cc1390d9aa --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesDirect.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a direct peering location. + public partial class PeeringLocationPropertiesDirect + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesDirect FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringLocationPropertiesDirect(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringLocationPropertiesDirect(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_peeringFacility = If( json?.PropertyT("peeringFacilities"), out var __jsonPeeringFacilities) ? If( __jsonPeeringFacilities as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectPeeringFacility) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectPeeringFacility.FromJson(__u) )) ))() : null : PeeringFacility;} + {_bandwidthOffer = If( json?.PropertyT("bandwidthOffers"), out var __jsonBandwidthOffers) ? If( __jsonBandwidthOffers as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringBandwidthOffer) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringBandwidthOffer.FromJson(__p) )) ))() : null : BandwidthOffer;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._peeringFacility) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._peeringFacility ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("peeringFacilities",__w); + } + if (null != this._bandwidthOffer) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __s in this._bandwidthOffer ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("bandwidthOffers",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.PowerShell.cs new file mode 100644 index 000000000000..1eda4b2a35fa --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define an exchange peering location. + [System.ComponentModel.TypeConverter(typeof(PeeringLocationPropertiesExchangeTypeConverter))] + public partial class PeeringLocationPropertiesExchange + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringLocationPropertiesExchange(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringLocationPropertiesExchange(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringLocationPropertiesExchange(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchangeInternal)this).PeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[]) content.GetValueForProperty("PeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchangeInternal)this).PeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangePeeringFacilityTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringLocationPropertiesExchange(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeeringFacility")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchangeInternal)this).PeeringFacility = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[]) content.GetValueForProperty("PeeringFacility",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchangeInternal)this).PeeringFacility, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangePeeringFacilityTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define an exchange peering location. + [System.ComponentModel.TypeConverter(typeof(PeeringLocationPropertiesExchangeTypeConverter))] + public partial interface IPeeringLocationPropertiesExchange + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.TypeConverter.cs new file mode 100644 index 000000000000..0608d2853b80 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringLocationPropertiesExchangeTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringLocationPropertiesExchange.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringLocationPropertiesExchange.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringLocationPropertiesExchange.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.cs new file mode 100644 index 000000000000..d131cf6a2301 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define an exchange peering location. + public partial class PeeringLocationPropertiesExchange : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchangeInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] _peeringFacility; + + /// The list of exchange peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] PeeringFacility { get => this._peeringFacility; set => this._peeringFacility = value; } + + /// Creates an new instance. + public PeeringLocationPropertiesExchange() + { + + } + } + /// The properties that define an exchange peering location. + public partial interface IPeeringLocationPropertiesExchange : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The list of exchange peering facilities at the peering location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of exchange peering facilities at the peering location.", + SerializedName = @"peeringFacilities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] PeeringFacility { get; set; } + + } + /// The properties that define an exchange peering location. + internal partial interface IPeeringLocationPropertiesExchangeInternal + + { + /// The list of exchange peering facilities at the peering location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility[] PeeringFacility { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.json.cs new file mode 100644 index 000000000000..51e64b8669ac --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringLocationPropertiesExchange.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define an exchange peering location. + public partial class PeeringLocationPropertiesExchange + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationPropertiesExchange FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringLocationPropertiesExchange(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringLocationPropertiesExchange(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_peeringFacility = If( json?.PropertyT("peeringFacilities"), out var __jsonPeeringFacilities) ? If( __jsonPeeringFacilities as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangePeeringFacility) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangePeeringFacility.FromJson(__u) )) ))() : null : PeeringFacility;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._peeringFacility) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._peeringFacility ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("peeringFacilities",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringProperties.PowerShell.cs new file mode 100644 index 000000000000..ce45f01bbdc4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringProperties.PowerShell.cs @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define connectivity to the Microsoft Cloud Edge. + [System.ComponentModel.TypeConverter(typeof(PeeringPropertiesTypeConverter))] + public partial class PeeringProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Direct")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).Direct = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect) content.GetValueForProperty("Direct",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).Direct, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesDirectTypeConverter.ConvertFrom); + } + if (content.Contains("Exchange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).Exchange = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange) content.GetValueForProperty("Exchange",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).Exchange, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesExchangeTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).PeeringLocation = (string) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).PeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("DirectPeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("DirectPeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("DirectConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectConnection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[]) content.GetValueForProperty("DirectConnection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectConnection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectUseForPeeringService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectUseForPeeringService = (bool?) content.GetValueForProperty("DirectUseForPeeringService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectUseForPeeringService, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DirectPeeringType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeeringType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType?) content.GetValueForProperty("DirectPeeringType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeeringType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType.CreateFrom); + } + if (content.Contains("ExchangePeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangePeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("ExchangePeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangePeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("ExchangeConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangeConnection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[]) content.GetValueForProperty("ExchangeConnection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangeConnection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectPeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeerAsnId = (string) content.GetValueForProperty("DirectPeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeerAsnId, global::System.Convert.ToString); + } + if (content.Contains("ExchangePeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangePeerAsnId = (string) content.GetValueForProperty("ExchangePeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangePeerAsnId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Direct")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).Direct = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect) content.GetValueForProperty("Direct",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).Direct, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesDirectTypeConverter.ConvertFrom); + } + if (content.Contains("Exchange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).Exchange = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange) content.GetValueForProperty("Exchange",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).Exchange, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesExchangeTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).PeeringLocation = (string) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).PeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("DirectPeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("DirectPeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("DirectConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectConnection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[]) content.GetValueForProperty("DirectConnection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectConnection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectUseForPeeringService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectUseForPeeringService = (bool?) content.GetValueForProperty("DirectUseForPeeringService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectUseForPeeringService, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DirectPeeringType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeeringType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType?) content.GetValueForProperty("DirectPeeringType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeeringType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType.CreateFrom); + } + if (content.Contains("ExchangePeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangePeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("ExchangePeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangePeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("ExchangeConnection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangeConnection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[]) content.GetValueForProperty("ExchangeConnection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangeConnection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("DirectPeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeerAsnId = (string) content.GetValueForProperty("DirectPeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).DirectPeerAsnId, global::System.Convert.ToString); + } + if (content.Contains("ExchangePeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangePeerAsnId = (string) content.GetValueForProperty("ExchangePeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal)this).ExchangePeerAsnId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define connectivity to the Microsoft Cloud Edge. + [System.ComponentModel.TypeConverter(typeof(PeeringPropertiesTypeConverter))] + public partial interface IPeeringProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringProperties.TypeConverter.cs new file mode 100644 index 000000000000..621ed5022a5b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringProperties.cs b/src/Peering/generated/api/Models/Api20221001/PeeringProperties.cs new file mode 100644 index 000000000000..86b96e05b8ba --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringProperties.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define connectivity to the Microsoft Cloud Edge. + public partial class PeeringProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect _direct; + + /// The properties that define a direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect Direct { get => (this._direct = this._direct ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesDirect()); set => this._direct = value; } + + /// The set of connections that constitute a direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] DirectConnection { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).Connection; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).Connection = value ?? null /* arrayOf */; } + + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string DirectPeerAsnId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).PeerAsnId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).PeerAsnId = value ?? null; } + + /// The type of direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).DirectPeeringType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).DirectPeeringType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType)""); } + + /// The flag that indicates whether or not the peering is used for peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public bool? DirectUseForPeeringService { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).UseForPeeringService; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange _exchange; + + /// The properties that define an exchange peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange Exchange { get => (this._exchange = this._exchange ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesExchange()); set => this._exchange = value; } + + /// The set of connections that constitute an exchange peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] ExchangeConnection { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)Exchange).Connection; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)Exchange).Connection = value ?? null /* arrayOf */; } + + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string ExchangePeerAsnId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)Exchange).PeerAsnId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)Exchange).PeerAsnId = value ?? null; } + + /// Internal Acessors for Direct + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal.Direct { get => (this._direct = this._direct ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesDirect()); set { {_direct = value;} } } + + /// Internal Acessors for DirectPeerAsn + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal.DirectPeerAsn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).PeerAsn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).PeerAsn = value; } + + /// Internal Acessors for DirectUseForPeeringService + bool? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal.DirectUseForPeeringService { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).UseForPeeringService; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)Direct).UseForPeeringService = value; } + + /// Internal Acessors for Exchange + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal.Exchange { get => (this._exchange = this._exchange ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesExchange()); set { {_exchange = value;} } } + + /// Internal Acessors for ExchangePeerAsn + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal.ExchangePeerAsn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)Exchange).PeerAsn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)Exchange).PeerAsn = value; } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private string _peeringLocation; + + /// The location of the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringLocation { get => this._peeringLocation; set => this._peeringLocation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? _provisioningState; + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Creates an new instance. + public PeeringProperties() + { + + } + } + /// The properties that define connectivity to the Microsoft Cloud Edge. + public partial interface IPeeringProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The set of connections that constitute a direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The set of connections that constitute a direct peering.", + SerializedName = @"connections", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] DirectConnection { get; set; } + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identifier of the referenced resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string DirectPeerAsnId { get; set; } + /// The type of direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of direct peering.", + SerializedName = @"directPeeringType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get; set; } + /// The flag that indicates whether or not the peering is used for peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The flag that indicates whether or not the peering is used for peering service.", + SerializedName = @"useForPeeringService", + PossibleTypes = new [] { typeof(bool) })] + bool? DirectUseForPeeringService { get; } + /// The set of connections that constitute an exchange peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The set of connections that constitute an exchange peering.", + SerializedName = @"connections", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] ExchangeConnection { get; set; } + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identifier of the referenced resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string ExchangePeerAsnId { get; set; } + /// The location of the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The location of the peering.", + SerializedName = @"peeringLocation", + PossibleTypes = new [] { typeof(string) })] + string PeeringLocation { get; set; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + + } + /// The properties that define connectivity to the Microsoft Cloud Edge. + internal partial interface IPeeringPropertiesInternal + + { + /// The properties that define a direct peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect Direct { get; set; } + /// The set of connections that constitute a direct peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] DirectConnection { get; set; } + /// The reference of the peer ASN. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource DirectPeerAsn { get; set; } + /// The identifier of the referenced resource. + string DirectPeerAsnId { get; set; } + /// The type of direct peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get; set; } + /// The flag that indicates whether or not the peering is used for peering service. + bool? DirectUseForPeeringService { get; set; } + /// The properties that define an exchange peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange Exchange { get; set; } + /// The set of connections that constitute an exchange peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] ExchangeConnection { get; set; } + /// The reference of the peer ASN. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource ExchangePeerAsn { get; set; } + /// The identifier of the referenced resource. + string ExchangePeerAsnId { get; set; } + /// The location of the peering. + string PeeringLocation { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringProperties.json.cs new file mode 100644 index 000000000000..edeeced6a288 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringProperties.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define connectivity to the Microsoft Cloud Edge. + public partial class PeeringProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_direct = If( json?.PropertyT("direct"), out var __jsonDirect) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesDirect.FromJson(__jsonDirect) : Direct;} + {_exchange = If( json?.PropertyT("exchange"), out var __jsonExchange) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringPropertiesExchange.FromJson(__jsonExchange) : Exchange;} + {_peeringLocation = If( json?.PropertyT("peeringLocation"), out var __jsonPeeringLocation) ? (string)__jsonPeeringLocation : (string)PeeringLocation;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._direct ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._direct.ToJson(null,serializationMode) : null, "direct" ,container.Add ); + AddIf( null != this._exchange ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._exchange.ToJson(null,serializationMode) : null, "exchange" ,container.Add ); + AddIf( null != (((object)this._peeringLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringLocation.ToString()) : null, "peeringLocation" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.PowerShell.cs new file mode 100644 index 000000000000..fcd4e5224dd0 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a direct peering. + [System.ComponentModel.TypeConverter(typeof(PeeringPropertiesDirectTypeConverter))] + public partial class PeeringPropertiesDirect + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringPropertiesDirect(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringPropertiesDirect(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringPropertiesDirect(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).PeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("PeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).PeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("Connection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).Connection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[]) content.GetValueForProperty("Connection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).Connection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("UseForPeeringService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).UseForPeeringService = (bool?) content.GetValueForProperty("UseForPeeringService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).UseForPeeringService, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DirectPeeringType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).DirectPeeringType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType?) content.GetValueForProperty("DirectPeeringType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).DirectPeeringType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType.CreateFrom); + } + if (content.Contains("PeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).PeerAsnId = (string) content.GetValueForProperty("PeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).PeerAsnId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringPropertiesDirect(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).PeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("PeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).PeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("Connection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).Connection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[]) content.GetValueForProperty("Connection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).Connection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("UseForPeeringService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).UseForPeeringService = (bool?) content.GetValueForProperty("UseForPeeringService",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).UseForPeeringService, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DirectPeeringType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).DirectPeeringType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType?) content.GetValueForProperty("DirectPeeringType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).DirectPeeringType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType.CreateFrom); + } + if (content.Contains("PeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).PeerAsnId = (string) content.GetValueForProperty("PeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal)this).PeerAsnId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a direct peering. + [System.ComponentModel.TypeConverter(typeof(PeeringPropertiesDirectTypeConverter))] + public partial interface IPeeringPropertiesDirect + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.TypeConverter.cs new file mode 100644 index 000000000000..1d67f7ac3065 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringPropertiesDirectTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringPropertiesDirect.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringPropertiesDirect.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringPropertiesDirect.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.cs b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.cs new file mode 100644 index 000000000000..1c0f43c3c529 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a direct peering. + public partial class PeeringPropertiesDirect : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] _connection; + + /// The set of connections that constitute a direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] Connection { get => this._connection; set => this._connection = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? _directPeeringType; + + /// The type of direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get => this._directPeeringType; set => this._directPeeringType = value; } + + /// Internal Acessors for PeerAsn + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal.PeerAsn { get => (this._peerAsn = this._peerAsn ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResource()); set { {_peerAsn = value;} } } + + /// Internal Acessors for UseForPeeringService + bool? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirectInternal.UseForPeeringService { get => this._useForPeeringService; set { {_useForPeeringService = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource _peerAsn; + + /// The reference of the peer ASN. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource PeerAsn { get => (this._peerAsn = this._peerAsn ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResource()); set => this._peerAsn = value; } + + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string PeerAsnId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResourceInternal)PeerAsn).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResourceInternal)PeerAsn).Id = value ?? null; } + + /// Backing field for property. + private bool? _useForPeeringService; + + /// The flag that indicates whether or not the peering is used for peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public bool? UseForPeeringService { get => this._useForPeeringService; } + + /// Creates an new instance. + public PeeringPropertiesDirect() + { + + } + } + /// The properties that define a direct peering. + public partial interface IPeeringPropertiesDirect : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The set of connections that constitute a direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The set of connections that constitute a direct peering.", + SerializedName = @"connections", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] Connection { get; set; } + /// The type of direct peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of direct peering.", + SerializedName = @"directPeeringType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get; set; } + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identifier of the referenced resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string PeerAsnId { get; set; } + /// The flag that indicates whether or not the peering is used for peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The flag that indicates whether or not the peering is used for peering service.", + SerializedName = @"useForPeeringService", + PossibleTypes = new [] { typeof(bool) })] + bool? UseForPeeringService { get; } + + } + /// The properties that define a direct peering. + internal partial interface IPeeringPropertiesDirectInternal + + { + /// The set of connections that constitute a direct peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] Connection { get; set; } + /// The type of direct peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? DirectPeeringType { get; set; } + /// The reference of the peer ASN. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource PeerAsn { get; set; } + /// The identifier of the referenced resource. + string PeerAsnId { get; set; } + /// The flag that indicates whether or not the peering is used for peering service. + bool? UseForPeeringService { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.json.cs new file mode 100644 index 000000000000..53273b19eb3f --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesDirect.json.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a direct peering. + public partial class PeeringPropertiesDirect + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesDirect FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringPropertiesDirect(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringPropertiesDirect(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_peerAsn = If( json?.PropertyT("peerAsn"), out var __jsonPeerAsn) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResource.FromJson(__jsonPeerAsn) : PeerAsn;} + {_connection = If( json?.PropertyT("connections"), out var __jsonConnections) ? If( __jsonConnections as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection.FromJson(__u) )) ))() : null : Connection;} + {_useForPeeringService = If( json?.PropertyT("useForPeeringService"), out var __jsonUseForPeeringService) ? (bool?)__jsonUseForPeeringService : UseForPeeringService;} + {_directPeeringType = If( json?.PropertyT("directPeeringType"), out var __jsonDirectPeeringType) ? (string)__jsonDirectPeeringType : (string)DirectPeeringType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._peerAsn ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._peerAsn.ToJson(null,serializationMode) : null, "peerAsn" ,container.Add ); + if (null != this._connection) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._connection ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("connections",__w); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._useForPeeringService ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonBoolean((bool)this._useForPeeringService) : null, "useForPeeringService" ,container.Add ); + } + AddIf( null != (((object)this._directPeeringType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._directPeeringType.ToString()) : null, "directPeeringType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.PowerShell.cs new file mode 100644 index 000000000000..f879b52fd494 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define an exchange peering. + [System.ComponentModel.TypeConverter(typeof(PeeringPropertiesExchangeTypeConverter))] + public partial class PeeringPropertiesExchange + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringPropertiesExchange(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringPropertiesExchange(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringPropertiesExchange(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).PeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("PeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).PeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("Connection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).Connection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[]) content.GetValueForProperty("Connection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).Connection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("PeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).PeerAsnId = (string) content.GetValueForProperty("PeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).PeerAsnId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringPropertiesExchange(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).PeerAsn = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource) content.GetValueForProperty("PeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).PeerAsn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResourceTypeConverter.ConvertFrom); + } + if (content.Contains("Connection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).Connection = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[]) content.GetValueForProperty("Connection",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).Connection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnectionTypeConverter.ConvertFrom)); + } + if (content.Contains("PeerAsnId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).PeerAsnId = (string) content.GetValueForProperty("PeerAsnId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal)this).PeerAsnId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define an exchange peering. + [System.ComponentModel.TypeConverter(typeof(PeeringPropertiesExchangeTypeConverter))] + public partial interface IPeeringPropertiesExchange + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.TypeConverter.cs new file mode 100644 index 000000000000..5cf829b2aa3b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringPropertiesExchangeTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringPropertiesExchange.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringPropertiesExchange.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringPropertiesExchange.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.cs b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.cs new file mode 100644 index 000000000000..8e5ea756bb3a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define an exchange peering. + public partial class PeeringPropertiesExchange : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] _connection; + + /// The set of connections that constitute an exchange peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] Connection { get => this._connection; set => this._connection = value; } + + /// Internal Acessors for PeerAsn + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchangeInternal.PeerAsn { get => (this._peerAsn = this._peerAsn ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResource()); set { {_peerAsn = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource _peerAsn; + + /// The reference of the peer ASN. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource PeerAsn { get => (this._peerAsn = this._peerAsn ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResource()); set => this._peerAsn = value; } + + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string PeerAsnId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResourceInternal)PeerAsn).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResourceInternal)PeerAsn).Id = value ?? null; } + + /// Creates an new instance. + public PeeringPropertiesExchange() + { + + } + } + /// The properties that define an exchange peering. + public partial interface IPeeringPropertiesExchange : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The set of connections that constitute an exchange peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The set of connections that constitute an exchange peering.", + SerializedName = @"connections", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] Connection { get; set; } + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identifier of the referenced resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string PeerAsnId { get; set; } + + } + /// The properties that define an exchange peering. + internal partial interface IPeeringPropertiesExchangeInternal + + { + /// The set of connections that constitute an exchange peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] Connection { get; set; } + /// The reference of the peer ASN. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource PeerAsn { get; set; } + /// The identifier of the referenced resource. + string PeerAsnId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.json.cs new file mode 100644 index 000000000000..c84bf0b04882 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringPropertiesExchange.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define an exchange peering. + public partial class PeeringPropertiesExchange + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringPropertiesExchange FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringPropertiesExchange(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringPropertiesExchange(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_peerAsn = If( json?.PropertyT("peerAsn"), out var __jsonPeerAsn) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.SubResource.FromJson(__jsonPeerAsn) : PeerAsn;} + {_connection = If( json?.PropertyT("connections"), out var __jsonConnections) ? If( __jsonConnections as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection.FromJson(__u) )) ))() : null : Connection;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._peerAsn ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._peerAsn.ToJson(null,serializationMode) : null, "peerAsn" ,container.Add ); + if (null != this._connection) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._connection ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("connections",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.PowerShell.cs new file mode 100644 index 000000000000..1b1185ef50c2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a received route. + [System.ComponentModel.TypeConverter(typeof(PeeringReceivedRouteTypeConverter))] + public partial class PeeringReceivedRoute + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringReceivedRoute(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringReceivedRoute(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringReceivedRoute(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("NextHop")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).NextHop = (string) content.GetValueForProperty("NextHop",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).NextHop, global::System.Convert.ToString); + } + if (content.Contains("AsPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).AsPath = (string) content.GetValueForProperty("AsPath",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).AsPath, global::System.Convert.ToString); + } + if (content.Contains("OriginAsValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).OriginAsValidationState = (string) content.GetValueForProperty("OriginAsValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).OriginAsValidationState, global::System.Convert.ToString); + } + if (content.Contains("RpkiValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).RpkiValidationState = (string) content.GetValueForProperty("RpkiValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).RpkiValidationState, global::System.Convert.ToString); + } + if (content.Contains("TrustAnchor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).TrustAnchor = (string) content.GetValueForProperty("TrustAnchor",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).TrustAnchor, global::System.Convert.ToString); + } + if (content.Contains("ReceivedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).ReceivedTimestamp = (string) content.GetValueForProperty("ReceivedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).ReceivedTimestamp, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringReceivedRoute(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("NextHop")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).NextHop = (string) content.GetValueForProperty("NextHop",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).NextHop, global::System.Convert.ToString); + } + if (content.Contains("AsPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).AsPath = (string) content.GetValueForProperty("AsPath",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).AsPath, global::System.Convert.ToString); + } + if (content.Contains("OriginAsValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).OriginAsValidationState = (string) content.GetValueForProperty("OriginAsValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).OriginAsValidationState, global::System.Convert.ToString); + } + if (content.Contains("RpkiValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).RpkiValidationState = (string) content.GetValueForProperty("RpkiValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).RpkiValidationState, global::System.Convert.ToString); + } + if (content.Contains("TrustAnchor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).TrustAnchor = (string) content.GetValueForProperty("TrustAnchor",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).TrustAnchor, global::System.Convert.ToString); + } + if (content.Contains("ReceivedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).ReceivedTimestamp = (string) content.GetValueForProperty("ReceivedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal)this).ReceivedTimestamp, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a received route. + [System.ComponentModel.TypeConverter(typeof(PeeringReceivedRouteTypeConverter))] + public partial interface IPeeringReceivedRoute + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.TypeConverter.cs new file mode 100644 index 000000000000..a87532b5d3f2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringReceivedRouteTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringReceivedRoute.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringReceivedRoute.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringReceivedRoute.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.cs b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.cs new file mode 100644 index 000000000000..79264de916cd --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a received route. + public partial class PeeringReceivedRoute : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal + { + + /// Backing field for property. + private string _asPath; + + /// The AS path for the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string AsPath { get => this._asPath; } + + /// Internal Acessors for AsPath + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal.AsPath { get => this._asPath; set { {_asPath = value;} } } + + /// Internal Acessors for NextHop + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal.NextHop { get => this._nextHop; set { {_nextHop = value;} } } + + /// Internal Acessors for OriginAsValidationState + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal.OriginAsValidationState { get => this._originAsValidationState; set { {_originAsValidationState = value;} } } + + /// Internal Acessors for Prefix + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal.Prefix { get => this._prefix; set { {_prefix = value;} } } + + /// Internal Acessors for ReceivedTimestamp + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal.ReceivedTimestamp { get => this._receivedTimestamp; set { {_receivedTimestamp = value;} } } + + /// Internal Acessors for RpkiValidationState + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal.RpkiValidationState { get => this._rpkiValidationState; set { {_rpkiValidationState = value;} } } + + /// Internal Acessors for TrustAnchor + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteInternal.TrustAnchor { get => this._trustAnchor; set { {_trustAnchor = value;} } } + + /// Backing field for property. + private string _nextHop; + + /// The next hop for the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextHop { get => this._nextHop; } + + /// Backing field for property. + private string _originAsValidationState; + + /// The origin AS change information for the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string OriginAsValidationState { get => this._originAsValidationState; } + + /// Backing field for property. + private string _prefix; + + /// The prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Prefix { get => this._prefix; } + + /// Backing field for property. + private string _receivedTimestamp; + + /// The received timestamp associated with the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ReceivedTimestamp { get => this._receivedTimestamp; } + + /// Backing field for property. + private string _rpkiValidationState; + + /// + /// The RPKI validation state for the prefix and origin AS that's listed in the AS path. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string RpkiValidationState { get => this._rpkiValidationState; } + + /// Backing field for property. + private string _trustAnchor; + + /// + /// The authority which holds the Route Origin Authorization record for the prefix, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string TrustAnchor { get => this._trustAnchor; } + + /// Creates an new instance. + public PeeringReceivedRoute() + { + + } + } + /// The properties that define a received route. + public partial interface IPeeringReceivedRoute : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The AS path for the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The AS path for the prefix.", + SerializedName = @"asPath", + PossibleTypes = new [] { typeof(string) })] + string AsPath { get; } + /// The next hop for the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The next hop for the prefix.", + SerializedName = @"nextHop", + PossibleTypes = new [] { typeof(string) })] + string NextHop { get; } + /// The origin AS change information for the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The origin AS change information for the prefix.", + SerializedName = @"originAsValidationState", + PossibleTypes = new [] { typeof(string) })] + string OriginAsValidationState { get; } + /// The prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + string Prefix { get; } + /// The received timestamp associated with the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The received timestamp associated with the prefix.", + SerializedName = @"receivedTimestamp", + PossibleTypes = new [] { typeof(string) })] + string ReceivedTimestamp { get; } + /// + /// The RPKI validation state for the prefix and origin AS that's listed in the AS path. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The RPKI validation state for the prefix and origin AS that's listed in the AS path.", + SerializedName = @"rpkiValidationState", + PossibleTypes = new [] { typeof(string) })] + string RpkiValidationState { get; } + /// + /// The authority which holds the Route Origin Authorization record for the prefix, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The authority which holds the Route Origin Authorization record for the prefix, if any.", + SerializedName = @"trustAnchor", + PossibleTypes = new [] { typeof(string) })] + string TrustAnchor { get; } + + } + /// The properties that define a received route. + internal partial interface IPeeringReceivedRouteInternal + + { + /// The AS path for the prefix. + string AsPath { get; set; } + /// The next hop for the prefix. + string NextHop { get; set; } + /// The origin AS change information for the prefix. + string OriginAsValidationState { get; set; } + /// The prefix. + string Prefix { get; set; } + /// The received timestamp associated with the prefix. + string ReceivedTimestamp { get; set; } + /// + /// The RPKI validation state for the prefix and origin AS that's listed in the AS path. + /// + string RpkiValidationState { get; set; } + /// + /// The authority which holds the Route Origin Authorization record for the prefix, if any. + /// + string TrustAnchor { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.json.cs new file mode 100644 index 000000000000..9f81f8f80146 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRoute.json.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a received route. + public partial class PeeringReceivedRoute + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringReceivedRoute(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringReceivedRoute(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_prefix = If( json?.PropertyT("prefix"), out var __jsonPrefix) ? (string)__jsonPrefix : (string)Prefix;} + {_nextHop = If( json?.PropertyT("nextHop"), out var __jsonNextHop) ? (string)__jsonNextHop : (string)NextHop;} + {_asPath = If( json?.PropertyT("asPath"), out var __jsonAsPath) ? (string)__jsonAsPath : (string)AsPath;} + {_originAsValidationState = If( json?.PropertyT("originAsValidationState"), out var __jsonOriginAsValidationState) ? (string)__jsonOriginAsValidationState : (string)OriginAsValidationState;} + {_rpkiValidationState = If( json?.PropertyT("rpkiValidationState"), out var __jsonRpkiValidationState) ? (string)__jsonRpkiValidationState : (string)RpkiValidationState;} + {_trustAnchor = If( json?.PropertyT("trustAnchor"), out var __jsonTrustAnchor) ? (string)__jsonTrustAnchor : (string)TrustAnchor;} + {_receivedTimestamp = If( json?.PropertyT("receivedTimestamp"), out var __jsonReceivedTimestamp) ? (string)__jsonReceivedTimestamp : (string)ReceivedTimestamp;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._prefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._prefix.ToString()) : null, "prefix" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._nextHop)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextHop.ToString()) : null, "nextHop" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._asPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._asPath.ToString()) : null, "asPath" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._originAsValidationState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._originAsValidationState.ToString()) : null, "originAsValidationState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._rpkiValidationState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._rpkiValidationState.ToString()) : null, "rpkiValidationState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._trustAnchor)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._trustAnchor.ToString()) : null, "trustAnchor" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._receivedTimestamp)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._receivedTimestamp.ToString()) : null, "receivedTimestamp" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.PowerShell.cs new file mode 100644 index 000000000000..a266d858769a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of received routes for the peering. + [System.ComponentModel.TypeConverter(typeof(PeeringReceivedRouteListResultTypeConverter))] + public partial class PeeringReceivedRouteListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringReceivedRouteListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringReceivedRouteListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringReceivedRouteListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringReceivedRouteTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringReceivedRouteListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringReceivedRouteTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of received routes for the peering. + [System.ComponentModel.TypeConverter(typeof(PeeringReceivedRouteListResultTypeConverter))] + public partial interface IPeeringReceivedRouteListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.TypeConverter.cs new file mode 100644 index 000000000000..6aa199a7d85a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringReceivedRouteListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringReceivedRouteListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringReceivedRouteListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringReceivedRouteListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.cs new file mode 100644 index 000000000000..d6dbebc9f8c0 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of received routes for the peering. + public partial class PeeringReceivedRouteListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of received routes for the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute[] _value; + + /// The list of received routes for the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringReceivedRouteListResult() + { + + } + } + /// The paginated list of received routes for the peering. + public partial interface IPeeringReceivedRouteListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of received routes for the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of received routes for the peering.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of received routes for the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of received routes for the peering.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute[] Value { get; set; } + + } + /// The paginated list of received routes for the peering. + internal partial interface IPeeringReceivedRouteListResultInternal + + { + /// The link to fetch the next page of received routes for the peering. + string NextLink { get; set; } + /// The list of received routes for the peering. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.json.cs new file mode 100644 index 000000000000..8610b2f52a39 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringReceivedRouteListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of received routes for the peering. + public partial class PeeringReceivedRouteListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringReceivedRouteListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringReceivedRouteListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringReceivedRoute.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.PowerShell.cs new file mode 100644 index 000000000000..dc583ab83481 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The customer's ASN that is registered by the peering service provider. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredAsnTypeConverter))] + public partial class PeeringRegisteredAsn + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringRegisteredAsn(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringRegisteredAsn(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringRegisteredAsn(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("Asn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).Asn = (int?) content.GetValueForProperty("Asn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).Asn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringRegisteredAsn(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("Asn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).Asn = (int?) content.GetValueForProperty("Asn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).Asn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The customer's ASN that is registered by the peering service provider. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredAsnTypeConverter))] + public partial interface IPeeringRegisteredAsn + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.TypeConverter.cs new file mode 100644 index 000000000000..8c9aebf7dc3a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringRegisteredAsnTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringRegisteredAsn.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringRegisteredAsn.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringRegisteredAsn.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.cs new file mode 100644 index 000000000000..23dd723860aa --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The customer's ASN that is registered by the peering service provider. + public partial class PeeringRegisteredAsn : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The customer's ASN from which traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public int? Asn { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)Property).Asn; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)Property).Asn = value ?? default(int); } + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// Internal Acessors for PeeringServicePrefixKey + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal.PeeringServicePrefixKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)Property).PeeringServicePrefixKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)Property).PeeringServicePrefixKey = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The peering service prefix key that is to be shared with the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public string PeeringServicePrefixKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)Property).PeeringServicePrefixKey; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties _property; + + /// The properties that define a registered ASN. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnProperties()); set => this._property = value; } + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 3)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public PeeringRegisteredAsn() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The customer's ASN that is registered by the peering service provider. + public partial interface IPeeringRegisteredAsn : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The customer's ASN from which traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer's ASN from which traffic originates.", + SerializedName = @"asn", + PossibleTypes = new [] { typeof(int) })] + int? Asn { get; set; } + /// The peering service prefix key that is to be shared with the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The peering service prefix key that is to be shared with the customer.", + SerializedName = @"peeringServicePrefixKey", + PossibleTypes = new [] { typeof(string) })] + string PeeringServicePrefixKey { get; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + + } + /// The customer's ASN that is registered by the peering service provider. + internal partial interface IPeeringRegisteredAsnInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The customer's ASN from which traffic originates. + int? Asn { get; set; } + /// The peering service prefix key that is to be shared with the customer. + string PeeringServicePrefixKey { get; set; } + /// The properties that define a registered ASN. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties Property { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.json.cs new file mode 100644 index 000000000000..57ad2e82a46f --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsn.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The customer's ASN that is registered by the peering service provider. + public partial class PeeringRegisteredAsn + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringRegisteredAsn(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringRegisteredAsn(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.PowerShell.cs new file mode 100644 index 000000000000..7a0b21665c3f --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peering registered ASNs. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredAsnListResultTypeConverter))] + public partial class PeeringRegisteredAsnListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringRegisteredAsnListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringRegisteredAsnListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringRegisteredAsnListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringRegisteredAsnListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peering registered ASNs. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredAsnListResultTypeConverter))] + public partial interface IPeeringRegisteredAsnListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.TypeConverter.cs new file mode 100644 index 000000000000..fc7816125a4e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringRegisteredAsnListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringRegisteredAsnListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringRegisteredAsnListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringRegisteredAsnListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.cs new file mode 100644 index 000000000000..3731a1bc0a2b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering registered ASNs. + public partial class PeeringRegisteredAsnListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peering registered ASNs. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn[] _value; + + /// The list of peering registered ASNs. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringRegisteredAsnListResult() + { + + } + } + /// The paginated list of peering registered ASNs. + public partial interface IPeeringRegisteredAsnListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peering registered ASNs. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peering registered ASNs.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peering registered ASNs. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peering registered ASNs.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn[] Value { get; set; } + + } + /// The paginated list of peering registered ASNs. + internal partial interface IPeeringRegisteredAsnListResultInternal + + { + /// The link to fetch the next page of peering registered ASNs. + string NextLink { get; set; } + /// The list of peering registered ASNs. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.json.cs new file mode 100644 index 000000000000..eb288d279d69 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering registered ASNs. + public partial class PeeringRegisteredAsnListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringRegisteredAsnListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringRegisteredAsnListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsn.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.PowerShell.cs new file mode 100644 index 000000000000..270c3b92bfcb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.PowerShell.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a registered ASN. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredAsnPropertiesTypeConverter))] + public partial class PeeringRegisteredAsnProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringRegisteredAsnProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringRegisteredAsnProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringRegisteredAsnProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Asn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).Asn = (int?) content.GetValueForProperty("Asn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).Asn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringRegisteredAsnProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Asn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).Asn = (int?) content.GetValueForProperty("Asn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).Asn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a registered ASN. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredAsnPropertiesTypeConverter))] + public partial interface IPeeringRegisteredAsnProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.TypeConverter.cs new file mode 100644 index 000000000000..227d55294c0a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringRegisteredAsnPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringRegisteredAsnProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringRegisteredAsnProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringRegisteredAsnProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.cs new file mode 100644 index 000000000000..4a8b486cd8e0 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a registered ASN. + public partial class PeeringRegisteredAsnProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal + { + + /// Backing field for property. + private int? _asn; + + /// The customer's ASN from which traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public int? Asn { get => this._asn; set => this._asn = value; } + + /// Internal Acessors for PeeringServicePrefixKey + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal.PeeringServicePrefixKey { get => this._peeringServicePrefixKey; set { {_peeringServicePrefixKey = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private string _peeringServicePrefixKey; + + /// The peering service prefix key that is to be shared with the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringServicePrefixKey { get => this._peeringServicePrefixKey; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? _provisioningState; + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Creates an new instance. + public PeeringRegisteredAsnProperties() + { + + } + } + /// The properties that define a registered ASN. + public partial interface IPeeringRegisteredAsnProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The customer's ASN from which traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer's ASN from which traffic originates.", + SerializedName = @"asn", + PossibleTypes = new [] { typeof(int) })] + int? Asn { get; set; } + /// The peering service prefix key that is to be shared with the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The peering service prefix key that is to be shared with the customer.", + SerializedName = @"peeringServicePrefixKey", + PossibleTypes = new [] { typeof(string) })] + string PeeringServicePrefixKey { get; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + + } + /// The properties that define a registered ASN. + internal partial interface IPeeringRegisteredAsnPropertiesInternal + + { + /// The customer's ASN from which traffic originates. + int? Asn { get; set; } + /// The peering service prefix key that is to be shared with the customer. + string PeeringServicePrefixKey { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.json.cs new file mode 100644 index 000000000000..293d8bbe1eaa --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredAsnProperties.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a registered ASN. + public partial class PeeringRegisteredAsnProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringRegisteredAsnProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringRegisteredAsnProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_asn = If( json?.PropertyT("asn"), out var __jsonAsn) ? (int?)__jsonAsn : Asn;} + {_peeringServicePrefixKey = If( json?.PropertyT("peeringServicePrefixKey"), out var __jsonPeeringServicePrefixKey) ? (string)__jsonPeeringServicePrefixKey : (string)PeeringServicePrefixKey;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._asn ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._asn) : null, "asn" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._peeringServicePrefixKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringServicePrefixKey.ToString()) : null, "peeringServicePrefixKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.PowerShell.cs new file mode 100644 index 000000000000..e51f1ec0a4dd --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.PowerShell.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The customer's prefix that is registered by the peering service provider. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredPrefixTypeConverter))] + public partial class PeeringRegisteredPrefix + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringRegisteredPrefix(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringRegisteredPrefix(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringRegisteredPrefix(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("PrefixValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).PrefixValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState?) content.GetValueForProperty("PrefixValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).PrefixValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState.CreateFrom); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).ErrorMessage, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringRegisteredPrefix(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("PrefixValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).PrefixValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState?) content.GetValueForProperty("PrefixValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).PrefixValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState.CreateFrom); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal)this).ErrorMessage, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The customer's prefix that is registered by the peering service provider. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredPrefixTypeConverter))] + public partial interface IPeeringRegisteredPrefix + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.TypeConverter.cs new file mode 100644 index 000000000000..fc8202f82037 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringRegisteredPrefixTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringRegisteredPrefix.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringRegisteredPrefix.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringRegisteredPrefix.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.cs new file mode 100644 index 000000000000..88c17768e3fa --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The customer's prefix that is registered by the peering service provider. + public partial class PeeringRegisteredPrefix : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The error message associated with the validation state, if any. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).ErrorMessage; } + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal.ErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).ErrorMessage = value; } + + /// Internal Acessors for PeeringServicePrefixKey + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal.PeeringServicePrefixKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).PeeringServicePrefixKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).PeeringServicePrefixKey = value; } + + /// Internal Acessors for PrefixValidationState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal.PrefixValidationState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).PrefixValidationState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).PrefixValidationState = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The peering service prefix key that is to be shared with the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public string PeeringServicePrefixKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).PeeringServicePrefixKey; } + + /// The customer's prefix from which traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string Prefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).Prefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).Prefix = value ?? null; } + + /// The prefix validation state. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 3)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).PrefixValidationState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties _property; + + /// The properties that define a registered prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixProperties()); set => this._property = value; } + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 4)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public PeeringRegisteredPrefix() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The customer's prefix that is registered by the peering service provider. + public partial interface IPeeringRegisteredPrefix : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The error message associated with the validation state, if any. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message associated with the validation state, if any.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The peering service prefix key that is to be shared with the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The peering service prefix key that is to be shared with the customer.", + SerializedName = @"peeringServicePrefixKey", + PossibleTypes = new [] { typeof(string) })] + string PeeringServicePrefixKey { get; } + /// The customer's prefix from which traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer's prefix from which traffic originates.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + string Prefix { get; set; } + /// The prefix validation state. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix validation state.", + SerializedName = @"prefixValidationState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + + } + /// The customer's prefix that is registered by the peering service provider. + internal partial interface IPeeringRegisteredPrefixInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The error message associated with the validation state, if any. + string ErrorMessage { get; set; } + /// The peering service prefix key that is to be shared with the customer. + string PeeringServicePrefixKey { get; set; } + /// The customer's prefix from which traffic originates. + string Prefix { get; set; } + /// The prefix validation state. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get; set; } + /// The properties that define a registered prefix. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties Property { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.json.cs new file mode 100644 index 000000000000..c485e8235199 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefix.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The customer's prefix that is registered by the peering service provider. + public partial class PeeringRegisteredPrefix + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringRegisteredPrefix(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringRegisteredPrefix(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.PowerShell.cs new file mode 100644 index 000000000000..9b5d336ba01b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peering registered prefixes. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredPrefixListResultTypeConverter))] + public partial class PeeringRegisteredPrefixListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringRegisteredPrefixListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringRegisteredPrefixListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringRegisteredPrefixListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringRegisteredPrefixListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peering registered prefixes. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredPrefixListResultTypeConverter))] + public partial interface IPeeringRegisteredPrefixListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.TypeConverter.cs new file mode 100644 index 000000000000..7e91832ae228 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringRegisteredPrefixListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringRegisteredPrefixListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringRegisteredPrefixListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringRegisteredPrefixListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.cs new file mode 100644 index 000000000000..028cebdf7cc5 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering registered prefixes. + public partial class PeeringRegisteredPrefixListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peering registered prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix[] _value; + + /// The list of peering registered prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringRegisteredPrefixListResult() + { + + } + } + /// The paginated list of peering registered prefixes. + public partial interface IPeeringRegisteredPrefixListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peering registered prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peering registered prefixes.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peering registered prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peering registered prefixes.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix[] Value { get; set; } + + } + /// The paginated list of peering registered prefixes. + internal partial interface IPeeringRegisteredPrefixListResultInternal + + { + /// The link to fetch the next page of peering registered prefixes. + string NextLink { get; set; } + /// The list of peering registered prefixes. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.json.cs new file mode 100644 index 000000000000..ef235de89a68 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering registered prefixes. + public partial class PeeringRegisteredPrefixListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringRegisteredPrefixListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringRegisteredPrefixListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefix.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.PowerShell.cs new file mode 100644 index 000000000000..02d7e8e928fb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define a registered prefix. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredPrefixPropertiesTypeConverter))] + public partial class PeeringRegisteredPrefixProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringRegisteredPrefixProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringRegisteredPrefixProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringRegisteredPrefixProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("PrefixValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).PrefixValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState?) content.GetValueForProperty("PrefixValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).PrefixValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState.CreateFrom); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringRegisteredPrefixProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("PrefixValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).PrefixValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState?) content.GetValueForProperty("PrefixValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).PrefixValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState.CreateFrom); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define a registered prefix. + [System.ComponentModel.TypeConverter(typeof(PeeringRegisteredPrefixPropertiesTypeConverter))] + public partial interface IPeeringRegisteredPrefixProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.TypeConverter.cs new file mode 100644 index 000000000000..2ddee5b68fa4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringRegisteredPrefixPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringRegisteredPrefixProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringRegisteredPrefixProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringRegisteredPrefixProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.cs new file mode 100644 index 000000000000..ee7107872daa --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a registered prefix. + public partial class PeeringRegisteredPrefixProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal + { + + /// Backing field for property. + private string _errorMessage; + + /// The error message associated with the validation state, if any. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Internal Acessors for PeeringServicePrefixKey + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal.PeeringServicePrefixKey { get => this._peeringServicePrefixKey; set { {_peeringServicePrefixKey = value;} } } + + /// Internal Acessors for PrefixValidationState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal.PrefixValidationState { get => this._prefixValidationState; set { {_prefixValidationState = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private string _peeringServicePrefixKey; + + /// The peering service prefix key that is to be shared with the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringServicePrefixKey { get => this._peeringServicePrefixKey; } + + /// Backing field for property. + private string _prefix; + + /// The customer's prefix from which traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Prefix { get => this._prefix; set => this._prefix = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? _prefixValidationState; + + /// The prefix validation state. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get => this._prefixValidationState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? _provisioningState; + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Creates an new instance. + public PeeringRegisteredPrefixProperties() + { + + } + } + /// The properties that define a registered prefix. + public partial interface IPeeringRegisteredPrefixProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The error message associated with the validation state, if any. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message associated with the validation state, if any.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The peering service prefix key that is to be shared with the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The peering service prefix key that is to be shared with the customer.", + SerializedName = @"peeringServicePrefixKey", + PossibleTypes = new [] { typeof(string) })] + string PeeringServicePrefixKey { get; } + /// The customer's prefix from which traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer's prefix from which traffic originates.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + string Prefix { get; set; } + /// The prefix validation state. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix validation state.", + SerializedName = @"prefixValidationState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + + } + /// The properties that define a registered prefix. + internal partial interface IPeeringRegisteredPrefixPropertiesInternal + + { + /// The error message associated with the validation state, if any. + string ErrorMessage { get; set; } + /// The peering service prefix key that is to be shared with the customer. + string PeeringServicePrefixKey { get; set; } + /// The customer's prefix from which traffic originates. + string Prefix { get; set; } + /// The prefix validation state. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.json.cs new file mode 100644 index 000000000000..153aba9eb95e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringRegisteredPrefixProperties.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define a registered prefix. + public partial class PeeringRegisteredPrefixProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringRegisteredPrefixProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringRegisteredPrefixProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_prefix = If( json?.PropertyT("prefix"), out var __jsonPrefix) ? (string)__jsonPrefix : (string)Prefix;} + {_prefixValidationState = If( json?.PropertyT("prefixValidationState"), out var __jsonPrefixValidationState) ? (string)__jsonPrefixValidationState : (string)PrefixValidationState;} + {_peeringServicePrefixKey = If( json?.PropertyT("peeringServicePrefixKey"), out var __jsonPeeringServicePrefixKey) ? (string)__jsonPeeringServicePrefixKey : (string)PeeringServicePrefixKey;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._prefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._prefix.ToString()) : null, "prefix" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._prefixValidationState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._prefixValidationState.ToString()) : null, "prefixValidationState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._peeringServicePrefixKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringServicePrefixKey.ToString()) : null, "peeringServicePrefixKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringService.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringService.PowerShell.cs new file mode 100644 index 000000000000..f15328a2905a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringService.PowerShell.cs @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// Peering Service + [System.ComponentModel.TypeConverter(typeof(PeeringServiceTypeConverter))] + public partial class PeeringService + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringService(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringService(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringService(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceSkuTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticsWorkspaceProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticsWorkspaceProperty = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties) content.GetValueForProperty("LogAnalyticsWorkspaceProperty",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticsWorkspaceProperty, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LogAnalyticsWorkspacePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringServiceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).PeeringServiceLocation = (string) content.GetValueForProperty("PeeringServiceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).PeeringServiceLocation, global::System.Convert.ToString); + } + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("ProviderPrimaryPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProviderPrimaryPeeringLocation = (string) content.GetValueForProperty("ProviderPrimaryPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProviderPrimaryPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("ProviderBackupPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProviderBackupPeeringLocation = (string) content.GetValueForProperty("ProviderBackupPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProviderBackupPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyWorkspaceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyWorkspaceId = (string) content.GetValueForProperty("LogAnalyticWorkspacePropertyWorkspaceId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyWorkspaceId, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyKey = (string) content.GetValueForProperty("LogAnalyticWorkspacePropertyKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyKey, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyConnectedAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyConnectedAgent = (string[]) content.GetValueForProperty("LogAnalyticWorkspacePropertyConnectedAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyConnectedAgent, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringService(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceSkuTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("SkuName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).SkuName, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticsWorkspaceProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticsWorkspaceProperty = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties) content.GetValueForProperty("LogAnalyticsWorkspaceProperty",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticsWorkspaceProperty, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LogAnalyticsWorkspacePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringServiceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).PeeringServiceLocation = (string) content.GetValueForProperty("PeeringServiceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).PeeringServiceLocation, global::System.Convert.ToString); + } + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("ProviderPrimaryPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProviderPrimaryPeeringLocation = (string) content.GetValueForProperty("ProviderPrimaryPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProviderPrimaryPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("ProviderBackupPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProviderBackupPeeringLocation = (string) content.GetValueForProperty("ProviderBackupPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).ProviderBackupPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyWorkspaceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyWorkspaceId = (string) content.GetValueForProperty("LogAnalyticWorkspacePropertyWorkspaceId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyWorkspaceId, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyKey = (string) content.GetValueForProperty("LogAnalyticWorkspacePropertyKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyKey, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyConnectedAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyConnectedAgent = (string[]) content.GetValueForProperty("LogAnalyticWorkspacePropertyConnectedAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal)this).LogAnalyticWorkspacePropertyConnectedAgent, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Peering Service + [System.ComponentModel.TypeConverter(typeof(PeeringServiceTypeConverter))] + public partial interface IPeeringService + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringService.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringService.TypeConverter.cs new file mode 100644 index 000000000000..a2df82148517 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringService.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringService.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringService.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringService.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringService.cs b/src/Peering/generated/api/Models/Api20221001/PeeringService.cs new file mode 100644 index 000000000000..a28642de401a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringService.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Peering Service + public partial class PeeringService : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private string _location; + + /// The location of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 5)] + public string Location { get => this._location; set => this._location = value; } + + /// The list of connected agents. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string[] LogAnalyticWorkspacePropertyConnectedAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticWorkspacePropertyConnectedAgent; } + + /// The Workspace Key. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string LogAnalyticWorkspacePropertyKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticWorkspacePropertyKey; } + + /// The Workspace ID. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string LogAnalyticWorkspacePropertyWorkspaceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticWorkspacePropertyWorkspaceId; } + + /// Internal Acessors for LogAnalyticWorkspacePropertyConnectedAgent + string[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal.LogAnalyticWorkspacePropertyConnectedAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticWorkspacePropertyConnectedAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticWorkspacePropertyConnectedAgent = value; } + + /// Internal Acessors for LogAnalyticWorkspacePropertyKey + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal.LogAnalyticWorkspacePropertyKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticWorkspacePropertyKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticWorkspacePropertyKey = value; } + + /// Internal Acessors for LogAnalyticWorkspacePropertyWorkspaceId + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal.LogAnalyticWorkspacePropertyWorkspaceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticWorkspacePropertyWorkspaceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticWorkspacePropertyWorkspaceId = value; } + + /// Internal Acessors for LogAnalyticsWorkspaceProperty + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal.LogAnalyticsWorkspaceProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticsWorkspaceProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).LogAnalyticsWorkspaceProperty = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Sku + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceSku()); set { {_sku = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The location (state/province) of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public string PeeringServiceLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).PeeringServiceLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).PeeringServiceLocation = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties _property; + + /// The properties that define a peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProperties()); set => this._property = value; } + + /// The name of the service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 3)] + public string Provider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).PeeringServiceProvider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).PeeringServiceProvider = value ?? null; } + + /// + /// The backup peering (Microsoft/service provider) location to be used for customer traffic. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ProviderBackupPeeringLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).ProviderBackupPeeringLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).ProviderBackupPeeringLocation = value ?? null; } + + /// + /// The primary peering (Microsoft/service provider) location to be used for customer traffic. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ProviderPrimaryPeeringLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).ProviderPrimaryPeeringLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).ProviderPrimaryPeeringLocation = value ?? null; } + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 4)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku _sku; + + /// The SKU that defines the type of the peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceSku()); set => this._sku = value; } + + /// The name of the peering service SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSkuInternal)Sku).Name = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags _tag; + + /// The resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceTags()); set => this._tag = value; } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public PeeringService() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Peering Service + public partial interface IPeeringService : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The location of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The location of the resource.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// The list of connected agents. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of connected agents.", + SerializedName = @"connectedAgents", + PossibleTypes = new [] { typeof(string) })] + string[] LogAnalyticWorkspacePropertyConnectedAgent { get; } + /// The Workspace Key. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Workspace Key.", + SerializedName = @"key", + PossibleTypes = new [] { typeof(string) })] + string LogAnalyticWorkspacePropertyKey { get; } + /// The Workspace ID. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Workspace ID.", + SerializedName = @"workspaceID", + PossibleTypes = new [] { typeof(string) })] + string LogAnalyticWorkspacePropertyWorkspaceId { get; } + /// The location (state/province) of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The location (state/province) of the customer.", + SerializedName = @"peeringServiceLocation", + PossibleTypes = new [] { typeof(string) })] + string PeeringServiceLocation { get; set; } + /// The name of the service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the service provider.", + SerializedName = @"peeringServiceProvider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; set; } + /// + /// The backup peering (Microsoft/service provider) location to be used for customer traffic. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The backup peering (Microsoft/service provider) location to be used for customer traffic.", + SerializedName = @"providerBackupPeeringLocation", + PossibleTypes = new [] { typeof(string) })] + string ProviderBackupPeeringLocation { get; set; } + /// + /// The primary peering (Microsoft/service provider) location to be used for customer traffic. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary peering (Microsoft/service provider) location to be used for customer traffic.", + SerializedName = @"providerPrimaryPeeringLocation", + PossibleTypes = new [] { typeof(string) })] + string ProviderPrimaryPeeringLocation { get; set; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + /// The name of the peering service SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering service SKU.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string SkuName { get; set; } + /// The resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags Tag { get; set; } + + } + /// Peering Service + internal partial interface IPeeringServiceInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The location of the resource. + string Location { get; set; } + /// The list of connected agents. + string[] LogAnalyticWorkspacePropertyConnectedAgent { get; set; } + /// The Workspace Key. + string LogAnalyticWorkspacePropertyKey { get; set; } + /// The Workspace ID. + string LogAnalyticWorkspacePropertyWorkspaceId { get; set; } + /// The Log Analytics Workspace Properties + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties LogAnalyticsWorkspaceProperty { get; set; } + /// The location (state/province) of the customer. + string PeeringServiceLocation { get; set; } + /// The properties that define a peering service. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties Property { get; set; } + /// The name of the service provider. + string Provider { get; set; } + /// + /// The backup peering (Microsoft/service provider) location to be used for customer traffic. + /// + string ProviderBackupPeeringLocation { get; set; } + /// + /// The primary peering (Microsoft/service provider) location to be used for customer traffic. + /// + string ProviderPrimaryPeeringLocation { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + /// The SKU that defines the type of the peering service. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku Sku { get; set; } + /// The name of the peering service SKU. + string SkuName { get; set; } + /// The resource tags. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringService.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringService.json.cs new file mode 100644 index 000000000000..a5032b7bc41e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringService.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Peering Service + public partial class PeeringService + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringService(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringService(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceSku.FromJson(__jsonSku) : Sku;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProperties.FromJson(__jsonProperties) : Property;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._sku ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._sku.ToJson(null,serializationMode) : null, "sku" ,container.Add ); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.PowerShell.cs new file mode 100644 index 000000000000..68a4b02e7f15 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The peering service country. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceCountryTypeConverter))] + public partial class PeeringServiceCountry + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountry DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceCountry(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountry DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceCountry(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountry FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceCountry(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceCountry(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The peering service country. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceCountryTypeConverter))] + public partial interface IPeeringServiceCountry + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.TypeConverter.cs new file mode 100644 index 000000000000..bbf73df15086 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceCountryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountry ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountry).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceCountry.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceCountry.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceCountry.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.cs new file mode 100644 index 000000000000..b7f278da45eb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering service country. + public partial class PeeringServiceCountry : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountry, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public PeeringServiceCountry() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The peering service country. + public partial interface IPeeringServiceCountry : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + + } + /// The peering service country. + internal partial interface IPeeringServiceCountryInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.json.cs new file mode 100644 index 000000000000..98ed7ac55f7f --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountry.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering service country. + public partial class PeeringServiceCountry + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountry. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountry. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountry FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceCountry(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceCountry(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.PowerShell.cs new file mode 100644 index 000000000000..c145c01c61e6 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peering service countries. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceCountryListResultTypeConverter))] + public partial class PeeringServiceCountryListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceCountryListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceCountryListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceCountryListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceCountryListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peering service countries. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceCountryListResultTypeConverter))] + public partial interface IPeeringServiceCountryListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.TypeConverter.cs new file mode 100644 index 000000000000..e1df680722ab --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceCountryListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceCountryListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceCountryListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceCountryListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.cs new file mode 100644 index 000000000000..b665a7904e54 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering service countries. + public partial class PeeringServiceCountryListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peering service countries. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource[] _value; + + /// The list of peering service countries. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringServiceCountryListResult() + { + + } + } + /// The paginated list of peering service countries. + public partial interface IPeeringServiceCountryListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peering service countries. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peering service countries.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peering service countries. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peering service countries.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource[] Value { get; set; } + + } + /// The paginated list of peering service countries. + internal partial interface IPeeringServiceCountryListResultInternal + + { + /// The link to fetch the next page of peering service countries. + string NextLink { get; set; } + /// The list of peering service countries. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.json.cs new file mode 100644 index 000000000000..2e4541be631c --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceCountryListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering service countries. + public partial class PeeringServiceCountryListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceCountryListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceCountryListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.PowerShell.cs new file mode 100644 index 000000000000..4d258b593f3d --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peering services. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceListResultTypeConverter))] + public partial class PeeringServiceListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peering services. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceListResultTypeConverter))] + public partial interface IPeeringServiceListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.TypeConverter.cs new file mode 100644 index 000000000000..72eb790f82bb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.cs new file mode 100644 index 000000000000..bab88d97f6cc --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering services. + public partial class PeeringServiceListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peering services. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService[] _value; + + /// The list of peering services. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringServiceListResult() + { + + } + } + /// The paginated list of peering services. + public partial interface IPeeringServiceListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peering services. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peering services.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peering services. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peering services.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService[] Value { get; set; } + + } + /// The paginated list of peering services. + internal partial interface IPeeringServiceListResultInternal + + { + /// The link to fetch the next page of peering services. + string NextLink { get; set; } + /// The list of peering services. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.json.cs new file mode 100644 index 000000000000..a687000ce6e9 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering services. + public partial class PeeringServiceListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringService.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.PowerShell.cs new file mode 100644 index 000000000000..7687ad4cab05 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.PowerShell.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The peering service location. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceLocationTypeConverter))] + public partial class PeeringServiceLocation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceLocation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceLocation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceLocation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).AzureRegion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceLocation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal)this).AzureRegion, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The peering service location. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceLocationTypeConverter))] + public partial interface IPeeringServiceLocation + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.TypeConverter.cs new file mode 100644 index 000000000000..87d810583dc5 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceLocationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceLocation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceLocation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceLocation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.cs new file mode 100644 index 000000000000..72bade07a632 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering service location. + public partial class PeeringServiceLocation : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// Azure region for the location + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 3)] + public string AzureRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)Property).AzureRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)Property).AzureRegion = value ?? null; } + + /// Country of the customer + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public string Country { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)Property).Country; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)Property).Country = value ?? null; } + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties _property; + + /// The properties that define a peering service location. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationProperties()); set => this._property = value; } + + /// State of the customer + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)Property).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)Property).State = value ?? null; } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public PeeringServiceLocation() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The peering service location. + public partial interface IPeeringServiceLocation : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// Azure region for the location + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Azure region for the location", + SerializedName = @"azureRegion", + PossibleTypes = new [] { typeof(string) })] + string AzureRegion { get; set; } + /// Country of the customer + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Country of the customer", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// State of the customer + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"State of the customer", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + + } + /// The peering service location. + internal partial interface IPeeringServiceLocationInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// Azure region for the location + string AzureRegion { get; set; } + /// Country of the customer + string Country { get; set; } + /// The properties that define a peering service location. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties Property { get; set; } + /// State of the customer + string State { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.json.cs new file mode 100644 index 000000000000..af04a75a58f8 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocation.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering service location. + public partial class PeeringServiceLocation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceLocation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceLocation(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.PowerShell.cs new file mode 100644 index 000000000000..f12f9886915d --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peering service locations. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceLocationListResultTypeConverter))] + public partial class PeeringServiceLocationListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceLocationListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceLocationListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceLocationListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceLocationListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peering service locations. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceLocationListResultTypeConverter))] + public partial interface IPeeringServiceLocationListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.TypeConverter.cs new file mode 100644 index 000000000000..c966a8332710 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceLocationListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceLocationListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceLocationListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceLocationListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.cs new file mode 100644 index 000000000000..ea16160ee3b5 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering service locations. + public partial class PeeringServiceLocationListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peering service locations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation[] _value; + + /// The list of peering service locations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringServiceLocationListResult() + { + + } + } + /// The paginated list of peering service locations. + public partial interface IPeeringServiceLocationListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peering service locations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peering service locations.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peering service locations. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peering service locations.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation[] Value { get; set; } + + } + /// The paginated list of peering service locations. + internal partial interface IPeeringServiceLocationListResultInternal + + { + /// The link to fetch the next page of peering service locations. + string NextLink { get; set; } + /// The list of peering service locations. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.json.cs new file mode 100644 index 000000000000..b6ae3ff3cee6 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering service locations. + public partial class PeeringServiceLocationListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceLocationListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceLocationListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocation.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.PowerShell.cs new file mode 100644 index 000000000000..2455c6de5d51 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.PowerShell.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define connectivity to the Peering Service Location. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceLocationPropertiesTypeConverter))] + public partial class PeeringServiceLocationProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceLocationProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceLocationProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceLocationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).AzureRegion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceLocationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Country")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).Country = (string) content.GetValueForProperty("Country",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).Country, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal)this).AzureRegion, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define connectivity to the Peering Service Location. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceLocationPropertiesTypeConverter))] + public partial interface IPeeringServiceLocationProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.TypeConverter.cs new file mode 100644 index 000000000000..5d2fecdbd340 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceLocationPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceLocationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceLocationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceLocationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.cs new file mode 100644 index 000000000000..0a13374c7929 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define connectivity to the Peering Service Location. + public partial class PeeringServiceLocationProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationPropertiesInternal + { + + /// Backing field for property. + private string _azureRegion; + + /// Azure region for the location + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string AzureRegion { get => this._azureRegion; set => this._azureRegion = value; } + + /// Backing field for property. + private string _country; + + /// Country of the customer + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Country { get => this._country; set => this._country = value; } + + /// Backing field for property. + private string _state; + + /// State of the customer + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Creates an new instance. + public PeeringServiceLocationProperties() + { + + } + } + /// The properties that define connectivity to the Peering Service Location. + public partial interface IPeeringServiceLocationProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// Azure region for the location + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Azure region for the location", + SerializedName = @"azureRegion", + PossibleTypes = new [] { typeof(string) })] + string AzureRegion { get; set; } + /// Country of the customer + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Country of the customer", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + string Country { get; set; } + /// State of the customer + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"State of the customer", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + + } + /// The properties that define connectivity to the Peering Service Location. + internal partial interface IPeeringServiceLocationPropertiesInternal + + { + /// Azure region for the location + string AzureRegion { get; set; } + /// Country of the customer + string Country { get; set; } + /// State of the customer + string State { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.json.cs new file mode 100644 index 000000000000..8a50bbf5bce7 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceLocationProperties.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define connectivity to the Peering Service Location. + public partial class PeeringServiceLocationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceLocationProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceLocationProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_country = If( json?.PropertyT("country"), out var __jsonCountry) ? (string)__jsonCountry : (string)Country;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_azureRegion = If( json?.PropertyT("azureRegion"), out var __jsonAzureRegion) ? (string)__jsonAzureRegion : (string)AzureRegion;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._country)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._country.ToString()) : null, "country" ,container.Add ); + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + AddIf( null != (((object)this._azureRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._azureRegion.ToString()) : null, "azureRegion" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.PowerShell.cs new file mode 100644 index 000000000000..0f21bd19ed32 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.PowerShell.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The peering service prefix class. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePrefixTypeConverter))] + public partial class PeeringServicePrefix + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServicePrefix(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServicePrefix(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServicePrefix(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("LearnedType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).LearnedType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType?) content.GetValueForProperty("LearnedType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).LearnedType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("PrefixValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).PrefixValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState?) content.GetValueForProperty("PrefixValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).PrefixValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState.CreateFrom); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("Event")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Event = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[]) content.GetValueForProperty("Event",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Event, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixEventTypeConverter.ConvertFrom)); + } + if (content.Contains("Key")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Key = (string) content.GetValueForProperty("Key",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Key, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServicePrefix(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("LearnedType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).LearnedType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType?) content.GetValueForProperty("LearnedType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).LearnedType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("PrefixValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).PrefixValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState?) content.GetValueForProperty("PrefixValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).PrefixValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState.CreateFrom); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("Event")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Event = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[]) content.GetValueForProperty("Event",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Event, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixEventTypeConverter.ConvertFrom)); + } + if (content.Contains("Key")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Key = (string) content.GetValueForProperty("Key",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal)this).Key, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The peering service prefix class. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePrefixTypeConverter))] + public partial interface IPeeringServicePrefix + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.TypeConverter.cs new file mode 100644 index 000000000000..9a1a24d68067 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServicePrefixTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServicePrefix.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServicePrefix.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServicePrefix.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.cs new file mode 100644 index 000000000000..140b37dcd81e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering service prefix class. + public partial class PeeringServicePrefix : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The error message for validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).ErrorMessage; } + + /// The list of events for peering service prefix + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[] Event { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).Event; } + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// The peering service prefix key + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public string Key { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).PeeringServicePrefixKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).PeeringServicePrefixKey = value ?? null; } + + /// The prefix learned type + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 4)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType? LearnedType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).LearnedType; } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal.ErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).ErrorMessage = value; } + + /// Internal Acessors for Event + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal.Event { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).Event; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).Event = value; } + + /// Internal Acessors for LearnedType + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal.LearnedType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).LearnedType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).LearnedType = value; } + + /// Internal Acessors for PrefixValidationState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal.PrefixValidationState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).PrefixValidationState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).PrefixValidationState = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The prefix from which your traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string Prefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).Prefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).Prefix = value ?? null; } + + /// The prefix validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 3)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).PrefixValidationState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties _property; + + /// Gets or sets the peering prefix properties. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixProperties()); set => this._property = value; } + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 5)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public PeeringServicePrefix() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The peering service prefix class. + public partial interface IPeeringServicePrefix : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The error message for validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message for validation state", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The list of events for peering service prefix + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of events for peering service prefix", + SerializedName = @"events", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[] Event { get; } + /// The peering service prefix key + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The peering service prefix key", + SerializedName = @"peeringServicePrefixKey", + PossibleTypes = new [] { typeof(string) })] + string Key { get; set; } + /// The prefix learned type + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix learned type", + SerializedName = @"learnedType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType? LearnedType { get; } + /// The prefix from which your traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The prefix from which your traffic originates.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + string Prefix { get; set; } + /// The prefix validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix validation state", + SerializedName = @"prefixValidationState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + + } + /// The peering service prefix class. + internal partial interface IPeeringServicePrefixInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The error message for validation state + string ErrorMessage { get; set; } + /// The list of events for peering service prefix + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[] Event { get; set; } + /// The peering service prefix key + string Key { get; set; } + /// The prefix learned type + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType? LearnedType { get; set; } + /// The prefix from which your traffic originates. + string Prefix { get; set; } + /// The prefix validation state + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get; set; } + /// Gets or sets the peering prefix properties. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties Property { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.json.cs new file mode 100644 index 000000000000..912bae58ca91 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefix.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering service prefix class. + public partial class PeeringServicePrefix + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServicePrefix(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServicePrefix(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.PowerShell.cs new file mode 100644 index 000000000000..e38da15e854a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.PowerShell.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The details of the event associated with a prefix. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePrefixEventTypeConverter))] + public partial class PeeringServicePrefixEvent + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServicePrefixEvent(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServicePrefixEvent(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServicePrefixEvent(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EventTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventTimestamp = (global::System.DateTime?) content.GetValueForProperty("EventTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("EventSummary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventSummary = (string) content.GetValueForProperty("EventSummary",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventSummary, global::System.Convert.ToString); + } + if (content.Contains("EventLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventLevel = (string) content.GetValueForProperty("EventLevel",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventLevel, global::System.Convert.ToString); + } + if (content.Contains("EventDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventDescription = (string) content.GetValueForProperty("EventDescription",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventDescription, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServicePrefixEvent(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EventTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventTimestamp = (global::System.DateTime?) content.GetValueForProperty("EventTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("EventSummary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventSummary = (string) content.GetValueForProperty("EventSummary",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventSummary, global::System.Convert.ToString); + } + if (content.Contains("EventLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventLevel = (string) content.GetValueForProperty("EventLevel",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventLevel, global::System.Convert.ToString); + } + if (content.Contains("EventDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventDescription = (string) content.GetValueForProperty("EventDescription",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal)this).EventDescription, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The details of the event associated with a prefix. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePrefixEventTypeConverter))] + public partial interface IPeeringServicePrefixEvent + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.TypeConverter.cs new file mode 100644 index 000000000000..cc476f0d57bc --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServicePrefixEventTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServicePrefixEvent.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServicePrefixEvent.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServicePrefixEvent.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.cs new file mode 100644 index 000000000000..8eb41b176fd4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The details of the event associated with a prefix. + public partial class PeeringServicePrefixEvent : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal + { + + /// Backing field for property. + private string _eventDescription; + + /// The description of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string EventDescription { get => this._eventDescription; } + + /// Backing field for property. + private string _eventLevel; + + /// The level of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string EventLevel { get => this._eventLevel; } + + /// Backing field for property. + private string _eventSummary; + + /// The summary of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string EventSummary { get => this._eventSummary; } + + /// Backing field for property. + private global::System.DateTime? _eventTimestamp; + + /// The timestamp of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public global::System.DateTime? EventTimestamp { get => this._eventTimestamp; } + + /// Backing field for property. + private string _eventType; + + /// The type of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string EventType { get => this._eventType; } + + /// Internal Acessors for EventDescription + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal.EventDescription { get => this._eventDescription; set { {_eventDescription = value;} } } + + /// Internal Acessors for EventLevel + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal.EventLevel { get => this._eventLevel; set { {_eventLevel = value;} } } + + /// Internal Acessors for EventSummary + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal.EventSummary { get => this._eventSummary; set { {_eventSummary = value;} } } + + /// Internal Acessors for EventTimestamp + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal.EventTimestamp { get => this._eventTimestamp; set { {_eventTimestamp = value;} } } + + /// Internal Acessors for EventType + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEventInternal.EventType { get => this._eventType; set { {_eventType = value;} } } + + /// Creates an new instance. + public PeeringServicePrefixEvent() + { + + } + } + /// The details of the event associated with a prefix. + public partial interface IPeeringServicePrefixEvent : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The description of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The description of the event associated with a prefix.", + SerializedName = @"eventDescription", + PossibleTypes = new [] { typeof(string) })] + string EventDescription { get; } + /// The level of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The level of the event associated with a prefix.", + SerializedName = @"eventLevel", + PossibleTypes = new [] { typeof(string) })] + string EventLevel { get; } + /// The summary of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The summary of the event associated with a prefix.", + SerializedName = @"eventSummary", + PossibleTypes = new [] { typeof(string) })] + string EventSummary { get; } + /// The timestamp of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The timestamp of the event associated with a prefix.", + SerializedName = @"eventTimestamp", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EventTimestamp { get; } + /// The type of the event associated with a prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the event associated with a prefix.", + SerializedName = @"eventType", + PossibleTypes = new [] { typeof(string) })] + string EventType { get; } + + } + /// The details of the event associated with a prefix. + internal partial interface IPeeringServicePrefixEventInternal + + { + /// The description of the event associated with a prefix. + string EventDescription { get; set; } + /// The level of the event associated with a prefix. + string EventLevel { get; set; } + /// The summary of the event associated with a prefix. + string EventSummary { get; set; } + /// The timestamp of the event associated with a prefix. + global::System.DateTime? EventTimestamp { get; set; } + /// The type of the event associated with a prefix. + string EventType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.json.cs new file mode 100644 index 000000000000..d4c0e05ee6a4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixEvent.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The details of the event associated with a prefix. + public partial class PeeringServicePrefixEvent + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServicePrefixEvent(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServicePrefixEvent(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_eventTimestamp = If( json?.PropertyT("eventTimestamp"), out var __jsonEventTimestamp) ? global::System.DateTime.TryParse((string)__jsonEventTimestamp, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonEventTimestampValue) ? __jsonEventTimestampValue : EventTimestamp : EventTimestamp;} + {_eventType = If( json?.PropertyT("eventType"), out var __jsonEventType) ? (string)__jsonEventType : (string)EventType;} + {_eventSummary = If( json?.PropertyT("eventSummary"), out var __jsonEventSummary) ? (string)__jsonEventSummary : (string)EventSummary;} + {_eventLevel = If( json?.PropertyT("eventLevel"), out var __jsonEventLevel) ? (string)__jsonEventLevel : (string)EventLevel;} + {_eventDescription = If( json?.PropertyT("eventDescription"), out var __jsonEventDescription) ? (string)__jsonEventDescription : (string)EventDescription;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._eventTimestamp ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._eventTimestamp?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "eventTimestamp" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._eventType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._eventType.ToString()) : null, "eventType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._eventSummary)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._eventSummary.ToString()) : null, "eventSummary" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._eventLevel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._eventLevel.ToString()) : null, "eventLevel" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._eventDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._eventDescription.ToString()) : null, "eventDescription" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.PowerShell.cs new file mode 100644 index 000000000000..b6d460a33ef3 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peering service prefixes. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePrefixListResultTypeConverter))] + public partial class PeeringServicePrefixListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServicePrefixListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServicePrefixListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServicePrefixListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServicePrefixListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peering service prefixes. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePrefixListResultTypeConverter))] + public partial interface IPeeringServicePrefixListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.TypeConverter.cs new file mode 100644 index 000000000000..f7a4cdfb61cf --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServicePrefixListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServicePrefixListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServicePrefixListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServicePrefixListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.cs new file mode 100644 index 000000000000..52f65aff59ee --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering service prefixes. + public partial class PeeringServicePrefixListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peering service prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix[] _value; + + /// The list of peering service prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringServicePrefixListResult() + { + + } + } + /// The paginated list of peering service prefixes. + public partial interface IPeeringServicePrefixListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peering service prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peering service prefixes.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peering service prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peering service prefixes.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix[] Value { get; set; } + + } + /// The paginated list of peering service prefixes. + internal partial interface IPeeringServicePrefixListResultInternal + + { + /// The link to fetch the next page of peering service prefixes. + string NextLink { get; set; } + /// The list of peering service prefixes. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.json.cs new file mode 100644 index 000000000000..29faaa4e1eab --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering service prefixes. + public partial class PeeringServicePrefixListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServicePrefixListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServicePrefixListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefix.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.PowerShell.cs new file mode 100644 index 000000000000..244969f8068a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.PowerShell.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The peering service prefix properties class. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePrefixPropertiesTypeConverter))] + public partial class PeeringServicePrefixProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServicePrefixProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServicePrefixProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServicePrefixProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("PrefixValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).PrefixValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState?) content.GetValueForProperty("PrefixValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).PrefixValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState.CreateFrom); + } + if (content.Contains("LearnedType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).LearnedType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType?) content.GetValueForProperty("LearnedType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).LearnedType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType.CreateFrom); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("Event")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).Event = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[]) content.GetValueForProperty("Event",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).Event, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixEventTypeConverter.ConvertFrom)); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServicePrefixProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("PrefixValidationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).PrefixValidationState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState?) content.GetValueForProperty("PrefixValidationState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).PrefixValidationState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState.CreateFrom); + } + if (content.Contains("LearnedType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).LearnedType = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType?) content.GetValueForProperty("LearnedType",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).LearnedType, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType.CreateFrom); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("Event")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).Event = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[]) content.GetValueForProperty("Event",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).Event, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixEventTypeConverter.ConvertFrom)); + } + if (content.Contains("PeeringServicePrefixKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).PeeringServicePrefixKey = (string) content.GetValueForProperty("PeeringServicePrefixKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).PeeringServicePrefixKey, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The peering service prefix properties class. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePrefixPropertiesTypeConverter))] + public partial interface IPeeringServicePrefixProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.TypeConverter.cs new file mode 100644 index 000000000000..df16f571b4d7 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServicePrefixPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServicePrefixProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServicePrefixProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServicePrefixProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.cs new file mode 100644 index 000000000000..a0e1f054d4f8 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering service prefix properties class. + public partial class PeeringServicePrefixProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal + { + + /// Backing field for property. + private string _errorMessage; + + /// The error message for validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[] _event; + + /// The list of events for peering service prefix + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[] Event { get => this._event; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType? _learnedType; + + /// The prefix learned type + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType? LearnedType { get => this._learnedType; } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Internal Acessors for Event + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal.Event { get => this._event; set { {_event = value;} } } + + /// Internal Acessors for LearnedType + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal.LearnedType { get => this._learnedType; set { {_learnedType = value;} } } + + /// Internal Acessors for PrefixValidationState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal.PrefixValidationState { get => this._prefixValidationState; set { {_prefixValidationState = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private string _peeringServicePrefixKey; + + /// The peering service prefix key + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringServicePrefixKey { get => this._peeringServicePrefixKey; set => this._peeringServicePrefixKey = value; } + + /// Backing field for property. + private string _prefix; + + /// The prefix from which your traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Prefix { get => this._prefix; set => this._prefix = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? _prefixValidationState; + + /// The prefix validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get => this._prefixValidationState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? _provisioningState; + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Creates an new instance. + public PeeringServicePrefixProperties() + { + + } + } + /// The peering service prefix properties class. + public partial interface IPeeringServicePrefixProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The error message for validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message for validation state", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The list of events for peering service prefix + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of events for peering service prefix", + SerializedName = @"events", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[] Event { get; } + /// The prefix learned type + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix learned type", + SerializedName = @"learnedType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType? LearnedType { get; } + /// The peering service prefix key + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The peering service prefix key", + SerializedName = @"peeringServicePrefixKey", + PossibleTypes = new [] { typeof(string) })] + string PeeringServicePrefixKey { get; set; } + /// The prefix from which your traffic originates. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The prefix from which your traffic originates.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + string Prefix { get; set; } + /// The prefix validation state + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix validation state", + SerializedName = @"prefixValidationState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + + } + /// The peering service prefix properties class. + internal partial interface IPeeringServicePrefixPropertiesInternal + + { + /// The error message for validation state + string ErrorMessage { get; set; } + /// The list of events for peering service prefix + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent[] Event { get; set; } + /// The prefix learned type + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType? LearnedType { get; set; } + /// The peering service prefix key + string PeeringServicePrefixKey { get; set; } + /// The prefix from which your traffic originates. + string Prefix { get; set; } + /// The prefix validation state + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState? PrefixValidationState { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.json.cs new file mode 100644 index 000000000000..40585951c476 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServicePrefixProperties.json.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The peering service prefix properties class. + public partial class PeeringServicePrefixProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServicePrefixProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServicePrefixProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_prefix = If( json?.PropertyT("prefix"), out var __jsonPrefix) ? (string)__jsonPrefix : (string)Prefix;} + {_prefixValidationState = If( json?.PropertyT("prefixValidationState"), out var __jsonPrefixValidationState) ? (string)__jsonPrefixValidationState : (string)PrefixValidationState;} + {_learnedType = If( json?.PropertyT("learnedType"), out var __jsonLearnedType) ? (string)__jsonLearnedType : (string)LearnedType;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_event = If( json?.PropertyT("events"), out var __jsonEvents) ? If( __jsonEvents as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixEvent) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixEvent.FromJson(__u) )) ))() : null : Event;} + {_peeringServicePrefixKey = If( json?.PropertyT("peeringServicePrefixKey"), out var __jsonPeeringServicePrefixKey) ? (string)__jsonPeeringServicePrefixKey : (string)PeeringServicePrefixKey;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._prefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._prefix.ToString()) : null, "prefix" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._prefixValidationState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._prefixValidationState.ToString()) : null, "prefixValidationState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._learnedType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._learnedType.ToString()) : null, "learnedType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._event) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._event ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("events",__w); + } + } + AddIf( null != (((object)this._peeringServicePrefixKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringServicePrefixKey.ToString()) : null, "peeringServicePrefixKey" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.PowerShell.cs new file mode 100644 index 000000000000..fa9bc0919a44 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.PowerShell.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define connectivity to the Peering Service. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePropertiesTypeConverter))] + public partial class PeeringServiceProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LogAnalyticsWorkspaceProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticsWorkspaceProperty = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties) content.GetValueForProperty("LogAnalyticsWorkspaceProperty",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticsWorkspaceProperty, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LogAnalyticsWorkspacePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringServiceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).PeeringServiceLocation = (string) content.GetValueForProperty("PeeringServiceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).PeeringServiceLocation, global::System.Convert.ToString); + } + if (content.Contains("PeeringServiceProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).PeeringServiceProvider = (string) content.GetValueForProperty("PeeringServiceProvider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).PeeringServiceProvider, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ProviderPrimaryPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProviderPrimaryPeeringLocation = (string) content.GetValueForProperty("ProviderPrimaryPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProviderPrimaryPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("ProviderBackupPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProviderBackupPeeringLocation = (string) content.GetValueForProperty("ProviderBackupPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProviderBackupPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyWorkspaceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyWorkspaceId = (string) content.GetValueForProperty("LogAnalyticWorkspacePropertyWorkspaceId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyWorkspaceId, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyKey = (string) content.GetValueForProperty("LogAnalyticWorkspacePropertyKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyKey, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyConnectedAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyConnectedAgent = (string[]) content.GetValueForProperty("LogAnalyticWorkspacePropertyConnectedAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyConnectedAgent, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LogAnalyticsWorkspaceProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticsWorkspaceProperty = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties) content.GetValueForProperty("LogAnalyticsWorkspaceProperty",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticsWorkspaceProperty, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LogAnalyticsWorkspacePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("PeeringServiceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).PeeringServiceLocation = (string) content.GetValueForProperty("PeeringServiceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).PeeringServiceLocation, global::System.Convert.ToString); + } + if (content.Contains("PeeringServiceProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).PeeringServiceProvider = (string) content.GetValueForProperty("PeeringServiceProvider",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).PeeringServiceProvider, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ProviderPrimaryPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProviderPrimaryPeeringLocation = (string) content.GetValueForProperty("ProviderPrimaryPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProviderPrimaryPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("ProviderBackupPeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProviderBackupPeeringLocation = (string) content.GetValueForProperty("ProviderBackupPeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).ProviderBackupPeeringLocation, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyWorkspaceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyWorkspaceId = (string) content.GetValueForProperty("LogAnalyticWorkspacePropertyWorkspaceId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyWorkspaceId, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyKey = (string) content.GetValueForProperty("LogAnalyticWorkspacePropertyKey",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyKey, global::System.Convert.ToString); + } + if (content.Contains("LogAnalyticWorkspacePropertyConnectedAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyConnectedAgent = (string[]) content.GetValueForProperty("LogAnalyticWorkspacePropertyConnectedAgent",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal)this).LogAnalyticWorkspacePropertyConnectedAgent, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define connectivity to the Peering Service. + [System.ComponentModel.TypeConverter(typeof(PeeringServicePropertiesTypeConverter))] + public partial interface IPeeringServiceProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.TypeConverter.cs new file mode 100644 index 000000000000..17204b585286 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServicePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.cs new file mode 100644 index 000000000000..9814974d87a5 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define connectivity to the Peering Service. + public partial class PeeringServiceProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal + { + + /// The list of connected agents. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string[] LogAnalyticWorkspacePropertyConnectedAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)LogAnalyticsWorkspaceProperty).ConnectedAgent; } + + /// The Workspace Key. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string LogAnalyticWorkspacePropertyKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)LogAnalyticsWorkspaceProperty).Key; } + + /// The Workspace ID. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + public string LogAnalyticWorkspacePropertyWorkspaceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)LogAnalyticsWorkspaceProperty).WorkspaceId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties _logAnalyticsWorkspaceProperty; + + /// The Log Analytics Workspace Properties + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties LogAnalyticsWorkspaceProperty { get => (this._logAnalyticsWorkspaceProperty = this._logAnalyticsWorkspaceProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LogAnalyticsWorkspaceProperties()); set => this._logAnalyticsWorkspaceProperty = value; } + + /// Internal Acessors for LogAnalyticWorkspacePropertyConnectedAgent + string[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal.LogAnalyticWorkspacePropertyConnectedAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)LogAnalyticsWorkspaceProperty).ConnectedAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)LogAnalyticsWorkspaceProperty).ConnectedAgent = value; } + + /// Internal Acessors for LogAnalyticWorkspacePropertyKey + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal.LogAnalyticWorkspacePropertyKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)LogAnalyticsWorkspaceProperty).Key; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)LogAnalyticsWorkspaceProperty).Key = value; } + + /// Internal Acessors for LogAnalyticWorkspacePropertyWorkspaceId + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal.LogAnalyticWorkspacePropertyWorkspaceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)LogAnalyticsWorkspaceProperty).WorkspaceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspacePropertiesInternal)LogAnalyticsWorkspaceProperty).WorkspaceId = value; } + + /// Internal Acessors for LogAnalyticsWorkspaceProperty + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal.LogAnalyticsWorkspaceProperty { get => (this._logAnalyticsWorkspaceProperty = this._logAnalyticsWorkspaceProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LogAnalyticsWorkspaceProperties()); set { {_logAnalyticsWorkspaceProperty = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private string _peeringServiceLocation; + + /// The location (state/province) of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringServiceLocation { get => this._peeringServiceLocation; set => this._peeringServiceLocation = value; } + + /// Backing field for property. + private string _peeringServiceProvider; + + /// The name of the service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringServiceProvider { get => this._peeringServiceProvider; set => this._peeringServiceProvider = value; } + + /// Backing field for property. + private string _providerBackupPeeringLocation; + + /// + /// The backup peering (Microsoft/service provider) location to be used for customer traffic. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ProviderBackupPeeringLocation { get => this._providerBackupPeeringLocation; set => this._providerBackupPeeringLocation = value; } + + /// Backing field for property. + private string _providerPrimaryPeeringLocation; + + /// + /// The primary peering (Microsoft/service provider) location to be used for customer traffic. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ProviderPrimaryPeeringLocation { get => this._providerPrimaryPeeringLocation; set => this._providerPrimaryPeeringLocation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? _provisioningState; + + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Creates an new instance. + public PeeringServiceProperties() + { + + } + } + /// The properties that define connectivity to the Peering Service. + public partial interface IPeeringServiceProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The list of connected agents. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of connected agents.", + SerializedName = @"connectedAgents", + PossibleTypes = new [] { typeof(string) })] + string[] LogAnalyticWorkspacePropertyConnectedAgent { get; } + /// The Workspace Key. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Workspace Key.", + SerializedName = @"key", + PossibleTypes = new [] { typeof(string) })] + string LogAnalyticWorkspacePropertyKey { get; } + /// The Workspace ID. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Workspace ID.", + SerializedName = @"workspaceID", + PossibleTypes = new [] { typeof(string) })] + string LogAnalyticWorkspacePropertyWorkspaceId { get; } + /// The location (state/province) of the customer. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The location (state/province) of the customer.", + SerializedName = @"peeringServiceLocation", + PossibleTypes = new [] { typeof(string) })] + string PeeringServiceLocation { get; set; } + /// The name of the service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the service provider.", + SerializedName = @"peeringServiceProvider", + PossibleTypes = new [] { typeof(string) })] + string PeeringServiceProvider { get; set; } + /// + /// The backup peering (Microsoft/service provider) location to be used for customer traffic. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The backup peering (Microsoft/service provider) location to be used for customer traffic.", + SerializedName = @"providerBackupPeeringLocation", + PossibleTypes = new [] { typeof(string) })] + string ProviderBackupPeeringLocation { get; set; } + /// + /// The primary peering (Microsoft/service provider) location to be used for customer traffic. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary peering (Microsoft/service provider) location to be used for customer traffic.", + SerializedName = @"providerPrimaryPeeringLocation", + PossibleTypes = new [] { typeof(string) })] + string ProviderPrimaryPeeringLocation { get; set; } + /// The provisioning state of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state of the resource.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; } + + } + /// The properties that define connectivity to the Peering Service. + internal partial interface IPeeringServicePropertiesInternal + + { + /// The list of connected agents. + string[] LogAnalyticWorkspacePropertyConnectedAgent { get; set; } + /// The Workspace Key. + string LogAnalyticWorkspacePropertyKey { get; set; } + /// The Workspace ID. + string LogAnalyticWorkspacePropertyWorkspaceId { get; set; } + /// The Log Analytics Workspace Properties + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILogAnalyticsWorkspaceProperties LogAnalyticsWorkspaceProperty { get; set; } + /// The location (state/province) of the customer. + string PeeringServiceLocation { get; set; } + /// The name of the service provider. + string PeeringServiceProvider { get; set; } + /// + /// The backup peering (Microsoft/service provider) location to be used for customer traffic. + /// + string ProviderBackupPeeringLocation { get; set; } + /// + /// The primary peering (Microsoft/service provider) location to be used for customer traffic. + /// + string ProviderPrimaryPeeringLocation { get; set; } + /// The provisioning state of the resource. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.json.cs new file mode 100644 index 000000000000..0c6cb343efbd --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProperties.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define connectivity to the Peering Service. + public partial class PeeringServiceProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_logAnalyticsWorkspaceProperty = If( json?.PropertyT("logAnalyticsWorkspaceProperties"), out var __jsonLogAnalyticsWorkspaceProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LogAnalyticsWorkspaceProperties.FromJson(__jsonLogAnalyticsWorkspaceProperties) : LogAnalyticsWorkspaceProperty;} + {_peeringServiceLocation = If( json?.PropertyT("peeringServiceLocation"), out var __jsonPeeringServiceLocation) ? (string)__jsonPeeringServiceLocation : (string)PeeringServiceLocation;} + {_peeringServiceProvider = If( json?.PropertyT("peeringServiceProvider"), out var __jsonPeeringServiceProvider) ? (string)__jsonPeeringServiceProvider : (string)PeeringServiceProvider;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_providerPrimaryPeeringLocation = If( json?.PropertyT("providerPrimaryPeeringLocation"), out var __jsonProviderPrimaryPeeringLocation) ? (string)__jsonProviderPrimaryPeeringLocation : (string)ProviderPrimaryPeeringLocation;} + {_providerBackupPeeringLocation = If( json?.PropertyT("providerBackupPeeringLocation"), out var __jsonProviderBackupPeeringLocation) ? (string)__jsonProviderBackupPeeringLocation : (string)ProviderBackupPeeringLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._logAnalyticsWorkspaceProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._logAnalyticsWorkspaceProperty.ToJson(null,serializationMode) : null, "logAnalyticsWorkspaceProperties" ,container.Add ); + AddIf( null != (((object)this._peeringServiceLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringServiceLocation.ToString()) : null, "peeringServiceLocation" ,container.Add ); + AddIf( null != (((object)this._peeringServiceProvider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringServiceProvider.ToString()) : null, "peeringServiceProvider" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AddIf( null != (((object)this._providerPrimaryPeeringLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._providerPrimaryPeeringLocation.ToString()) : null, "providerPrimaryPeeringLocation" ,container.Add ); + AddIf( null != (((object)this._providerBackupPeeringLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._providerBackupPeeringLocation.ToString()) : null, "providerBackupPeeringLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.PowerShell.cs new file mode 100644 index 000000000000..c3c0069d5d06 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.PowerShell.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// PeeringService provider + [System.ComponentModel.TypeConverter(typeof(PeeringServiceProviderTypeConverter))] + public partial class PeeringServiceProvider + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceProvider(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceProvider(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceProvider(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ServiceProviderName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).ServiceProviderName = (string) content.GetValueForProperty("ServiceProviderName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).ServiceProviderName, global::System.Convert.ToString); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).PeeringLocation = (string[]) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).PeeringLocation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceProvider(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ServiceProviderName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).ServiceProviderName = (string) content.GetValueForProperty("ServiceProviderName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).ServiceProviderName, global::System.Convert.ToString); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).PeeringLocation = (string[]) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal)this).PeeringLocation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// PeeringService provider + [System.ComponentModel.TypeConverter(typeof(PeeringServiceProviderTypeConverter))] + public partial interface IPeeringServiceProvider + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.TypeConverter.cs new file mode 100644 index 000000000000..fec57f8b2bd8 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceProviderTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceProvider.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceProvider.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceProvider.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.cs new file mode 100644 index 000000000000..62c7afe8462a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// PeeringService provider + public partial class PeeringServiceProvider : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(); + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Name; } + + /// The list of locations at which the service provider peers with Microsoft. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string[] PeeringLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)Property).PeeringLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)Property).PeeringLocation = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties _property; + + /// The properties that define a peering service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + internal Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderProperties()); set => this._property = value; } + + /// The name of the service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inlined)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public string ServiceProviderName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)Property).ServiceProviderName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)Property).ServiceProviderName = value ?? null; } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Inherited)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.DoNotFormat] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public PeeringServiceProvider() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// PeeringService provider + public partial interface IPeeringServiceProvider : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + { + /// The list of locations at which the service provider peers with Microsoft. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of locations at which the service provider peers with Microsoft.", + SerializedName = @"peeringLocations", + PossibleTypes = new [] { typeof(string) })] + string[] PeeringLocation { get; set; } + /// The name of the service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the service provider.", + SerializedName = @"serviceProviderName", + PossibleTypes = new [] { typeof(string) })] + string ServiceProviderName { get; set; } + + } + /// PeeringService provider + internal partial interface IPeeringServiceProviderInternal : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + /// The list of locations at which the service provider peers with Microsoft. + string[] PeeringLocation { get; set; } + /// The properties that define a peering service provider. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties Property { get; set; } + /// The name of the service provider. + string ServiceProviderName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.json.cs new file mode 100644 index 000000000000..5c794c3921db --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProvider.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// PeeringService provider + public partial class PeeringServiceProvider + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceProvider(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceProvider(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.PowerShell.cs new file mode 100644 index 000000000000..2775c1e75ab4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of peering service providers. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceProviderListResultTypeConverter))] + public partial class PeeringServiceProviderListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceProviderListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceProviderListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceProviderListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceProviderListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of peering service providers. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceProviderListResultTypeConverter))] + public partial interface IPeeringServiceProviderListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.TypeConverter.cs new file mode 100644 index 000000000000..59ce10d808a8 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceProviderListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceProviderListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceProviderListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceProviderListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.cs new file mode 100644 index 000000000000..4df70924f95a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering service providers. + public partial class PeeringServiceProviderListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of peering service providers. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider[] _value; + + /// The list of peering service providers. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PeeringServiceProviderListResult() + { + + } + } + /// The paginated list of peering service providers. + public partial interface IPeeringServiceProviderListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of peering service providers. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of peering service providers.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of peering service providers. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of peering service providers.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider[] Value { get; set; } + + } + /// The paginated list of peering service providers. + internal partial interface IPeeringServiceProviderListResultInternal + + { + /// The link to fetch the next page of peering service providers. + string NextLink { get; set; } + /// The list of peering service providers. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.json.cs new file mode 100644 index 000000000000..a1e513d59915 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of peering service providers. + public partial class PeeringServiceProviderListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceProviderListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceProviderListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProvider.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.PowerShell.cs new file mode 100644 index 000000000000..8d452fbee4ca --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The properties that define connectivity to the Peering Service Provider. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceProviderPropertiesTypeConverter))] + public partial class PeeringServiceProviderProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceProviderProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceProviderProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceProviderProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceProviderName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)this).ServiceProviderName = (string) content.GetValueForProperty("ServiceProviderName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)this).ServiceProviderName, global::System.Convert.ToString); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)this).PeeringLocation = (string[]) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)this).PeeringLocation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceProviderProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceProviderName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)this).ServiceProviderName = (string) content.GetValueForProperty("ServiceProviderName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)this).ServiceProviderName, global::System.Convert.ToString); + } + if (content.Contains("PeeringLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)this).PeeringLocation = (string[]) content.GetValueForProperty("PeeringLocation",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal)this).PeeringLocation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The properties that define connectivity to the Peering Service Provider. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceProviderPropertiesTypeConverter))] + public partial interface IPeeringServiceProviderProperties + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.TypeConverter.cs new file mode 100644 index 000000000000..571d2465f84d --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceProviderPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceProviderProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceProviderProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceProviderProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.cs new file mode 100644 index 000000000000..9f718602a166 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define connectivity to the Peering Service Provider. + public partial class PeeringServiceProviderProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderPropertiesInternal + { + + /// Backing field for property. + private string[] _peeringLocation; + + /// The list of locations at which the service provider peers with Microsoft. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string[] PeeringLocation { get => this._peeringLocation; set => this._peeringLocation = value; } + + /// Backing field for property. + private string _serviceProviderName; + + /// The name of the service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ServiceProviderName { get => this._serviceProviderName; set => this._serviceProviderName = value; } + + /// Creates an new instance. + public PeeringServiceProviderProperties() + { + + } + } + /// The properties that define connectivity to the Peering Service Provider. + public partial interface IPeeringServiceProviderProperties : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The list of locations at which the service provider peers with Microsoft. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of locations at which the service provider peers with Microsoft.", + SerializedName = @"peeringLocations", + PossibleTypes = new [] { typeof(string) })] + string[] PeeringLocation { get; set; } + /// The name of the service provider. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the service provider.", + SerializedName = @"serviceProviderName", + PossibleTypes = new [] { typeof(string) })] + string ServiceProviderName { get; set; } + + } + /// The properties that define connectivity to the Peering Service Provider. + internal partial interface IPeeringServiceProviderPropertiesInternal + + { + /// The list of locations at which the service provider peers with Microsoft. + string[] PeeringLocation { get; set; } + /// The name of the service provider. + string ServiceProviderName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.json.cs new file mode 100644 index 000000000000..3865e5b3af91 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceProviderProperties.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The properties that define connectivity to the Peering Service Provider. + public partial class PeeringServiceProviderProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceProviderProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceProviderProperties(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_serviceProviderName = If( json?.PropertyT("serviceProviderName"), out var __jsonServiceProviderName) ? (string)__jsonServiceProviderName : (string)ServiceProviderName;} + {_peeringLocation = If( json?.PropertyT("peeringLocations"), out var __jsonPeeringLocations) ? If( __jsonPeeringLocations as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : PeeringLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._serviceProviderName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._serviceProviderName.ToString()) : null, "serviceProviderName" ,container.Add ); + if (null != this._peeringLocation) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._peeringLocation ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("peeringLocations",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.PowerShell.cs new file mode 100644 index 000000000000..4a178e0b3fab --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The SKU that defines the type of the peering service. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceSkuTypeConverter))] + public partial class PeeringServiceSku + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceSku(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceSku(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceSku(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSkuInternal)this).Name, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceSku(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSkuInternal)this).Name, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The SKU that defines the type of the peering service. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceSkuTypeConverter))] + public partial interface IPeeringServiceSku + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.TypeConverter.cs new file mode 100644 index 000000000000..5c5d3a4daa30 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceSkuTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceSku.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceSku.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceSku.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.cs new file mode 100644 index 000000000000..fa6667000c18 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The SKU that defines the type of the peering service. + public partial class PeeringServiceSku : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSkuInternal + { + + /// Backing field for property. + private string _name; + + /// The name of the peering service SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Creates an new instance. + public PeeringServiceSku() + { + + } + } + /// The SKU that defines the type of the peering service. + public partial interface IPeeringServiceSku : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The name of the peering service SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering service SKU.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + + } + /// The SKU that defines the type of the peering service. + internal partial interface IPeeringServiceSkuInternal + + { + /// The name of the peering service SKU. + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.json.cs new file mode 100644 index 000000000000..33ada51b6f4a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceSku.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The SKU that defines the type of the peering service. + public partial class PeeringServiceSku + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceSku FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceSku(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringServiceSku(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.PowerShell.cs new file mode 100644 index 000000000000..57b708969b22 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The resource tags. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceTagsTypeConverter))] + public partial class PeeringServiceTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringServiceTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringServiceTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringServiceTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringServiceTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The resource tags. + [System.ComponentModel.TypeConverter(typeof(PeeringServiceTagsTypeConverter))] + public partial interface IPeeringServiceTags + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.TypeConverter.cs new file mode 100644 index 000000000000..70630e3c15f6 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringServiceTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringServiceTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringServiceTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringServiceTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.cs new file mode 100644 index 000000000000..d9e2ba3ef3bd --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The resource tags. + public partial class PeeringServiceTags : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTagsInternal + { + + /// Creates an new instance. + public PeeringServiceTags() + { + + } + } + /// The resource tags. + public partial interface IPeeringServiceTags : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray + { + + } + /// The resource tags. + internal partial interface IPeeringServiceTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.dictionary.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.dictionary.cs new file mode 100644 index 000000000000..b1e1fd07ac09 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + public partial class PeeringServiceTags : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.json.cs new file mode 100644 index 000000000000..3eece057f588 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringServiceTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The resource tags. + public partial class PeeringServiceTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringServiceTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + /// + internal PeeringServiceTags(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringSku.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringSku.PowerShell.cs new file mode 100644 index 000000000000..7c017a71ff5d --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringSku.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The SKU that defines the tier and kind of the peering. + [System.ComponentModel.TypeConverter(typeof(PeeringSkuTypeConverter))] + public partial class PeeringSku + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringSku(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringSku(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringSku(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Tier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Tier = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier?) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Tier, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier.CreateFrom); + } + if (content.Contains("Family")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Family = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family?) content.GetValueForProperty("Family",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Family, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family.CreateFrom); + } + if (content.Contains("Size")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Size = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size?) content.GetValueForProperty("Size",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Size, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringSku(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Tier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Tier = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier?) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Tier, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier.CreateFrom); + } + if (content.Contains("Family")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Family = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family?) content.GetValueForProperty("Family",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Family, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family.CreateFrom); + } + if (content.Contains("Size")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Size = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size?) content.GetValueForProperty("Size",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal)this).Size, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The SKU that defines the tier and kind of the peering. + [System.ComponentModel.TypeConverter(typeof(PeeringSkuTypeConverter))] + public partial interface IPeeringSku + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringSku.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringSku.TypeConverter.cs new file mode 100644 index 000000000000..5da59ec304af --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringSku.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringSkuTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringSku.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringSku.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringSku.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringSku.cs b/src/Peering/generated/api/Models/Api20221001/PeeringSku.cs new file mode 100644 index 000000000000..61474ba8fbb7 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringSku.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The SKU that defines the tier and kind of the peering. + public partial class PeeringSku : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family? _family; + + /// The family of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family? Family { get => this._family; } + + /// Internal Acessors for Family + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal.Family { get => this._family; set { {_family = value;} } } + + /// Internal Acessors for Size + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal.Size { get => this._size; set { {_size = value;} } } + + /// Internal Acessors for Tier + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSkuInternal.Tier { get => this._tier; set { {_tier = value;} } } + + /// Backing field for property. + private string _name; + + /// The name of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size? _size; + + /// The size of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size? Size { get => this._size; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier? _tier; + + /// The tier of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier? Tier { get => this._tier; } + + /// Creates an new instance. + public PeeringSku() + { + + } + } + /// The SKU that defines the tier and kind of the peering. + public partial interface IPeeringSku : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The family of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The family of the peering SKU.", + SerializedName = @"family", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family? Family { get; } + /// The name of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering SKU.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The size of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The size of the peering SKU.", + SerializedName = @"size", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size? Size { get; } + /// The tier of the peering SKU. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tier of the peering SKU.", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier? Tier { get; } + + } + /// The SKU that defines the tier and kind of the peering. + internal partial interface IPeeringSkuInternal + + { + /// The family of the peering SKU. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family? Family { get; set; } + /// The name of the peering SKU. + string Name { get; set; } + /// The size of the peering SKU. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size? Size { get; set; } + /// The tier of the peering SKU. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier? Tier { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringSku.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringSku.json.cs new file mode 100644 index 000000000000..e7e87581c66b --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringSku.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The SKU that defines the tier and kind of the peering. + public partial class PeeringSku + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringSku FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringSku(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringSku(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_tier = If( json?.PropertyT("tier"), out var __jsonTier) ? (string)__jsonTier : (string)Tier;} + {_family = If( json?.PropertyT("family"), out var __jsonFamily) ? (string)__jsonFamily : (string)Family;} + {_size = If( json?.PropertyT("size"), out var __jsonSize) ? (string)__jsonSize : (string)Size;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._tier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._tier.ToString()) : null, "tier" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._family)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._family.ToString()) : null, "family" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._size)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._size.ToString()) : null, "size" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringTags.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/PeeringTags.PowerShell.cs new file mode 100644 index 000000000000..1b35ab42e4fa --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringTags.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The resource tags. + [System.ComponentModel.TypeConverter(typeof(PeeringTagsTypeConverter))] + public partial class PeeringTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The resource tags. + [System.ComponentModel.TypeConverter(typeof(PeeringTagsTypeConverter))] + public partial interface IPeeringTags + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringTags.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/PeeringTags.TypeConverter.cs new file mode 100644 index 000000000000..e09aee21a81f --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringTags.cs b/src/Peering/generated/api/Models/Api20221001/PeeringTags.cs new file mode 100644 index 000000000000..1018e367e835 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The resource tags. + public partial class PeeringTags : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTagsInternal + { + + /// Creates an new instance. + public PeeringTags() + { + + } + } + /// The resource tags. + public partial interface IPeeringTags : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray + { + + } + /// The resource tags. + internal partial interface IPeeringTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringTags.dictionary.cs b/src/Peering/generated/api/Models/Api20221001/PeeringTags.dictionary.cs new file mode 100644 index 000000000000..1b1e6e86e5eb --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + public partial class PeeringTags : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/PeeringTags.json.cs b/src/Peering/generated/api/Models/Api20221001/PeeringTags.json.cs new file mode 100644 index 000000000000..3c8b450a8489 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/PeeringTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The resource tags. + public partial class PeeringTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + /// + internal PeeringTags(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Resource.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/Resource.PowerShell.cs new file mode 100644 index 000000000000..bea14e9d806a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Resource.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The ARM resource class. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial class Resource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Resource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Resource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Resource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Resource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The ARM resource class. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial interface IResource + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Resource.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/Resource.TypeConverter.cs new file mode 100644 index 000000000000..d830c34017a2 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Resource.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Resource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Resource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Resource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Resource.cs b/src/Peering/generated/api/Models/Api20221001/Resource.cs new file mode 100644 index 000000000000..b6915d1291e4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Resource.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The ARM resource class. + public partial class Resource : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal + { + + /// Backing field for property. + private string _id; + + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _type; + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public Resource() + { + + } + } + /// The ARM resource class. + public partial interface IResource : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The ID of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ID of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// The ARM resource class. + internal partial interface IResourceInternal + + { + /// The ID of the resource. + string Id { get; set; } + /// The name of the resource. + string Name { get; set; } + /// The type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/Resource.json.cs b/src/Peering/generated/api/Models/Api20221001/Resource.json.cs new file mode 100644 index 000000000000..8e2e34744c13 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/Resource.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The ARM resource class. + public partial class Resource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new Resource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal Resource(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ResourceTags.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ResourceTags.PowerShell.cs new file mode 100644 index 000000000000..bb210bff4631 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ResourceTags.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// Gets or sets the tags, a dictionary of descriptors arm object + [System.ComponentModel.TypeConverter(typeof(ResourceTagsTypeConverter))] + public partial class ResourceTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Gets or sets the tags, a dictionary of descriptors arm object + [System.ComponentModel.TypeConverter(typeof(ResourceTagsTypeConverter))] + public partial interface IResourceTags + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ResourceTags.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ResourceTags.TypeConverter.cs new file mode 100644 index 000000000000..9d2e73393216 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ResourceTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ResourceTags.cs b/src/Peering/generated/api/Models/Api20221001/ResourceTags.cs new file mode 100644 index 000000000000..1bc95ea9cca4 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ResourceTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Gets or sets the tags, a dictionary of descriptors arm object + public partial class ResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTagsInternal + { + + /// Creates an new instance. + public ResourceTags() + { + + } + } + /// Gets or sets the tags, a dictionary of descriptors arm object + public partial interface IResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray + { + + } + /// Gets or sets the tags, a dictionary of descriptors arm object + internal partial interface IResourceTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ResourceTags.dictionary.cs b/src/Peering/generated/api/Models/Api20221001/ResourceTags.dictionary.cs new file mode 100644 index 000000000000..2c1211e52952 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ResourceTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + public partial class ResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ResourceTags.json.cs b/src/Peering/generated/api/Models/Api20221001/ResourceTags.json.cs new file mode 100644 index 000000000000..4bda3919f1b1 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ResourceTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Gets or sets the tags, a dictionary of descriptors arm object + public partial class ResourceTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ResourceTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ResourceTags(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ResourceTags1.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ResourceTags1.PowerShell.cs new file mode 100644 index 000000000000..e0e78bf2ff11 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ResourceTags1.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The resource tags. + [System.ComponentModel.TypeConverter(typeof(ResourceTags1TypeConverter))] + public partial class ResourceTags1 + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceTags1(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceTags1(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceTags1(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1Internal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1Internal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceTags1(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1Internal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1Internal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The resource tags. + [System.ComponentModel.TypeConverter(typeof(ResourceTags1TypeConverter))] + public partial interface IResourceTags1 + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ResourceTags1.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ResourceTags1.TypeConverter.cs new file mode 100644 index 000000000000..bd7a2acff5a7 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ResourceTags1.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTags1TypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceTags1.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceTags1.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceTags1.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ResourceTags1.cs b/src/Peering/generated/api/Models/Api20221001/ResourceTags1.cs new file mode 100644 index 000000000000..5a07f9530463 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ResourceTags1.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The resource tags. + public partial class ResourceTags1 : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1Internal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags _tag; + + /// Gets or sets the tags, a dictionary of descriptors arm object + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTags()); set => this._tag = value; } + + /// Creates an new instance. + public ResourceTags1() + { + + } + } + /// The resource tags. + public partial interface IResourceTags1 : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// Gets or sets the tags, a dictionary of descriptors arm object + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the tags, a dictionary of descriptors arm object", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags Tag { get; set; } + + } + /// The resource tags. + internal partial interface IResourceTags1Internal + + { + /// Gets or sets the tags, a dictionary of descriptors arm object + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ResourceTags1.json.cs b/src/Peering/generated/api/Models/Api20221001/ResourceTags1.json.cs new file mode 100644 index 000000000000..4e92a76c262d --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ResourceTags1.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The resource tags. + public partial class ResourceTags1 + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ResourceTags1(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceTags1(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.PowerShell.cs new file mode 100644 index 000000000000..d0a115c6f802 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The Routing Preference unbilled prefix + [System.ComponentModel.TypeConverter(typeof(RpUnbilledPrefixTypeConverter))] + public partial class RpUnbilledPrefix + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RpUnbilledPrefix(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RpUnbilledPrefix(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RpUnbilledPrefix(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("PeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).PeerAsn = (int?) content.GetValueForProperty("PeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).PeerAsn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RpUnbilledPrefix(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Prefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).Prefix = (string) content.GetValueForProperty("Prefix",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).Prefix, global::System.Convert.ToString); + } + if (content.Contains("AzureRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).AzureRegion = (string) content.GetValueForProperty("AzureRegion",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).AzureRegion, global::System.Convert.ToString); + } + if (content.Contains("PeerAsn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).PeerAsn = (int?) content.GetValueForProperty("PeerAsn",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal)this).PeerAsn, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Routing Preference unbilled prefix + [System.ComponentModel.TypeConverter(typeof(RpUnbilledPrefixTypeConverter))] + public partial interface IRpUnbilledPrefix + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.TypeConverter.cs new file mode 100644 index 000000000000..15aec4ac75e0 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RpUnbilledPrefixTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RpUnbilledPrefix.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RpUnbilledPrefix.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RpUnbilledPrefix.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.cs b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.cs new file mode 100644 index 000000000000..04d3b89f11b3 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The Routing Preference unbilled prefix + public partial class RpUnbilledPrefix : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal + { + + /// Backing field for property. + private string _azureRegion; + + /// The Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 1)] + public string AzureRegion { get => this._azureRegion; } + + /// Internal Acessors for AzureRegion + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal.AzureRegion { get => this._azureRegion; set { {_azureRegion = value;} } } + + /// Internal Acessors for PeerAsn + int? Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal.PeerAsn { get => this._peerAsn; set { {_peerAsn = value;} } } + + /// Internal Acessors for Prefix + string Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixInternal.Prefix { get => this._prefix; set { {_prefix = value;} } } + + /// Backing field for property. + private int? _peerAsn; + + /// The peer ASN. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 2)] + public int? PeerAsn { get => this._peerAsn; } + + /// Backing field for property. + private string _prefix; + + /// The prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.FormatTable(Index = 0)] + public string Prefix { get => this._prefix; } + + /// Creates an new instance. + public RpUnbilledPrefix() + { + + } + } + /// The Routing Preference unbilled prefix + public partial interface IRpUnbilledPrefix : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Azure region.", + SerializedName = @"azureRegion", + PossibleTypes = new [] { typeof(string) })] + string AzureRegion { get; } + /// The peer ASN. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The peer ASN.", + SerializedName = @"peerAsn", + PossibleTypes = new [] { typeof(int) })] + int? PeerAsn { get; } + /// The prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The prefix.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + string Prefix { get; } + + } + /// The Routing Preference unbilled prefix + internal partial interface IRpUnbilledPrefixInternal + + { + /// The Azure region. + string AzureRegion { get; set; } + /// The peer ASN. + int? PeerAsn { get; set; } + /// The prefix. + string Prefix { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.json.cs b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.json.cs new file mode 100644 index 000000000000..4aef4bc1c476 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefix.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The Routing Preference unbilled prefix + public partial class RpUnbilledPrefix + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new RpUnbilledPrefix(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal RpUnbilledPrefix(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_prefix = If( json?.PropertyT("prefix"), out var __jsonPrefix) ? (string)__jsonPrefix : (string)Prefix;} + {_azureRegion = If( json?.PropertyT("azureRegion"), out var __jsonAzureRegion) ? (string)__jsonAzureRegion : (string)AzureRegion;} + {_peerAsn = If( json?.PropertyT("peerAsn"), out var __jsonPeerAsn) ? (int?)__jsonPeerAsn : PeerAsn;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._prefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._prefix.ToString()) : null, "prefix" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._azureRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._azureRegion.ToString()) : null, "azureRegion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._peerAsn ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNumber((int)this._peerAsn) : null, "peerAsn" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.PowerShell.cs new file mode 100644 index 000000000000..f949737f864a --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The paginated list of RP unbilled prefixes. + [System.ComponentModel.TypeConverter(typeof(RpUnbilledPrefixListResultTypeConverter))] + public partial class RpUnbilledPrefixListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RpUnbilledPrefixListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RpUnbilledPrefixListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RpUnbilledPrefixListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.RpUnbilledPrefixTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RpUnbilledPrefixListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.RpUnbilledPrefixTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The paginated list of RP unbilled prefixes. + [System.ComponentModel.TypeConverter(typeof(RpUnbilledPrefixListResultTypeConverter))] + public partial interface IRpUnbilledPrefixListResult + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.TypeConverter.cs new file mode 100644 index 000000000000..bb1a2a11dd91 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RpUnbilledPrefixListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RpUnbilledPrefixListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RpUnbilledPrefixListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RpUnbilledPrefixListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.cs b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.cs new file mode 100644 index 000000000000..50a5da7a97bc --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of RP unbilled prefixes. + public partial class RpUnbilledPrefixListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The link to fetch the next page of RP unbilled prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix[] _value; + + /// The list of RP unbilled prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public RpUnbilledPrefixListResult() + { + + } + } + /// The paginated list of RP unbilled prefixes. + public partial interface IRpUnbilledPrefixListResult : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The link to fetch the next page of RP unbilled prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The link to fetch the next page of RP unbilled prefixes.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of RP unbilled prefixes. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of RP unbilled prefixes.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix[] Value { get; set; } + + } + /// The paginated list of RP unbilled prefixes. + internal partial interface IRpUnbilledPrefixListResultInternal + + { + /// The link to fetch the next page of RP unbilled prefixes. + string NextLink { get; set; } + /// The list of RP unbilled prefixes. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.json.cs b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.json.cs new file mode 100644 index 000000000000..87970241d070 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/RpUnbilledPrefixListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The paginated list of RP unbilled prefixes. + public partial class RpUnbilledPrefixListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new RpUnbilledPrefixListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal RpUnbilledPrefixListResult(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.RpUnbilledPrefix.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.PowerShell.cs new file mode 100644 index 000000000000..2b1b8e843d8d --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// Service specification payload. + [System.ComponentModel.TypeConverter(typeof(ServiceSpecificationTypeConverter))] + public partial class ServiceSpecification + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ServiceSpecification(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ServiceSpecification(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ServiceSpecification(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MetricSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecificationInternal)this).MetricSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[]) content.GetValueForProperty("MetricSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecificationInternal)this).MetricSpecification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricSpecificationTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ServiceSpecification(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MetricSpecification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecificationInternal)this).MetricSpecification = (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[]) content.GetValueForProperty("MetricSpecification",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecificationInternal)this).MetricSpecification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricSpecificationTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Service specification payload. + [System.ComponentModel.TypeConverter(typeof(ServiceSpecificationTypeConverter))] + public partial interface IServiceSpecification + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.TypeConverter.cs new file mode 100644 index 000000000000..e6cb94951100 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ServiceSpecificationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ServiceSpecification.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ServiceSpecification.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ServiceSpecification.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.cs b/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.cs new file mode 100644 index 000000000000..8861a1154c90 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Service specification payload. + public partial class ServiceSpecification : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecificationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] _metricSpecification; + + /// Specifications of the Metrics for Azure Monitoring. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] MetricSpecification { get => this._metricSpecification; } + + /// Internal Acessors for MetricSpecification + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecificationInternal.MetricSpecification { get => this._metricSpecification; set { {_metricSpecification = value;} } } + + /// Creates an new instance. + public ServiceSpecification() + { + + } + } + /// Service specification payload. + public partial interface IServiceSpecification : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// Specifications of the Metrics for Azure Monitoring. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifications of the Metrics for Azure Monitoring.", + SerializedName = @"metricSpecifications", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification) })] + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] MetricSpecification { get; } + + } + /// Service specification payload. + internal partial interface IServiceSpecificationInternal + + { + /// Specifications of the Metrics for Azure Monitoring. + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification[] MetricSpecification { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.json.cs b/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.json.cs new file mode 100644 index 000000000000..71f244a3af1e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/ServiceSpecification.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// Service specification payload. + public partial class ServiceSpecification + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IServiceSpecification FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new ServiceSpecification(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal ServiceSpecification(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_metricSpecification = If( json?.PropertyT("metricSpecifications"), out var __jsonMetricSpecifications) ? If( __jsonMetricSpecifications as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IMetricSpecification) (Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.MetricSpecification.FromJson(__u) )) ))() : null : MetricSpecification;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._metricSpecification) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.XNodeArray(); + foreach( var __x in this._metricSpecification ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("metricSpecifications",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/SubResource.PowerShell.cs b/src/Peering/generated/api/Models/Api20221001/SubResource.PowerShell.cs new file mode 100644 index 000000000000..87fab61b2154 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/SubResource.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// The sub resource. + [System.ComponentModel.TypeConverter(typeof(SubResourceTypeConverter))] + public partial class SubResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResourceInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SubResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResourceInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The sub resource. + [System.ComponentModel.TypeConverter(typeof(SubResourceTypeConverter))] + public partial interface ISubResource + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/SubResource.TypeConverter.cs b/src/Peering/generated/api/Models/Api20221001/SubResource.TypeConverter.cs new file mode 100644 index 000000000000..60667f602d61 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/SubResource.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/SubResource.cs b/src/Peering/generated/api/Models/Api20221001/SubResource.cs new file mode 100644 index 000000000000..a98603660b3e --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/SubResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The sub resource. + public partial class SubResource : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResourceInternal + { + + /// Backing field for property. + private string _id; + + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Creates an new instance. + public SubResource() + { + + } + } + /// The sub resource. + public partial interface ISubResource : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The identifier of the referenced resource. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identifier of the referenced resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + + } + /// The sub resource. + internal partial interface ISubResourceInternal + + { + /// The identifier of the referenced resource. + string Id { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/Api20221001/SubResource.json.cs b/src/Peering/generated/api/Models/Api20221001/SubResource.json.cs new file mode 100644 index 000000000000..1694cba22854 --- /dev/null +++ b/src/Peering/generated/api/Models/Api20221001/SubResource.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// The sub resource. + public partial class SubResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ISubResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new SubResource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal SubResource(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/PeeringIdentity.PowerShell.cs b/src/Peering/generated/api/Models/PeeringIdentity.PowerShell.cs new file mode 100644 index 000000000000..670ac2854c75 --- /dev/null +++ b/src/Peering/generated/api/Models/PeeringIdentity.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(PeeringIdentityTypeConverter))] + public partial class PeeringIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PeeringIdentity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PeeringIdentity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PeeringIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("PeerAsnName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeerAsnName = (string) content.GetValueForProperty("PeerAsnName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeerAsnName, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("PeeringName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeeringName = (string) content.GetValueForProperty("PeeringName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeeringName, global::System.Convert.ToString); + } + if (content.Contains("RegisteredAsnName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).RegisteredAsnName = (string) content.GetValueForProperty("RegisteredAsnName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).RegisteredAsnName, global::System.Convert.ToString); + } + if (content.Contains("RegisteredPrefixName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).RegisteredPrefixName = (string) content.GetValueForProperty("RegisteredPrefixName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).RegisteredPrefixName, global::System.Convert.ToString); + } + if (content.Contains("PeeringServiceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeeringServiceName = (string) content.GetValueForProperty("PeeringServiceName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeeringServiceName, global::System.Convert.ToString); + } + if (content.Contains("ConnectionMonitorTestName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).ConnectionMonitorTestName = (string) content.GetValueForProperty("ConnectionMonitorTestName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).ConnectionMonitorTestName, global::System.Convert.ToString); + } + if (content.Contains("PrefixName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PrefixName = (string) content.GetValueForProperty("PrefixName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PrefixName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PeeringIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("PeerAsnName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeerAsnName = (string) content.GetValueForProperty("PeerAsnName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeerAsnName, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("PeeringName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeeringName = (string) content.GetValueForProperty("PeeringName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeeringName, global::System.Convert.ToString); + } + if (content.Contains("RegisteredAsnName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).RegisteredAsnName = (string) content.GetValueForProperty("RegisteredAsnName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).RegisteredAsnName, global::System.Convert.ToString); + } + if (content.Contains("RegisteredPrefixName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).RegisteredPrefixName = (string) content.GetValueForProperty("RegisteredPrefixName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).RegisteredPrefixName, global::System.Convert.ToString); + } + if (content.Contains("PeeringServiceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeeringServiceName = (string) content.GetValueForProperty("PeeringServiceName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PeeringServiceName, global::System.Convert.ToString); + } + if (content.Contains("ConnectionMonitorTestName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).ConnectionMonitorTestName = (string) content.GetValueForProperty("ConnectionMonitorTestName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).ConnectionMonitorTestName, global::System.Convert.ToString); + } + if (content.Contains("PrefixName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PrefixName = (string) content.GetValueForProperty("PrefixName",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).PrefixName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(PeeringIdentityTypeConverter))] + public partial interface IPeeringIdentity + + { + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/PeeringIdentity.TypeConverter.cs b/src/Peering/generated/api/Models/PeeringIdentity.TypeConverter.cs new file mode 100644 index 000000000000..a292670767d1 --- /dev/null +++ b/src/Peering/generated/api/Models/PeeringIdentity.TypeConverter.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PeeringIdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + // we allow string conversion too. + if (type == typeof(global::System.String)) + { + return true; + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + // support direct string to id type conversion. + if (type == typeof(global::System.String)) + { + return new PeeringIdentity { Id = sourceValue }; + } + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PeeringIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PeeringIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PeeringIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/PeeringIdentity.cs b/src/Peering/generated/api/Models/PeeringIdentity.cs new file mode 100644 index 000000000000..21061967c1b1 --- /dev/null +++ b/src/Peering/generated/api/Models/PeeringIdentity.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + public partial class PeeringIdentity : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentityInternal + { + + /// Backing field for property. + private string _connectionMonitorTestName; + + /// The name of the connection monitor test + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ConnectionMonitorTestName { get => this._connectionMonitorTestName; set => this._connectionMonitorTestName = value; } + + /// Backing field for property. + private string _id; + + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _peerAsnName; + + /// The peer ASN name. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeerAsnName { get => this._peerAsnName; set => this._peerAsnName = value; } + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// Backing field for property. + private string _peeringServiceName; + + /// The name of the peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PeeringServiceName { get => this._peeringServiceName; set => this._peeringServiceName = value; } + + /// Backing field for property. + private string _prefixName; + + /// The name of the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string PrefixName { get => this._prefixName; set => this._prefixName = value; } + + /// Backing field for property. + private string _registeredAsnName; + + /// The name of the registered ASN. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string RegisteredAsnName { get => this._registeredAsnName; set => this._registeredAsnName = value; } + + /// Backing field for property. + private string _registeredPrefixName; + + /// The name of the registered prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string RegisteredPrefixName { get => this._registeredPrefixName; set => this._registeredPrefixName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Origin(Microsoft.Azure.PowerShell.Cmdlets.Peering.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public PeeringIdentity() + { + + } + } + public partial interface IPeeringIdentity : + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable + { + /// The name of the connection monitor test + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the connection monitor test", + SerializedName = @"connectionMonitorTestName", + PossibleTypes = new [] { typeof(string) })] + string ConnectionMonitorTestName { get; set; } + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource identity path", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The peer ASN name. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The peer ASN name.", + SerializedName = @"peerAsnName", + PossibleTypes = new [] { typeof(string) })] + string PeerAsnName { get; set; } + /// The name of the peering. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + string PeeringName { get; set; } + /// The name of the peering service. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + string PeeringServiceName { get; set; } + /// The name of the prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the prefix.", + SerializedName = @"prefixName", + PossibleTypes = new [] { typeof(string) })] + string PrefixName { get; set; } + /// The name of the registered ASN. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the registered ASN.", + SerializedName = @"registeredAsnName", + PossibleTypes = new [] { typeof(string) })] + string RegisteredAsnName { get; set; } + /// The name of the registered prefix. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the registered prefix.", + SerializedName = @"registeredPrefixName", + PossibleTypes = new [] { typeof(string) })] + string RegisteredPrefixName { get; set; } + /// The name of the resource group. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroupName { get; set; } + /// The Azure subscription ID. + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + + } + internal partial interface IPeeringIdentityInternal + + { + /// The name of the connection monitor test + string ConnectionMonitorTestName { get; set; } + /// Resource identity path + string Id { get; set; } + /// The peer ASN name. + string PeerAsnName { get; set; } + /// The name of the peering. + string PeeringName { get; set; } + /// The name of the peering service. + string PeeringServiceName { get; set; } + /// The name of the prefix. + string PrefixName { get; set; } + /// The name of the registered ASN. + string RegisteredAsnName { get; set; } + /// The name of the registered prefix. + string RegisteredPrefixName { get; set; } + /// The name of the resource group. + string ResourceGroupName { get; set; } + /// The Azure subscription ID. + string SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Models/PeeringIdentity.json.cs b/src/Peering/generated/api/Models/PeeringIdentity.json.cs new file mode 100644 index 000000000000..df195fb8c611 --- /dev/null +++ b/src/Peering/generated/api/Models/PeeringIdentity.json.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + public partial class PeeringIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new PeeringIdentity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject instance to deserialize from. + internal PeeringIdentity(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_peerAsnName = If( json?.PropertyT("peerAsnName"), out var __jsonPeerAsnName) ? (string)__jsonPeerAsnName : (string)PeerAsnName;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} + {_peeringName = If( json?.PropertyT("peeringName"), out var __jsonPeeringName) ? (string)__jsonPeeringName : (string)PeeringName;} + {_registeredAsnName = If( json?.PropertyT("registeredAsnName"), out var __jsonRegisteredAsnName) ? (string)__jsonRegisteredAsnName : (string)RegisteredAsnName;} + {_registeredPrefixName = If( json?.PropertyT("registeredPrefixName"), out var __jsonRegisteredPrefixName) ? (string)__jsonRegisteredPrefixName : (string)RegisteredPrefixName;} + {_peeringServiceName = If( json?.PropertyT("peeringServiceName"), out var __jsonPeeringServiceName) ? (string)__jsonPeeringServiceName : (string)PeeringServiceName;} + {_connectionMonitorTestName = If( json?.PropertyT("connectionMonitorTestName"), out var __jsonConnectionMonitorTestName) ? (string)__jsonConnectionMonitorTestName : (string)ConnectionMonitorTestName;} + {_prefixName = If( json?.PropertyT("prefixName"), out var __jsonPrefixName) ? (string)__jsonPrefixName : (string)PrefixName;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AddIf( null != (((object)this._peerAsnName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peerAsnName.ToString()) : null, "peerAsnName" ,container.Add ); + AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); + AddIf( null != (((object)this._peeringName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringName.ToString()) : null, "peeringName" ,container.Add ); + AddIf( null != (((object)this._registeredAsnName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._registeredAsnName.ToString()) : null, "registeredAsnName" ,container.Add ); + AddIf( null != (((object)this._registeredPrefixName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._registeredPrefixName.ToString()) : null, "registeredPrefixName" ,container.Add ); + AddIf( null != (((object)this._peeringServiceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._peeringServiceName.ToString()) : null, "peeringServiceName" ,container.Add ); + AddIf( null != (((object)this._connectionMonitorTestName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._connectionMonitorTestName.ToString()) : null, "connectionMonitorTestName" ,container.Add ); + AddIf( null != (((object)this._prefixName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._prefixName.ToString()) : null, "prefixName" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Peering.cs b/src/Peering/generated/api/Peering.cs new file mode 100644 index 000000000000..b69f3b30d025 --- /dev/null +++ b/src/Peering/generated/api/Peering.cs @@ -0,0 +1,7944 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + /// + /// Low-level API implementation for the Peering service. + /// APIs to manage Peering resources through the Azure Resource Manager. + /// + public partial class Peering + { + + /// Lists all of the advertised prefixes for the specified peering location + /// The peering location. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task CdnPeeringPrefixesList(string peeringLocation, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/cdnPeeringPrefixes" + + "?" + + "peeringLocation=" + global::System.Uri.EscapeDataString(peeringLocation) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.CdnPeeringPrefixesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the advertised prefixes for the specified peering location + /// + /// The peering location. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task CdnPeeringPrefixesListViaIdentity(global::System.String viaIdentity, string peeringLocation, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/cdnPeeringPrefixes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/cdnPeeringPrefixes'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/cdnPeeringPrefixes" + + "?" + + "peeringLocation=" + global::System.Uri.EscapeDataString(peeringLocation) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.CdnPeeringPrefixesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task CdnPeeringPrefixesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CdnPeeringPrefixListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The peering location. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task CdnPeeringPrefixesList_Validate(string peeringLocation, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(peeringLocation),peeringLocation); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Checks if the peering service provider is present within 1000 miles of customer's location + /// + /// The Azure subscription ID. + /// The CheckServiceProviderAvailabilityInput indicating customer location and service provider. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task CheckServiceProviderAvailability(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/checkServiceProviderAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.CheckServiceProviderAvailability_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Checks if the peering service provider is present within 1000 miles of customer's location + /// + /// + /// The CheckServiceProviderAvailabilityInput indicating customer location and service provider. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task CheckServiceProviderAvailabilityViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/checkServiceProviderAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.CheckServiceProviderAvailability_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task CheckServiceProviderAvailability_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => body.Result)); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The Azure subscription ID. + /// The CheckServiceProviderAvailabilityInput indicating customer location and service provider. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task CheckServiceProviderAvailability_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Creates or updates a connection monitor test with the specified name under the given subscription, resource group and + /// peering service. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the connection monitor test + /// The Azure subscription ID. + /// The properties needed to create a connection monitor test + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ConnectionMonitorTestsCreateOrUpdate(string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "/connectionMonitorTests/" + + global::System.Uri.EscapeDataString(connectionMonitorTestName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConnectionMonitorTestsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Creates or updates a connection monitor test with the specified name under the given subscription, resource group and + /// peering service. + /// + /// + /// The properties needed to create a connection monitor test + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ConnectionMonitorTestsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)/connectionMonitorTests/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var connectionMonitorTestName = _match.Groups["connectionMonitorTestName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "/connectionMonitorTests/" + + connectionMonitorTestName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConnectionMonitorTestsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ConnectionMonitorTestsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTest.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTest.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the connection monitor test + /// The Azure subscription ID. + /// The properties needed to create a connection monitor test + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ConnectionMonitorTestsCreateOrUpdate_Validate(string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(connectionMonitorTestName),connectionMonitorTestName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering + /// service. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the connection monitor test + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ConnectionMonitorTestsDelete(string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "/connectionMonitorTests/" + + global::System.Uri.EscapeDataString(connectionMonitorTestName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConnectionMonitorTestsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// + /// Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering + /// service. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ConnectionMonitorTestsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)/connectionMonitorTests/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var connectionMonitorTestName = _match.Groups["connectionMonitorTestName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "/connectionMonitorTests/" + + connectionMonitorTestName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConnectionMonitorTestsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ConnectionMonitorTestsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the connection monitor test + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ConnectionMonitorTestsDelete_Validate(string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(connectionMonitorTestName),connectionMonitorTestName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering + /// service. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the connection monitor test + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ConnectionMonitorTestsGet(string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "/connectionMonitorTests/" + + global::System.Uri.EscapeDataString(connectionMonitorTestName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConnectionMonitorTestsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering + /// service. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ConnectionMonitorTestsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)/connectionMonitorTests/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var connectionMonitorTestName = _match.Groups["connectionMonitorTestName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "/connectionMonitorTests/" + + connectionMonitorTestName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConnectionMonitorTestsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ConnectionMonitorTestsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTest.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the connection monitor test + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ConnectionMonitorTestsGet_Validate(string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(connectionMonitorTestName),connectionMonitorTestName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Lists all connection monitor tests under the given subscription, resource group and peering service. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ConnectionMonitorTestsListByPeeringService(string resourceGroupName, string peeringServiceName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "/connectionMonitorTests" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConnectionMonitorTestsListByPeeringService_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all connection monitor tests under the given subscription, resource group and peering service. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ConnectionMonitorTestsListByPeeringServiceViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)/connectionMonitorTests$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "/connectionMonitorTests" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ConnectionMonitorTestsListByPeeringService_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ConnectionMonitorTestsListByPeeringService_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTestListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ConnectionMonitorTestsListByPeeringService_Validate(string resourceGroupName, string peeringServiceName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Lists all of the legacy peerings under the given subscription matching the specified kind and location. + /// + /// The location of the peering. + /// The kind of the peering. + /// The ASN number associated with a legacy peering. + /// The direct peering type. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LegacyPeeringsList(string peeringLocation, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind kind, int? asn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? directPeeringType, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/legacyPeerings" + + "?" + + "peeringLocation=" + global::System.Uri.EscapeDataString(peeringLocation) + + "&" + + "kind=" + global::System.Uri.EscapeDataString(kind) + + "&" + + (null == asn ? global::System.String.Empty : "asn=" + global::System.Uri.EscapeDataString(asn.ToString())) + + "&" + + (string.IsNullOrEmpty(directPeeringType) ? global::System.String.Empty : "directPeeringType=" + global::System.Uri.EscapeDataString(directPeeringType)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LegacyPeeringsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the legacy peerings under the given subscription matching the specified kind and location. + /// + /// + /// The location of the peering. + /// The kind of the peering. + /// The ASN number associated with a legacy peering. + /// The direct peering type. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LegacyPeeringsListViaIdentity(global::System.String viaIdentity, string peeringLocation, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind kind, int? asn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? directPeeringType, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/legacyPeerings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/legacyPeerings'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/legacyPeerings" + + "?" + + "peeringLocation=" + global::System.Uri.EscapeDataString(peeringLocation) + + "&" + + "kind=" + global::System.Uri.EscapeDataString(kind) + + "&" + + (null == asn ? global::System.String.Empty : "asn=" + global::System.Uri.EscapeDataString(asn.ToString())) + + "&" + + (string.IsNullOrEmpty(directPeeringType) ? global::System.String.Empty : "directPeeringType=" + global::System.Uri.EscapeDataString(directPeeringType)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LegacyPeeringsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LegacyPeeringsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The location of the peering. + /// The kind of the peering. + /// The ASN number associated with a legacy peering. + /// The direct peering type. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LegacyPeeringsList_Validate(string peeringLocation, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind kind, int? asn, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType? directPeeringType, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(peeringLocation),peeringLocation); + await eventListener.AssertNotNull(nameof(kind),kind); + await eventListener.AssertEnum(nameof(kind),kind,@"Direct", @"Exchange"); + await eventListener.AssertNotNull(nameof(directPeeringType),directPeeringType); + await eventListener.AssertEnum(nameof(directPeeringType),directPeeringType,@"Edge", @"Transit", @"Cdn", @"Internal", @"Ix", @"IxRs", @"Voice", @"EdgeZoneForOperators"); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Run looking glass functionality + /// The command to be executed: ping, traceroute, bgpRoute. + /// The type of the source: Edge site or Azure Region. + /// The location of the source. + /// The IP address of the destination. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LookingGlassInvoke(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand command, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/lookingGlass" + + "?" + + "command=" + global::System.Uri.EscapeDataString(command) + + "&" + + "sourceType=" + global::System.Uri.EscapeDataString(sourceType) + + "&" + + "sourceLocation=" + global::System.Uri.EscapeDataString(sourceLocation) + + "&" + + "destinationIP=" + global::System.Uri.EscapeDataString(destinationIP) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LookingGlassInvoke_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Run looking glass functionality + /// + /// The command to be executed: ping, traceroute, bgpRoute. + /// The type of the source: Edge site or Azure Region. + /// The location of the source. + /// The IP address of the destination. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LookingGlassInvokeViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand command, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/lookingGlass'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/lookingGlass" + + "?" + + "command=" + global::System.Uri.EscapeDataString(command) + + "&" + + "sourceType=" + global::System.Uri.EscapeDataString(sourceType) + + "&" + + "sourceLocation=" + global::System.Uri.EscapeDataString(sourceLocation) + + "&" + + "destinationIP=" + global::System.Uri.EscapeDataString(destinationIP) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LookingGlassInvoke_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LookingGlassInvoke_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.LookingGlassOutput.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The command to be executed: ping, traceroute, bgpRoute. + /// The type of the source: Edge site or Azure Region. + /// The location of the source. + /// The IP address of the destination. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LookingGlassInvoke_Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand command, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(command),command); + await eventListener.AssertEnum(nameof(command),command,@"Traceroute", @"Ping", @"BgpRoute"); + await eventListener.AssertNotNull(nameof(sourceType),sourceType); + await eventListener.AssertEnum(nameof(sourceType),sourceType,@"EdgeSite", @"AzureRegion"); + await eventListener.AssertNotNull(nameof(sourceLocation),sourceLocation); + await eventListener.AssertNotNull(nameof(destinationIP),destinationIP); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all of the available API operations for peering resources. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Peering/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the available API operations for peering resources. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Peering/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Peering/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Peering/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + + } + } + + /// + /// Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + /// + /// The peer ASN name. + /// The Azure subscription ID. + /// The peer ASN. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeerAsnsCreateOrUpdate(string peerAsnName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peerAsns/" + + global::System.Uri.EscapeDataString(peerAsnName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeerAsnsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + /// + /// + /// The peer ASN. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeerAsnsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peerAsns/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}'"); + } + + // replace URI parameters with values from identity + var peerAsnName = _match.Groups["peerAsnName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peerAsns/" + + peerAsnName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeerAsnsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeerAsnsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsn.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsn.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The peer ASN name. + /// The Azure subscription ID. + /// The peer ASN. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeerAsnsCreateOrUpdate_Validate(string peerAsnName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(peerAsnName),peerAsnName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Deletes an existing peer ASN with the specified name under the given subscription. + /// + /// The peer ASN name. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeerAsnsDelete(string peerAsnName, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peerAsns/" + + global::System.Uri.EscapeDataString(peerAsnName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeerAsnsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// + /// Deletes an existing peer ASN with the specified name under the given subscription. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeerAsnsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peerAsns/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}'"); + } + + // replace URI parameters with values from identity + var peerAsnName = _match.Groups["peerAsnName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peerAsns/" + + peerAsnName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeerAsnsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeerAsnsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The peer ASN name. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeerAsnsDelete_Validate(string peerAsnName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(peerAsnName),peerAsnName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Gets the peer ASN with the specified name under the given subscription. + /// The peer ASN name. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeerAsnsGet(string peerAsnName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peerAsns/" + + global::System.Uri.EscapeDataString(peerAsnName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeerAsnsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets the peer ASN with the specified name under the given subscription. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeerAsnsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peerAsns/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}'"); + } + + // replace URI parameters with values from identity + var peerAsnName = _match.Groups["peerAsnName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peerAsns/" + + peerAsnName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeerAsnsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeerAsnsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsn.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// The peer ASN name. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeerAsnsGet_Validate(string peerAsnName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(peerAsnName),peerAsnName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all of the peer ASNs under the given subscription. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeerAsnsListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peerAsns" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeerAsnsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the peer ASNs under the given subscription. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeerAsnsListBySubscriptionViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peerAsns$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peerAsns" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeerAsnsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeerAsnsListBySubscription_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsnListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeerAsnsListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all of the available peering locations for the specified kind of peering. + /// The kind of the peering. + /// The type of direct peering. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringLocationsList(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind kind, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType? directPeeringType, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peeringLocations" + + "?" + + "kind=" + global::System.Uri.EscapeDataString(kind) + + "&" + + (string.IsNullOrEmpty(directPeeringType) ? global::System.String.Empty : "directPeeringType=" + global::System.Uri.EscapeDataString(directPeeringType)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringLocationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the available peering locations for the specified kind of peering. + /// + /// The kind of the peering. + /// The type of direct peering. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringLocationsListViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind kind, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType? directPeeringType, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peeringLocations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peeringLocations" + + "?" + + "kind=" + global::System.Uri.EscapeDataString(kind) + + "&" + + (string.IsNullOrEmpty(directPeeringType) ? global::System.String.Empty : "directPeeringType=" + global::System.Uri.EscapeDataString(directPeeringType)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringLocationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringLocationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringLocationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The kind of the peering. + /// The type of direct peering. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringLocationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind kind, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType? directPeeringType, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(kind),kind); + await eventListener.AssertEnum(nameof(kind),kind,@"Direct", @"Exchange"); + await eventListener.AssertNotNull(nameof(directPeeringType),directPeeringType); + await eventListener.AssertEnum(nameof(directPeeringType),directPeeringType,@"Edge", @"Transit", @"Cdn", @"Internal", @"Ix", @"IxRs", @"Voice", @"EdgeZoneForOperators"); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all of the available countries for peering service. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServiceCountriesList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peeringServiceCountries" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServiceCountriesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the available countries for peering service. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServiceCountriesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peeringServiceCountries$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peeringServiceCountries" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServiceCountriesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServiceCountriesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceCountryListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServiceCountriesList_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all of the available locations for peering service. + /// The country of interest, in which the locations are to be present. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServiceLocationsList(string country, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peeringServiceLocations" + + "?" + + (string.IsNullOrEmpty(country) ? global::System.String.Empty : "country=" + global::System.Uri.EscapeDataString(country)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServiceLocationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the available locations for peering service. + /// + /// The country of interest, in which the locations are to be present. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServiceLocationsListViaIdentity(global::System.String viaIdentity, string country, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peeringServiceLocations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceLocations'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peeringServiceLocations" + + "?" + + (string.IsNullOrEmpty(country) ? global::System.String.Empty : "country=" + global::System.Uri.EscapeDataString(country)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServiceLocationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServiceLocationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceLocationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The country of interest, in which the locations are to be present. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServiceLocationsList_Validate(string country, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(country),country); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Lists all of the available peering service locations for the specified kind of peering. + /// + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServiceProvidersList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peeringServiceProviders" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServiceProvidersList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the available peering service locations for the specified kind of peering. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServiceProvidersListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peeringServiceProviders$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceProviders'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peeringServiceProviders" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServiceProvidersList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServiceProvidersList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceProviderListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServiceProvidersList_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Creates a new peering service or updates an existing peering with the specified name under the given subscription and + /// resource group. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The Azure subscription ID. + /// The properties needed to create or update a peering service. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesCreateOrUpdate(string resourceGroupName, string peeringServiceName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Creates a new peering service or updates an existing peering with the specified name under the given subscription and + /// resource group. + /// + /// + /// The properties needed to create or update a peering service. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringService.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringService.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The Azure subscription ID. + /// The properties needed to create or update a peering service. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesCreateOrUpdate_Validate(string resourceGroupName, string peeringServiceName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Deletes an existing peering service with the specified name under the given subscription and resource group. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesDelete(string resourceGroupName, string peeringServiceName, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// + /// Deletes an existing peering service with the specified name under the given subscription and resource group. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesDelete_Validate(string resourceGroupName, string peeringServiceName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Gets an existing peering service with the specified name under the given subscription and resource group. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesGet(string resourceGroupName, string peeringServiceName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets an existing peering service with the specified name under the given subscription and resource group. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringService.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesGet_Validate(string resourceGroupName, string peeringServiceName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Initialize Peering Service for Connection Monitor functionality + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesInitializeConnectionMonitor(string subscriptionId, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/initializeConnectionMonitor" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesInitializeConnectionMonitor_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Initialize Peering Service for Connection Monitor functionality + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesInitializeConnectionMonitorViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/initializeConnectionMonitor'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/initializeConnectionMonitor" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesInitializeConnectionMonitor_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesInitializeConnectionMonitor_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesInitializeConnectionMonitor_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Lists all of the peering services under the given subscription and resource group. + /// + /// The name of the resource group. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesListByResourceGroup(string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the peering services under the given subscription and resource group. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the resource group. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesListByResourceGroup_Validate(string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all of the peerings under the given subscription. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peeringServices" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the peerings under the given subscription. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesListBySubscriptionViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peeringServices$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServices'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peeringServices" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesListBySubscription_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServiceListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Updates tags for a peering service with the specified name under the given subscription and resource group. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The Azure subscription ID. + /// The resource tags. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesUpdate(string resourceGroupName, string peeringServiceName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Updates tags for a peering service with the specified name under the given subscription and resource group. + /// + /// + /// The resource tags. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringServicesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringServicesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringService.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The Azure subscription ID. + /// The resource tags. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringServicesUpdate_Validate(string resourceGroupName, string peeringServiceName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Creates a new peering or updates an existing peering with the specified name under the given subscription and resource + /// group. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// The properties needed to create or update a peering. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsCreateOrUpdate(string resourceGroupName, string peeringName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Creates a new peering or updates an existing peering with the specified name under the given subscription and resource + /// group. + /// + /// + /// The properties needed to create or update a peering. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Peering.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Peering.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// The properties needed to create or update a peering. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsCreateOrUpdate_Validate(string resourceGroupName, string peeringName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Deletes an existing peering with the specified name under the given subscription and resource group. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsDelete(string resourceGroupName, string peeringName, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// + /// Deletes an existing peering with the specified name under the given subscription and resource group. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsDelete_Validate(string resourceGroupName, string peeringName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Gets an existing peering with the specified name under the given subscription and resource group. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsGet(string resourceGroupName, string peeringName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets an existing peering with the specified name under the given subscription and resource group. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Peering.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsGet_Validate(string resourceGroupName, string peeringName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all of the peerings under the given subscription and resource group. + /// The name of the resource group. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsListByResourceGroup(string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the peerings under the given subscription and resource group. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the resource group. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsListByResourceGroup_Validate(string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all of the peerings under the given subscription. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Peering/peerings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the peerings under the given subscription. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsListBySubscriptionViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Peering/peerings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerings'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Peering/peerings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsListBySubscription_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Updates tags for a peering with the specified name under the given subscription and resource group. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// The resource tags. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsUpdate(string resourceGroupName, string peeringName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Updates tags for a peering with the specified name under the given subscription and resource group. + /// + /// + /// The resource tags. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PeeringsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PeeringsUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Peering.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// The resource tags. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PeeringsUpdate_Validate(string resourceGroupName, string peeringName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Creates a new prefix with the specified name under the given subscription, resource group and peering service. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the prefix. + /// The Azure subscription ID. + /// The properties needed to create a prefix. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrefixesCreateOrUpdate(string resourceGroupName, string peeringServiceName, string prefixName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "/prefixes/" + + global::System.Uri.EscapeDataString(prefixName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrefixesCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Creates a new prefix with the specified name under the given subscription, resource group and peering service. + /// + /// + /// The properties needed to create a prefix. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrefixesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)/prefixes/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var prefixName = _match.Groups["prefixName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "/prefixes/" + + prefixName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrefixesCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrefixesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefix.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefix.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the prefix. + /// The Azure subscription ID. + /// The properties needed to create a prefix. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrefixesCreateOrUpdate_Validate(string resourceGroupName, string peeringServiceName, string prefixName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(prefixName),prefixName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the prefix. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrefixesDelete(string resourceGroupName, string peeringServiceName, string prefixName, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "/prefixes/" + + global::System.Uri.EscapeDataString(prefixName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrefixesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// + /// Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrefixesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)/prefixes/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var prefixName = _match.Groups["prefixName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "/prefixes/" + + prefixName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrefixesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrefixesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the prefix. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrefixesDelete_Validate(string resourceGroupName, string peeringServiceName, string prefixName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(prefixName),prefixName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the prefix. + /// The properties to be expanded. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrefixesGet(string resourceGroupName, string peeringServiceName, string prefixName, string Expand, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "/prefixes/" + + global::System.Uri.EscapeDataString(prefixName) + + "?" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrefixesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + /// + /// + /// The properties to be expanded. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrefixesGetViaIdentity(global::System.String viaIdentity, string Expand, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)/prefixes/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var prefixName = _match.Groups["prefixName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "/prefixes/" + + prefixName + + "?" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrefixesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrefixesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefix.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The name of the prefix. + /// The properties to be expanded. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrefixesGet_Validate(string resourceGroupName, string peeringServiceName, string prefixName, string Expand, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(prefixName),prefixName); + await eventListener.AssertNotNull(nameof(Expand),Expand); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Lists all prefixes under the given subscription, resource group and peering service. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The properties to be expanded. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrefixesListByPeeringService(string resourceGroupName, string peeringServiceName, string Expand, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peeringServices/" + + global::System.Uri.EscapeDataString(peeringServiceName) + + "/prefixes" + + "?" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrefixesListByPeeringService_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all prefixes under the given subscription, resource group and peering service. + /// + /// + /// The properties to be expanded. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrefixesListByPeeringServiceViaIdentity(global::System.String viaIdentity, string Expand, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peeringServices/(?[^/]+)/prefixes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringServiceName = _match.Groups["peeringServiceName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peeringServices/" + + peeringServiceName + + "/prefixes" + + "?" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrefixesListByPeeringService_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrefixesListByPeeringService_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefixListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the resource group. + /// The name of the peering service. + /// The properties to be expanded. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrefixesListByPeeringService_Validate(string resourceGroupName, string peeringServiceName, string Expand, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringServiceName),peeringServiceName); + await eventListener.AssertNotNull(nameof(Expand),Expand); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Lists the prefixes received over the specified peering under the given subscription and resource group. + /// + /// The name of the resource group. + /// The name of the peering. + /// The optional prefix that can be used to filter the routes. + /// The optional AS path that can be used to filter the routes. + /// The optional origin AS validation state that can be used to filter the routes. + /// The optional RPKI validation state that can be used to filter the routes. + /// The optional page continuation token that is used in the event of paginated result. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReceivedRoutesListByPeering(string resourceGroupName, string peeringName, string prefix, string asPath, string originAsValidationState, string rpkiValidationState, string SkipToken, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/receivedRoutes" + + "?" + + (string.IsNullOrEmpty(prefix) ? global::System.String.Empty : "prefix=" + global::System.Uri.EscapeDataString(prefix)) + + "&" + + (string.IsNullOrEmpty(asPath) ? global::System.String.Empty : "asPath=" + global::System.Uri.EscapeDataString(asPath)) + + "&" + + (string.IsNullOrEmpty(originAsValidationState) ? global::System.String.Empty : "originAsValidationState=" + global::System.Uri.EscapeDataString(originAsValidationState)) + + "&" + + (string.IsNullOrEmpty(rpkiValidationState) ? global::System.String.Empty : "rpkiValidationState=" + global::System.Uri.EscapeDataString(rpkiValidationState)) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReceivedRoutesListByPeering_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists the prefixes received over the specified peering under the given subscription and resource group. + /// + /// + /// The optional prefix that can be used to filter the routes. + /// The optional AS path that can be used to filter the routes. + /// The optional origin AS validation state that can be used to filter the routes. + /// The optional RPKI validation state that can be used to filter the routes. + /// The optional page continuation token that is used in the event of paginated result. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReceivedRoutesListByPeeringViaIdentity(global::System.String viaIdentity, string prefix, string asPath, string originAsValidationState, string rpkiValidationState, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/receivedRoutes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/receivedRoutes'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/receivedRoutes" + + "?" + + (string.IsNullOrEmpty(prefix) ? global::System.String.Empty : "prefix=" + global::System.Uri.EscapeDataString(prefix)) + + "&" + + (string.IsNullOrEmpty(asPath) ? global::System.String.Empty : "asPath=" + global::System.Uri.EscapeDataString(asPath)) + + "&" + + (string.IsNullOrEmpty(originAsValidationState) ? global::System.String.Empty : "originAsValidationState=" + global::System.Uri.EscapeDataString(originAsValidationState)) + + "&" + + (string.IsNullOrEmpty(rpkiValidationState) ? global::System.String.Empty : "rpkiValidationState=" + global::System.Uri.EscapeDataString(rpkiValidationState)) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReceivedRoutesListByPeering_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReceivedRoutesListByPeering_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringReceivedRouteListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The optional prefix that can be used to filter the routes. + /// The optional AS path that can be used to filter the routes. + /// The optional origin AS validation state that can be used to filter the routes. + /// The optional RPKI validation state that can be used to filter the routes. + /// The optional page continuation token that is used in the event of paginated result. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReceivedRoutesListByPeering_Validate(string resourceGroupName, string peeringName, string prefix, string asPath, string originAsValidationState, string rpkiValidationState, string SkipToken, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(prefix),prefix); + await eventListener.AssertNotNull(nameof(asPath),asPath); + await eventListener.AssertNotNull(nameof(originAsValidationState),originAsValidationState); + await eventListener.AssertNotNull(nameof(rpkiValidationState),rpkiValidationState); + await eventListener.AssertNotNull(nameof(SkipToken),SkipToken); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the ASN. + /// The Azure subscription ID. + /// The properties needed to create a registered ASN. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredAsnsCreateOrUpdate(string resourceGroupName, string peeringName, string registeredAsnName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/registeredAsns/" + + global::System.Uri.EscapeDataString(registeredAsnName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredAsnsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// + /// The properties needed to create a registered ASN. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredAsnsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/registeredAsns/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var registeredAsnName = _match.Groups["registeredAsnName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/registeredAsns/" + + registeredAsnName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredAsnsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredAsnsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsn.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsn.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the ASN. + /// The Azure subscription ID. + /// The properties needed to create a registered ASN. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredAsnsCreateOrUpdate_Validate(string resourceGroupName, string peeringName, string registeredAsnName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(registeredAsnName),registeredAsnName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered ASN. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredAsnsDelete(string resourceGroupName, string peeringName, string registeredAsnName, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/registeredAsns/" + + global::System.Uri.EscapeDataString(registeredAsnName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredAsnsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// + /// Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredAsnsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/registeredAsns/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var registeredAsnName = _match.Groups["registeredAsnName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/registeredAsns/" + + registeredAsnName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredAsnsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredAsnsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered ASN. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredAsnsDelete_Validate(string resourceGroupName, string peeringName, string registeredAsnName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(registeredAsnName),registeredAsnName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered ASN. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredAsnsGet(string resourceGroupName, string peeringName, string registeredAsnName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/registeredAsns/" + + global::System.Uri.EscapeDataString(registeredAsnName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredAsnsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredAsnsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/registeredAsns/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var registeredAsnName = _match.Groups["registeredAsnName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/registeredAsns/" + + registeredAsnName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredAsnsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredAsnsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsn.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered ASN. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredAsnsGet_Validate(string resourceGroupName, string peeringName, string registeredAsnName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(registeredAsnName),registeredAsnName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Lists all registered ASNs under the given subscription, resource group and peering. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredAsnsListByPeering(string resourceGroupName, string peeringName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/registeredAsns" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredAsnsListByPeering_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all registered ASNs under the given subscription, resource group and peering. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredAsnsListByPeeringViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/registeredAsns$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/registeredAsns" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredAsnsListByPeering_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredAsnsListByPeering_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsnListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredAsnsListByPeering_Validate(string resourceGroupName, string peeringName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered prefix. + /// The Azure subscription ID. + /// The properties needed to create a registered prefix. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesCreateOrUpdate(string resourceGroupName, string peeringName, string registeredPrefixName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/registeredPrefixes/" + + global::System.Uri.EscapeDataString(registeredPrefixName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// + /// Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// The properties needed to create a registered prefix. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/registeredPrefixes/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var registeredPrefixName = _match.Groups["registeredPrefixName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/registeredPrefixes/" + + registeredPrefixName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefix.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefix.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered prefix. + /// The Azure subscription ID. + /// The properties needed to create a registered prefix. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesCreateOrUpdate_Validate(string resourceGroupName, string peeringName, string registeredPrefixName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix body, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(registeredPrefixName),registeredPrefixName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered prefix. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesDelete(string resourceGroupName, string peeringName, string registeredPrefixName, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/registeredPrefixes/" + + global::System.Uri.EscapeDataString(registeredPrefixName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// + /// Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/registeredPrefixes/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var registeredPrefixName = _match.Groups["registeredPrefixName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/registeredPrefixes/" + + registeredPrefixName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered prefix. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesDelete_Validate(string resourceGroupName, string peeringName, string registeredPrefixName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(registeredPrefixName),registeredPrefixName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered prefix. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesGet(string resourceGroupName, string peeringName, string registeredPrefixName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/registeredPrefixes/" + + global::System.Uri.EscapeDataString(registeredPrefixName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/registeredPrefixes/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var registeredPrefixName = _match.Groups["registeredPrefixName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/registeredPrefixes/" + + registeredPrefixName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefix.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered prefix. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesGet_Validate(string resourceGroupName, string peeringName, string registeredPrefixName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(registeredPrefixName),registeredPrefixName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Lists all registered prefixes under the given subscription, resource group and peering. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesListByPeering(string resourceGroupName, string peeringName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/registeredPrefixes" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesListByPeering_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all registered prefixes under the given subscription, resource group and peering. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesListByPeeringViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/registeredPrefixes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/registeredPrefixes" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesListByPeering_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesListByPeering_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefixListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesListByPeering_Validate(string resourceGroupName, string peeringName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered prefix. + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesValidate(string resourceGroupName, string peeringName, string registeredPrefixName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/registeredPrefixes/" + + global::System.Uri.EscapeDataString(registeredPrefixName) + + "/validate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesValidate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RegisteredPrefixesValidateViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/registeredPrefixes/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}/validate'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var registeredPrefixName = _match.Groups["registeredPrefixName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/registeredPrefixes/" + + registeredPrefixName + + "/validate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RegisteredPrefixesValidate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesValidate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefix.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the resource group. + /// The name of the peering. + /// The name of the registered prefix. + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RegisteredPrefixesValidate_Validate(string resourceGroupName, string peeringName, string registeredPrefixName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(registeredPrefixName),registeredPrefixName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists all of the RP unbilled prefixes for the specified peering + /// The Azure resource group name. + /// The peering name. + /// Flag to enable consolidation prefixes + /// The Azure subscription ID. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RpUnbilledPrefixesList(string resourceGroupName, string peeringName, bool? consolidate, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Peering/peerings/" + + global::System.Uri.EscapeDataString(peeringName) + + "/rpUnbilledPrefixes" + + "?" + + (null == consolidate ? global::System.String.Empty : "consolidate=" + global::System.Uri.EscapeDataString(consolidate.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RpUnbilledPrefixesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists all of the RP unbilled prefixes for the specified peering + /// + /// Flag to enable consolidation prefixes + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RpUnbilledPrefixesListViaIdentity(global::System.String viaIdentity, bool? consolidate, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-10-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Peering/peerings/(?[^/]+)/rpUnbilledPrefixes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/rpUnbilledPrefixes'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var peeringName = _match.Groups["peeringName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Peering/peerings/" + + peeringName + + "/rpUnbilledPrefixes" + + "?" + + (null == consolidate ? global::System.String.Empty : "consolidate=" + global::System.Uri.EscapeDataString(consolidate.ToString())) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RpUnbilledPrefixesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RpUnbilledPrefixesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.RpUnbilledPrefixListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The Azure resource group name. + /// The peering name. + /// Flag to enable consolidation prefixes + /// The Azure subscription ID. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RpUnbilledPrefixesList_Validate(string resourceGroupName, string peeringName, bool? consolidate, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(peeringName),peeringName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Command.Completer.cs b/src/Peering/generated/api/Support/Command.Completer.cs new file mode 100644 index 000000000000..ac74c88d0385 --- /dev/null +++ b/src/Peering/generated/api/Support/Command.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// Invoked command + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.CommandTypeConverter))] + public partial struct Command : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Traceroute".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Traceroute'", "Traceroute", global::System.Management.Automation.CompletionResultType.ParameterValue, "Traceroute"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Ping".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Ping'", "Ping", global::System.Management.Automation.CompletionResultType.ParameterValue, "Ping"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "BgpRoute".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'BgpRoute'", "BgpRoute", global::System.Management.Automation.CompletionResultType.ParameterValue, "BgpRoute"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Command.TypeConverter.cs b/src/Peering/generated/api/Support/Command.TypeConverter.cs new file mode 100644 index 000000000000..fd5359adce84 --- /dev/null +++ b/src/Peering/generated/api/Support/Command.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// Invoked command + public partial class CommandTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Command.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Command.cs b/src/Peering/generated/api/Support/Command.cs new file mode 100644 index 000000000000..dc370a6a202c --- /dev/null +++ b/src/Peering/generated/api/Support/Command.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// Invoked command + public partial struct Command : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command BgpRoute = @"BgpRoute"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command Ping = @"Ping"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command Traceroute = @"Traceroute"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private Command(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to Command + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Command(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Command + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Command (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is Command && Equals((Command)obj); + } + + /// Returns hashCode for enum Command + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for Command + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Command + /// the value to convert to an instance of . + + public static implicit operator Command(string value) + { + return new Command(value); + } + + /// Implicit operator to convert Command to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command e) + { + return e._value; + } + + /// Overriding != operator for enum Command + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Command + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Command e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/ConnectionState.Completer.cs b/src/Peering/generated/api/Support/ConnectionState.Completer.cs new file mode 100644 index 000000000000..f693b30f1125 --- /dev/null +++ b/src/Peering/generated/api/Support/ConnectionState.Completer.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The state of the connection. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionStateTypeConverter))] + public partial struct ConnectionState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PendingApproval".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PendingApproval'", "PendingApproval", global::System.Management.Automation.CompletionResultType.ParameterValue, "PendingApproval"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Approved".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Approved'", "Approved", global::System.Management.Automation.CompletionResultType.ParameterValue, "Approved"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ProvisioningStarted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ProvisioningStarted'", "ProvisioningStarted", global::System.Management.Automation.CompletionResultType.ParameterValue, "ProvisioningStarted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ProvisioningFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ProvisioningFailed'", "ProvisioningFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "ProvisioningFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ProvisioningCompleted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ProvisioningCompleted'", "ProvisioningCompleted", global::System.Management.Automation.CompletionResultType.ParameterValue, "ProvisioningCompleted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Validating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Validating'", "Validating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Validating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Active".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Active'", "Active", global::System.Management.Automation.CompletionResultType.ParameterValue, "Active"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TypeChangeRequested".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TypeChangeRequested'", "TypeChangeRequested", global::System.Management.Automation.CompletionResultType.ParameterValue, "TypeChangeRequested"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TypeChangeInProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TypeChangeInProgress'", "TypeChangeInProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "TypeChangeInProgress"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/ConnectionState.TypeConverter.cs b/src/Peering/generated/api/Support/ConnectionState.TypeConverter.cs new file mode 100644 index 000000000000..3f57cb125d47 --- /dev/null +++ b/src/Peering/generated/api/Support/ConnectionState.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The state of the connection. + public partial class ConnectionStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConnectionState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/ConnectionState.cs b/src/Peering/generated/api/Support/ConnectionState.cs new file mode 100644 index 000000000000..ee32f24f31f8 --- /dev/null +++ b/src/Peering/generated/api/Support/ConnectionState.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The state of the connection. + public partial struct ConnectionState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState Active = @"Active"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState Approved = @"Approved"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState PendingApproval = @"PendingApproval"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState ProvisioningCompleted = @"ProvisioningCompleted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState ProvisioningFailed = @"ProvisioningFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState ProvisioningStarted = @"ProvisioningStarted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState TypeChangeInProgress = @"TypeChangeInProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState TypeChangeRequested = @"TypeChangeRequested"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState Validating = @"Validating"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ConnectionState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to ConnectionState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ConnectionState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ConnectionState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ConnectionState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ConnectionState && Equals((ConnectionState)obj); + } + + /// Returns hashCode for enum ConnectionState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for ConnectionState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ConnectionState + /// the value to convert to an instance of . + + public static implicit operator ConnectionState(string value) + { + return new ConnectionState(value); + } + + /// Implicit operator to convert ConnectionState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState e) + { + return e._value; + } + + /// Overriding != operator for enum ConnectionState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ConnectionState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ConnectionState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/DirectPeeringType.Completer.cs b/src/Peering/generated/api/Support/DirectPeeringType.Completer.cs new file mode 100644 index 000000000000..9b792263cabe --- /dev/null +++ b/src/Peering/generated/api/Support/DirectPeeringType.Completer.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The type of direct peering. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringTypeTypeConverter))] + public partial struct DirectPeeringType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Edge".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Edge'", "Edge", global::System.Management.Automation.CompletionResultType.ParameterValue, "Edge"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Transit".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Transit'", "Transit", global::System.Management.Automation.CompletionResultType.ParameterValue, "Transit"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Cdn".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Cdn'", "Cdn", global::System.Management.Automation.CompletionResultType.ParameterValue, "Cdn"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Internal".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Internal'", "Internal", global::System.Management.Automation.CompletionResultType.ParameterValue, "Internal"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Ix".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Ix'", "Ix", global::System.Management.Automation.CompletionResultType.ParameterValue, "Ix"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "IxRs".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'IxRs'", "IxRs", global::System.Management.Automation.CompletionResultType.ParameterValue, "IxRs"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Voice".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Voice'", "Voice", global::System.Management.Automation.CompletionResultType.ParameterValue, "Voice"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "EdgeZoneForOperators".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'EdgeZoneForOperators'", "EdgeZoneForOperators", global::System.Management.Automation.CompletionResultType.ParameterValue, "EdgeZoneForOperators"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/DirectPeeringType.TypeConverter.cs b/src/Peering/generated/api/Support/DirectPeeringType.TypeConverter.cs new file mode 100644 index 000000000000..1760389b58e9 --- /dev/null +++ b/src/Peering/generated/api/Support/DirectPeeringType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The type of direct peering. + public partial class DirectPeeringTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => DirectPeeringType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/DirectPeeringType.cs b/src/Peering/generated/api/Support/DirectPeeringType.cs new file mode 100644 index 000000000000..7248f8ae7d26 --- /dev/null +++ b/src/Peering/generated/api/Support/DirectPeeringType.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The type of direct peering. + public partial struct DirectPeeringType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType Cdn = @"Cdn"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType Edge = @"Edge"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType EdgeZoneForOperators = @"EdgeZoneForOperators"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType Internal = @"Internal"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType Ix = @"Ix"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType IxRs = @"IxRs"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType Transit = @"Transit"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType Voice = @"Voice"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to DirectPeeringType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new DirectPeeringType(global::System.Convert.ToString(value)); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private DirectPeeringType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Compares values of enum type DirectPeeringType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type DirectPeeringType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is DirectPeeringType && Equals((DirectPeeringType)obj); + } + + /// Returns hashCode for enum DirectPeeringType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for DirectPeeringType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to DirectPeeringType + /// the value to convert to an instance of . + + public static implicit operator DirectPeeringType(string value) + { + return new DirectPeeringType(value); + } + + /// Implicit operator to convert DirectPeeringType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType e) + { + return e._value; + } + + /// Overriding != operator for enum DirectPeeringType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum DirectPeeringType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Family.Completer.cs b/src/Peering/generated/api/Support/Family.Completer.cs new file mode 100644 index 000000000000..4c7ffad838d0 --- /dev/null +++ b/src/Peering/generated/api/Support/Family.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The family of the peering SKU. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.FamilyTypeConverter))] + public partial struct Family : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Direct".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Direct'", "Direct", global::System.Management.Automation.CompletionResultType.ParameterValue, "Direct"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Exchange".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Exchange'", "Exchange", global::System.Management.Automation.CompletionResultType.ParameterValue, "Exchange"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Family.TypeConverter.cs b/src/Peering/generated/api/Support/Family.TypeConverter.cs new file mode 100644 index 000000000000..f65257f5c9de --- /dev/null +++ b/src/Peering/generated/api/Support/Family.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The family of the peering SKU. + public partial class FamilyTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Family.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Family.cs b/src/Peering/generated/api/Support/Family.cs new file mode 100644 index 000000000000..be910293412e --- /dev/null +++ b/src/Peering/generated/api/Support/Family.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The family of the peering SKU. + public partial struct Family : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family Direct = @"Direct"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family Exchange = @"Exchange"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to Family + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Family(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Family + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Family (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is Family && Equals((Family)obj); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private Family(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns hashCode for enum Family + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for Family + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Family + /// the value to convert to an instance of . + + public static implicit operator Family(string value) + { + return new Family(value); + } + + /// Implicit operator to convert Family to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family e) + { + return e._value; + } + + /// Overriding != operator for enum Family + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Family + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Family e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Kind.Completer.cs b/src/Peering/generated/api/Support/Kind.Completer.cs new file mode 100644 index 000000000000..b748f3a0e889 --- /dev/null +++ b/src/Peering/generated/api/Support/Kind.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The kind of the peering. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.KindTypeConverter))] + public partial struct Kind : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Direct".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Direct'", "Direct", global::System.Management.Automation.CompletionResultType.ParameterValue, "Direct"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Exchange".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Exchange'", "Exchange", global::System.Management.Automation.CompletionResultType.ParameterValue, "Exchange"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Kind.TypeConverter.cs b/src/Peering/generated/api/Support/Kind.TypeConverter.cs new file mode 100644 index 000000000000..f4c756c275a6 --- /dev/null +++ b/src/Peering/generated/api/Support/Kind.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The kind of the peering. + public partial class KindTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Kind.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Kind.cs b/src/Peering/generated/api/Support/Kind.cs new file mode 100644 index 000000000000..e9668b49d827 --- /dev/null +++ b/src/Peering/generated/api/Support/Kind.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The kind of the peering. + public partial struct Kind : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind Direct = @"Direct"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind Exchange = @"Exchange"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to Kind + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Kind(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Kind + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Kind (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is Kind && Equals((Kind)obj); + } + + /// Returns hashCode for enum Kind + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private Kind(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for Kind + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Kind + /// the value to convert to an instance of . + + public static implicit operator Kind(string value) + { + return new Kind(value); + } + + /// Implicit operator to convert Kind to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind e) + { + return e._value; + } + + /// Overriding != operator for enum Kind + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Kind + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LearnedType.Completer.cs b/src/Peering/generated/api/Support/LearnedType.Completer.cs new file mode 100644 index 000000000000..5c744b7f3be4 --- /dev/null +++ b/src/Peering/generated/api/Support/LearnedType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The prefix learned type + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedTypeTypeConverter))] + public partial struct LearnedType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ViaServiceProvider".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ViaServiceProvider'", "ViaServiceProvider", global::System.Management.Automation.CompletionResultType.ParameterValue, "ViaServiceProvider"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ViaSession".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ViaSession'", "ViaSession", global::System.Management.Automation.CompletionResultType.ParameterValue, "ViaSession"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LearnedType.TypeConverter.cs b/src/Peering/generated/api/Support/LearnedType.TypeConverter.cs new file mode 100644 index 000000000000..eee4fb75a7a2 --- /dev/null +++ b/src/Peering/generated/api/Support/LearnedType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The prefix learned type + public partial class LearnedTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => LearnedType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LearnedType.cs b/src/Peering/generated/api/Support/LearnedType.cs new file mode 100644 index 000000000000..c0aff496036c --- /dev/null +++ b/src/Peering/generated/api/Support/LearnedType.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The prefix learned type + public partial struct LearnedType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType ViaServiceProvider = @"ViaServiceProvider"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType ViaSession = @"ViaSession"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to LearnedType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new LearnedType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type LearnedType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type LearnedType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is LearnedType && Equals((LearnedType)obj); + } + + /// Returns hashCode for enum LearnedType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private LearnedType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for LearnedType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to LearnedType + /// the value to convert to an instance of . + + public static implicit operator LearnedType(string value) + { + return new LearnedType(value); + } + + /// Implicit operator to convert LearnedType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType e) + { + return e._value; + } + + /// Overriding != operator for enum LearnedType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum LearnedType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LearnedType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LegacyPeeringsKind.Completer.cs b/src/Peering/generated/api/Support/LegacyPeeringsKind.Completer.cs new file mode 100644 index 000000000000..8cdb38bbfa79 --- /dev/null +++ b/src/Peering/generated/api/Support/LegacyPeeringsKind.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// Argument completer implementation for LegacyPeeringsKind. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKindTypeConverter))] + public partial struct LegacyPeeringsKind : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Direct".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Direct'", "Direct", global::System.Management.Automation.CompletionResultType.ParameterValue, "Direct"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Exchange".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Exchange'", "Exchange", global::System.Management.Automation.CompletionResultType.ParameterValue, "Exchange"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LegacyPeeringsKind.TypeConverter.cs b/src/Peering/generated/api/Support/LegacyPeeringsKind.TypeConverter.cs new file mode 100644 index 000000000000..e0a267fe9860 --- /dev/null +++ b/src/Peering/generated/api/Support/LegacyPeeringsKind.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// TypeConverter implementation for LegacyPeeringsKind. + public partial class LegacyPeeringsKindTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => LegacyPeeringsKind.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LegacyPeeringsKind.cs b/src/Peering/generated/api/Support/LegacyPeeringsKind.cs new file mode 100644 index 000000000000..f57cfa357b6a --- /dev/null +++ b/src/Peering/generated/api/Support/LegacyPeeringsKind.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + public partial struct LegacyPeeringsKind : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind Direct = @"Direct"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind Exchange = @"Exchange"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to LegacyPeeringsKind + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new LegacyPeeringsKind(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type LegacyPeeringsKind + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type LegacyPeeringsKind (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is LegacyPeeringsKind && Equals((LegacyPeeringsKind)obj); + } + + /// Returns hashCode for enum LegacyPeeringsKind + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private LegacyPeeringsKind(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for LegacyPeeringsKind + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to LegacyPeeringsKind + /// the value to convert to an instance of . + + public static implicit operator LegacyPeeringsKind(string value) + { + return new LegacyPeeringsKind(value); + } + + /// Implicit operator to convert LegacyPeeringsKind to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind e) + { + return e._value; + } + + /// Overriding != operator for enum LegacyPeeringsKind + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum LegacyPeeringsKind + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LookingGlassCommand.Completer.cs b/src/Peering/generated/api/Support/LookingGlassCommand.Completer.cs new file mode 100644 index 000000000000..816d0d59aceb --- /dev/null +++ b/src/Peering/generated/api/Support/LookingGlassCommand.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// Argument completer implementation for LookingGlassCommand. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommandTypeConverter))] + public partial struct LookingGlassCommand : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Traceroute".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Traceroute'", "Traceroute", global::System.Management.Automation.CompletionResultType.ParameterValue, "Traceroute"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Ping".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Ping'", "Ping", global::System.Management.Automation.CompletionResultType.ParameterValue, "Ping"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "BgpRoute".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'BgpRoute'", "BgpRoute", global::System.Management.Automation.CompletionResultType.ParameterValue, "BgpRoute"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LookingGlassCommand.TypeConverter.cs b/src/Peering/generated/api/Support/LookingGlassCommand.TypeConverter.cs new file mode 100644 index 000000000000..017a254d8ec7 --- /dev/null +++ b/src/Peering/generated/api/Support/LookingGlassCommand.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// TypeConverter implementation for LookingGlassCommand. + public partial class LookingGlassCommandTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => LookingGlassCommand.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LookingGlassCommand.cs b/src/Peering/generated/api/Support/LookingGlassCommand.cs new file mode 100644 index 000000000000..0dd3f9e1353d --- /dev/null +++ b/src/Peering/generated/api/Support/LookingGlassCommand.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + public partial struct LookingGlassCommand : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand BgpRoute = @"BgpRoute"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand Ping = @"Ping"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand Traceroute = @"Traceroute"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to LookingGlassCommand + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new LookingGlassCommand(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type LookingGlassCommand + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type LookingGlassCommand (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is LookingGlassCommand && Equals((LookingGlassCommand)obj); + } + + /// Returns hashCode for enum LookingGlassCommand + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private LookingGlassCommand(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for LookingGlassCommand + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to LookingGlassCommand + /// the value to convert to an instance of . + + public static implicit operator LookingGlassCommand(string value) + { + return new LookingGlassCommand(value); + } + + /// Implicit operator to convert LookingGlassCommand to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand e) + { + return e._value; + } + + /// Overriding != operator for enum LookingGlassCommand + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum LookingGlassCommand + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LookingGlassSourceType.Completer.cs b/src/Peering/generated/api/Support/LookingGlassSourceType.Completer.cs new file mode 100644 index 000000000000..cc21d2ab6b44 --- /dev/null +++ b/src/Peering/generated/api/Support/LookingGlassSourceType.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// Argument completer implementation for LookingGlassSourceType. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceTypeTypeConverter))] + public partial struct LookingGlassSourceType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "EdgeSite".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'EdgeSite'", "EdgeSite", global::System.Management.Automation.CompletionResultType.ParameterValue, "EdgeSite"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AzureRegion".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AzureRegion'", "AzureRegion", global::System.Management.Automation.CompletionResultType.ParameterValue, "AzureRegion"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LookingGlassSourceType.TypeConverter.cs b/src/Peering/generated/api/Support/LookingGlassSourceType.TypeConverter.cs new file mode 100644 index 000000000000..5731abdf97de --- /dev/null +++ b/src/Peering/generated/api/Support/LookingGlassSourceType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// TypeConverter implementation for LookingGlassSourceType. + public partial class LookingGlassSourceTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => LookingGlassSourceType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/LookingGlassSourceType.cs b/src/Peering/generated/api/Support/LookingGlassSourceType.cs new file mode 100644 index 000000000000..fcd14367fe12 --- /dev/null +++ b/src/Peering/generated/api/Support/LookingGlassSourceType.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + public partial struct LookingGlassSourceType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType AzureRegion = @"AzureRegion"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType EdgeSite = @"EdgeSite"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to LookingGlassSourceType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new LookingGlassSourceType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type LookingGlassSourceType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type LookingGlassSourceType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is LookingGlassSourceType && Equals((LookingGlassSourceType)obj); + } + + /// Returns hashCode for enum LookingGlassSourceType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private LookingGlassSourceType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for LookingGlassSourceType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to LookingGlassSourceType + /// the value to convert to an instance of . + + public static implicit operator LookingGlassSourceType(string value) + { + return new LookingGlassSourceType(value); + } + + /// Implicit operator to convert LookingGlassSourceType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType e) + { + return e._value; + } + + /// Overriding != operator for enum LookingGlassSourceType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum LookingGlassSourceType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.Completer.cs b/src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.Completer.cs new file mode 100644 index 000000000000..6eed54fc0a83 --- /dev/null +++ b/src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.Completer.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// Argument completer implementation for PeeringLocationsDirectPeeringType. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringTypeTypeConverter))] + public partial struct PeeringLocationsDirectPeeringType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Edge".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Edge'", "Edge", global::System.Management.Automation.CompletionResultType.ParameterValue, "Edge"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Transit".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Transit'", "Transit", global::System.Management.Automation.CompletionResultType.ParameterValue, "Transit"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Cdn".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Cdn'", "Cdn", global::System.Management.Automation.CompletionResultType.ParameterValue, "Cdn"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Internal".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Internal'", "Internal", global::System.Management.Automation.CompletionResultType.ParameterValue, "Internal"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Ix".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Ix'", "Ix", global::System.Management.Automation.CompletionResultType.ParameterValue, "Ix"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "IxRs".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'IxRs'", "IxRs", global::System.Management.Automation.CompletionResultType.ParameterValue, "IxRs"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Voice".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Voice'", "Voice", global::System.Management.Automation.CompletionResultType.ParameterValue, "Voice"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "EdgeZoneForOperators".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'EdgeZoneForOperators'", "EdgeZoneForOperators", global::System.Management.Automation.CompletionResultType.ParameterValue, "EdgeZoneForOperators"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.TypeConverter.cs b/src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.TypeConverter.cs new file mode 100644 index 000000000000..3b52d8aef63a --- /dev/null +++ b/src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// TypeConverter implementation for PeeringLocationsDirectPeeringType. + public partial class PeeringLocationsDirectPeeringTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => PeeringLocationsDirectPeeringType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.cs b/src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.cs new file mode 100644 index 000000000000..6be5d54b40e2 --- /dev/null +++ b/src/Peering/generated/api/Support/PeeringLocationsDirectPeeringType.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + public partial struct PeeringLocationsDirectPeeringType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType Cdn = @"Cdn"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType Edge = @"Edge"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType EdgeZoneForOperators = @"EdgeZoneForOperators"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType Internal = @"Internal"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType Ix = @"Ix"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType IxRs = @"IxRs"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType Transit = @"Transit"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType Voice = @"Voice"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to PeeringLocationsDirectPeeringType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new PeeringLocationsDirectPeeringType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type PeeringLocationsDirectPeeringType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type PeeringLocationsDirectPeeringType (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is PeeringLocationsDirectPeeringType && Equals((PeeringLocationsDirectPeeringType)obj); + } + + /// Returns hashCode for enum PeeringLocationsDirectPeeringType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private PeeringLocationsDirectPeeringType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for PeeringLocationsDirectPeeringType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to PeeringLocationsDirectPeeringType + /// the value to convert to an instance of . + + public static implicit operator PeeringLocationsDirectPeeringType(string value) + { + return new PeeringLocationsDirectPeeringType(value); + } + + /// Implicit operator to convert PeeringLocationsDirectPeeringType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType e) + { + return e._value; + } + + /// Overriding != operator for enum PeeringLocationsDirectPeeringType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum PeeringLocationsDirectPeeringType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/PeeringLocationsKind.Completer.cs b/src/Peering/generated/api/Support/PeeringLocationsKind.Completer.cs new file mode 100644 index 000000000000..4f3637d6a97b --- /dev/null +++ b/src/Peering/generated/api/Support/PeeringLocationsKind.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// Argument completer implementation for PeeringLocationsKind. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKindTypeConverter))] + public partial struct PeeringLocationsKind : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Direct".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Direct'", "Direct", global::System.Management.Automation.CompletionResultType.ParameterValue, "Direct"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Exchange".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Exchange'", "Exchange", global::System.Management.Automation.CompletionResultType.ParameterValue, "Exchange"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/PeeringLocationsKind.TypeConverter.cs b/src/Peering/generated/api/Support/PeeringLocationsKind.TypeConverter.cs new file mode 100644 index 000000000000..e5434882ddd7 --- /dev/null +++ b/src/Peering/generated/api/Support/PeeringLocationsKind.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// TypeConverter implementation for PeeringLocationsKind. + public partial class PeeringLocationsKindTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => PeeringLocationsKind.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/PeeringLocationsKind.cs b/src/Peering/generated/api/Support/PeeringLocationsKind.cs new file mode 100644 index 000000000000..75640dcbad00 --- /dev/null +++ b/src/Peering/generated/api/Support/PeeringLocationsKind.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + public partial struct PeeringLocationsKind : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind Direct = @"Direct"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind Exchange = @"Exchange"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to PeeringLocationsKind + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new PeeringLocationsKind(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type PeeringLocationsKind + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type PeeringLocationsKind (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is PeeringLocationsKind && Equals((PeeringLocationsKind)obj); + } + + /// Returns hashCode for enum PeeringLocationsKind + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private PeeringLocationsKind(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for PeeringLocationsKind + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to PeeringLocationsKind + /// the value to convert to an instance of . + + public static implicit operator PeeringLocationsKind(string value) + { + return new PeeringLocationsKind(value); + } + + /// Implicit operator to convert PeeringLocationsKind to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind e) + { + return e._value; + } + + /// Overriding != operator for enum PeeringLocationsKind + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum PeeringLocationsKind + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/PrefixValidationState.Completer.cs b/src/Peering/generated/api/Support/PrefixValidationState.Completer.cs new file mode 100644 index 000000000000..3f1176cc1815 --- /dev/null +++ b/src/Peering/generated/api/Support/PrefixValidationState.Completer.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The prefix validation state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationStateTypeConverter))] + public partial struct PrefixValidationState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Invalid".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Invalid'", "Invalid", global::System.Management.Automation.CompletionResultType.ParameterValue, "Invalid"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Verified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Verified'", "Verified", global::System.Management.Automation.CompletionResultType.ParameterValue, "Verified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Pending".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Pending'", "Pending", global::System.Management.Automation.CompletionResultType.ParameterValue, "Pending"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Warning".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Warning'", "Warning", global::System.Management.Automation.CompletionResultType.ParameterValue, "Warning"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Unknown".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Unknown'", "Unknown", global::System.Management.Automation.CompletionResultType.ParameterValue, "Unknown"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/PrefixValidationState.TypeConverter.cs b/src/Peering/generated/api/Support/PrefixValidationState.TypeConverter.cs new file mode 100644 index 000000000000..8a42f98c0f2d --- /dev/null +++ b/src/Peering/generated/api/Support/PrefixValidationState.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The prefix validation state. + public partial class PrefixValidationStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => PrefixValidationState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/PrefixValidationState.cs b/src/Peering/generated/api/Support/PrefixValidationState.cs new file mode 100644 index 000000000000..3cb002f940bb --- /dev/null +++ b/src/Peering/generated/api/Support/PrefixValidationState.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The prefix validation state. + public partial struct PrefixValidationState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState Invalid = @"Invalid"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState Pending = @"Pending"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState Unknown = @"Unknown"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState Verified = @"Verified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState Warning = @"Warning"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to PrefixValidationState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new PrefixValidationState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type PrefixValidationState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type PrefixValidationState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is PrefixValidationState && Equals((PrefixValidationState)obj); + } + + /// Returns hashCode for enum PrefixValidationState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private PrefixValidationState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for PrefixValidationState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to PrefixValidationState + /// the value to convert to an instance of . + + public static implicit operator PrefixValidationState(string value) + { + return new PrefixValidationState(value); + } + + /// Implicit operator to convert PrefixValidationState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState e) + { + return e._value; + } + + /// Overriding != operator for enum PrefixValidationState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum PrefixValidationState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PrefixValidationState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/ProvisioningState.Completer.cs b/src/Peering/generated/api/Support/ProvisioningState.Completer.cs new file mode 100644 index 000000000000..2c59ab7d45da --- /dev/null +++ b/src/Peering/generated/api/Support/ProvisioningState.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The provisioning state of the resource. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningStateTypeConverter))] + public partial struct ProvisioningState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Succeeded'", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Updating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Updating'", "Updating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Updating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Deleting'", "Deleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/ProvisioningState.TypeConverter.cs b/src/Peering/generated/api/Support/ProvisioningState.TypeConverter.cs new file mode 100644 index 000000000000..3e222a019146 --- /dev/null +++ b/src/Peering/generated/api/Support/ProvisioningState.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The provisioning state of the resource. + public partial class ProvisioningStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ProvisioningState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/ProvisioningState.cs b/src/Peering/generated/api/Support/ProvisioningState.cs new file mode 100644 index 000000000000..9fa9dd244637 --- /dev/null +++ b/src/Peering/generated/api/Support/ProvisioningState.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The provisioning state of the resource. + public partial struct ProvisioningState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState Deleting = @"Deleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState Succeeded = @"Succeeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState Updating = @"Updating"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ProvisioningState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ProvisioningState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ProvisioningState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ProvisioningState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ProvisioningState && Equals((ProvisioningState)obj); + } + + /// Returns hashCode for enum ProvisioningState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ProvisioningState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ProvisioningState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ProvisioningState + /// the value to convert to an instance of . + + public static implicit operator ProvisioningState(string value) + { + return new ProvisioningState(value); + } + + /// Implicit operator to convert ProvisioningState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState e) + { + return e._value; + } + + /// Overriding != operator for enum ProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ProvisioningState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Role.Completer.cs b/src/Peering/generated/api/Support/Role.Completer.cs new file mode 100644 index 000000000000..e33e484d3ac0 --- /dev/null +++ b/src/Peering/generated/api/Support/Role.Completer.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The role of the contact. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.RoleTypeConverter))] + public partial struct Role : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Noc".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Noc'", "Noc", global::System.Management.Automation.CompletionResultType.ParameterValue, "Noc"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Policy".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Policy'", "Policy", global::System.Management.Automation.CompletionResultType.ParameterValue, "Policy"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Technical".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Technical'", "Technical", global::System.Management.Automation.CompletionResultType.ParameterValue, "Technical"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Service".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Service'", "Service", global::System.Management.Automation.CompletionResultType.ParameterValue, "Service"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Escalation".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Escalation'", "Escalation", global::System.Management.Automation.CompletionResultType.ParameterValue, "Escalation"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Other".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Other'", "Other", global::System.Management.Automation.CompletionResultType.ParameterValue, "Other"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Role.TypeConverter.cs b/src/Peering/generated/api/Support/Role.TypeConverter.cs new file mode 100644 index 000000000000..879980c4edea --- /dev/null +++ b/src/Peering/generated/api/Support/Role.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The role of the contact. + public partial class RoleTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Role.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Role.cs b/src/Peering/generated/api/Support/Role.cs new file mode 100644 index 000000000000..730c80f728af --- /dev/null +++ b/src/Peering/generated/api/Support/Role.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The role of the contact. + public partial struct Role : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role Escalation = @"Escalation"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role Noc = @"Noc"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role Other = @"Other"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role Policy = @"Policy"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role Service = @"Service"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role Technical = @"Technical"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to Role + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Role(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Role + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Role (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is Role && Equals((Role)obj); + } + + /// Returns hashCode for enum Role + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private Role(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for Role + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Role + /// the value to convert to an instance of . + + public static implicit operator Role(string value) + { + return new Role(value); + } + + /// Implicit operator to convert Role to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role e) + { + return e._value; + } + + /// Overriding != operator for enum Role + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Role + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/SessionAddressProvider.Completer.cs b/src/Peering/generated/api/Support/SessionAddressProvider.Completer.cs new file mode 100644 index 000000000000..70706345e34a --- /dev/null +++ b/src/Peering/generated/api/Support/SessionAddressProvider.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The field indicating if Microsoft provides session ip addresses. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProviderTypeConverter))] + public partial struct SessionAddressProvider : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Microsoft".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Microsoft'", "Microsoft", global::System.Management.Automation.CompletionResultType.ParameterValue, "Microsoft"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Peer".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Peer'", "Peer", global::System.Management.Automation.CompletionResultType.ParameterValue, "Peer"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/SessionAddressProvider.TypeConverter.cs b/src/Peering/generated/api/Support/SessionAddressProvider.TypeConverter.cs new file mode 100644 index 000000000000..7445af3df921 --- /dev/null +++ b/src/Peering/generated/api/Support/SessionAddressProvider.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The field indicating if Microsoft provides session ip addresses. + public partial class SessionAddressProviderTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SessionAddressProvider.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/SessionAddressProvider.cs b/src/Peering/generated/api/Support/SessionAddressProvider.cs new file mode 100644 index 000000000000..686d42923da9 --- /dev/null +++ b/src/Peering/generated/api/Support/SessionAddressProvider.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The field indicating if Microsoft provides session ip addresses. + public partial struct SessionAddressProvider : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider Microsoft = @"Microsoft"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider Peer = @"Peer"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to SessionAddressProvider + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new SessionAddressProvider(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type SessionAddressProvider + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type SessionAddressProvider (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is SessionAddressProvider && Equals((SessionAddressProvider)obj); + } + + /// Returns hashCode for enum SessionAddressProvider + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private SessionAddressProvider(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for SessionAddressProvider + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to SessionAddressProvider + /// the value to convert to an instance of . + + public static implicit operator SessionAddressProvider(string value) + { + return new SessionAddressProvider(value); + } + + /// Implicit operator to convert SessionAddressProvider to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider e) + { + return e._value; + } + + /// Overriding != operator for enum SessionAddressProvider + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum SessionAddressProvider + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/SessionStateV4.Completer.cs b/src/Peering/generated/api/Support/SessionStateV4.Completer.cs new file mode 100644 index 000000000000..97c071c56053 --- /dev/null +++ b/src/Peering/generated/api/Support/SessionStateV4.Completer.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The state of the IPv4 session. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4TypeConverter))] + public partial struct SessionStateV4 : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Idle".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Idle'", "Idle", global::System.Management.Automation.CompletionResultType.ParameterValue, "Idle"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Connect".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Connect'", "Connect", global::System.Management.Automation.CompletionResultType.ParameterValue, "Connect"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Active".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Active'", "Active", global::System.Management.Automation.CompletionResultType.ParameterValue, "Active"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "OpenSent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'OpenSent'", "OpenSent", global::System.Management.Automation.CompletionResultType.ParameterValue, "OpenSent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "OpenConfirm".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'OpenConfirm'", "OpenConfirm", global::System.Management.Automation.CompletionResultType.ParameterValue, "OpenConfirm"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "OpenReceived".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'OpenReceived'", "OpenReceived", global::System.Management.Automation.CompletionResultType.ParameterValue, "OpenReceived"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Established".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Established'", "Established", global::System.Management.Automation.CompletionResultType.ParameterValue, "Established"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PendingAdd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PendingAdd'", "PendingAdd", global::System.Management.Automation.CompletionResultType.ParameterValue, "PendingAdd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PendingUpdate".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PendingUpdate'", "PendingUpdate", global::System.Management.Automation.CompletionResultType.ParameterValue, "PendingUpdate"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PendingRemove".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PendingRemove'", "PendingRemove", global::System.Management.Automation.CompletionResultType.ParameterValue, "PendingRemove"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/SessionStateV4.TypeConverter.cs b/src/Peering/generated/api/Support/SessionStateV4.TypeConverter.cs new file mode 100644 index 000000000000..bd48439455a1 --- /dev/null +++ b/src/Peering/generated/api/Support/SessionStateV4.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The state of the IPv4 session. + public partial class SessionStateV4TypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SessionStateV4.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/SessionStateV4.cs b/src/Peering/generated/api/Support/SessionStateV4.cs new file mode 100644 index 000000000000..9781f8f7de9c --- /dev/null +++ b/src/Peering/generated/api/Support/SessionStateV4.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The state of the IPv4 session. + public partial struct SessionStateV4 : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 Active = @"Active"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 Connect = @"Connect"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 Established = @"Established"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 Idle = @"Idle"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 OpenConfirm = @"OpenConfirm"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 OpenReceived = @"OpenReceived"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 OpenSent = @"OpenSent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 PendingAdd = @"PendingAdd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 PendingRemove = @"PendingRemove"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 PendingUpdate = @"PendingUpdate"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to SessionStateV4 + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new SessionStateV4(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type SessionStateV4 + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type SessionStateV4 (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is SessionStateV4 && Equals((SessionStateV4)obj); + } + + /// Returns hashCode for enum SessionStateV4 + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private SessionStateV4(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for SessionStateV4 + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to SessionStateV4 + /// the value to convert to an instance of . + + public static implicit operator SessionStateV4(string value) + { + return new SessionStateV4(value); + } + + /// Implicit operator to convert SessionStateV4 to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 e) + { + return e._value; + } + + /// Overriding != operator for enum SessionStateV4 + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum SessionStateV4 + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV4 e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/SessionStateV6.Completer.cs b/src/Peering/generated/api/Support/SessionStateV6.Completer.cs new file mode 100644 index 000000000000..d7ea6c1700b7 --- /dev/null +++ b/src/Peering/generated/api/Support/SessionStateV6.Completer.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The state of the IPv6 session. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6TypeConverter))] + public partial struct SessionStateV6 : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Idle".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Idle'", "Idle", global::System.Management.Automation.CompletionResultType.ParameterValue, "Idle"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Connect".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Connect'", "Connect", global::System.Management.Automation.CompletionResultType.ParameterValue, "Connect"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Active".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Active'", "Active", global::System.Management.Automation.CompletionResultType.ParameterValue, "Active"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "OpenSent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'OpenSent'", "OpenSent", global::System.Management.Automation.CompletionResultType.ParameterValue, "OpenSent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "OpenConfirm".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'OpenConfirm'", "OpenConfirm", global::System.Management.Automation.CompletionResultType.ParameterValue, "OpenConfirm"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "OpenReceived".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'OpenReceived'", "OpenReceived", global::System.Management.Automation.CompletionResultType.ParameterValue, "OpenReceived"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Established".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Established'", "Established", global::System.Management.Automation.CompletionResultType.ParameterValue, "Established"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PendingAdd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PendingAdd'", "PendingAdd", global::System.Management.Automation.CompletionResultType.ParameterValue, "PendingAdd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PendingUpdate".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PendingUpdate'", "PendingUpdate", global::System.Management.Automation.CompletionResultType.ParameterValue, "PendingUpdate"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PendingRemove".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PendingRemove'", "PendingRemove", global::System.Management.Automation.CompletionResultType.ParameterValue, "PendingRemove"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/SessionStateV6.TypeConverter.cs b/src/Peering/generated/api/Support/SessionStateV6.TypeConverter.cs new file mode 100644 index 000000000000..9d788532fa50 --- /dev/null +++ b/src/Peering/generated/api/Support/SessionStateV6.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The state of the IPv6 session. + public partial class SessionStateV6TypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SessionStateV6.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/SessionStateV6.cs b/src/Peering/generated/api/Support/SessionStateV6.cs new file mode 100644 index 000000000000..7ae4d13ea774 --- /dev/null +++ b/src/Peering/generated/api/Support/SessionStateV6.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The state of the IPv6 session. + public partial struct SessionStateV6 : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 Active = @"Active"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 Connect = @"Connect"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 Established = @"Established"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 Idle = @"Idle"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 OpenConfirm = @"OpenConfirm"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 OpenReceived = @"OpenReceived"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 OpenSent = @"OpenSent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 PendingAdd = @"PendingAdd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 PendingRemove = @"PendingRemove"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 PendingUpdate = @"PendingUpdate"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to SessionStateV6 + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new SessionStateV6(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type SessionStateV6 + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type SessionStateV6 (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is SessionStateV6 && Equals((SessionStateV6)obj); + } + + /// Returns hashCode for enum SessionStateV6 + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private SessionStateV6(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for SessionStateV6 + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to SessionStateV6 + /// the value to convert to an instance of . + + public static implicit operator SessionStateV6(string value) + { + return new SessionStateV6(value); + } + + /// Implicit operator to convert SessionStateV6 to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 e) + { + return e._value; + } + + /// Overriding != operator for enum SessionStateV6 + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum SessionStateV6 + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionStateV6 e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Size.Completer.cs b/src/Peering/generated/api/Support/Size.Completer.cs new file mode 100644 index 000000000000..06bd86894e48 --- /dev/null +++ b/src/Peering/generated/api/Support/Size.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The size of the peering SKU. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SizeTypeConverter))] + public partial struct Size : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Free".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Free'", "Free", global::System.Management.Automation.CompletionResultType.ParameterValue, "Free"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Metered".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Metered'", "Metered", global::System.Management.Automation.CompletionResultType.ParameterValue, "Metered"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Unlimited".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Unlimited'", "Unlimited", global::System.Management.Automation.CompletionResultType.ParameterValue, "Unlimited"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Size.TypeConverter.cs b/src/Peering/generated/api/Support/Size.TypeConverter.cs new file mode 100644 index 000000000000..a206e8e3433d --- /dev/null +++ b/src/Peering/generated/api/Support/Size.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The size of the peering SKU. + public partial class SizeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Size.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Size.cs b/src/Peering/generated/api/Support/Size.cs new file mode 100644 index 000000000000..fa8038567ddb --- /dev/null +++ b/src/Peering/generated/api/Support/Size.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The size of the peering SKU. + public partial struct Size : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size Free = @"Free"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size Metered = @"Metered"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size Unlimited = @"Unlimited"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to Size + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Size(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Size + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Size (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is Size && Equals((Size)obj); + } + + /// Returns hashCode for enum Size + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private Size(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for Size + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Size + /// the value to convert to an instance of . + + public static implicit operator Size(string value) + { + return new Size(value); + } + + /// Implicit operator to convert Size to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size e) + { + return e._value; + } + + /// Overriding != operator for enum Size + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Size + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Size e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Tier.Completer.cs b/src/Peering/generated/api/Support/Tier.Completer.cs new file mode 100644 index 000000000000..cce36d3251e6 --- /dev/null +++ b/src/Peering/generated/api/Support/Tier.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The tier of the peering SKU. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.TierTypeConverter))] + public partial struct Tier : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Basic".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Basic'", "Basic", global::System.Management.Automation.CompletionResultType.ParameterValue, "Basic"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Premium".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Premium'", "Premium", global::System.Management.Automation.CompletionResultType.ParameterValue, "Premium"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Tier.TypeConverter.cs b/src/Peering/generated/api/Support/Tier.TypeConverter.cs new file mode 100644 index 000000000000..86e4f778b1e9 --- /dev/null +++ b/src/Peering/generated/api/Support/Tier.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The tier of the peering SKU. + public partial class TierTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Tier.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/Tier.cs b/src/Peering/generated/api/Support/Tier.cs new file mode 100644 index 000000000000..b2fae8c4f330 --- /dev/null +++ b/src/Peering/generated/api/Support/Tier.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The tier of the peering SKU. + public partial struct Tier : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier Basic = @"Basic"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier Premium = @"Premium"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to Tier + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Tier(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Tier + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Tier (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is Tier && Equals((Tier)obj); + } + + /// Returns hashCode for enum Tier + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private Tier(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for Tier + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Tier + /// the value to convert to an instance of . + + public static implicit operator Tier(string value) + { + return new Tier(value); + } + + /// Implicit operator to convert Tier to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier e) + { + return e._value; + } + + /// Overriding != operator for enum Tier + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Tier + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Tier e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/ValidationState.Completer.cs b/src/Peering/generated/api/Support/ValidationState.Completer.cs new file mode 100644 index 000000000000..be13b7169eff --- /dev/null +++ b/src/Peering/generated/api/Support/ValidationState.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The validation state of the ASN associated with the peer. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationStateTypeConverter))] + public partial struct ValidationState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Pending".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Pending'", "Pending", global::System.Management.Automation.CompletionResultType.ParameterValue, "Pending"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Approved".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Approved'", "Approved", global::System.Management.Automation.CompletionResultType.ParameterValue, "Approved"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/ValidationState.TypeConverter.cs b/src/Peering/generated/api/Support/ValidationState.TypeConverter.cs new file mode 100644 index 000000000000..f9a1d2e964f2 --- /dev/null +++ b/src/Peering/generated/api/Support/ValidationState.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The validation state of the ASN associated with the peer. + public partial class ValidationStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ValidationState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/api/Support/ValidationState.cs b/src/Peering/generated/api/Support/ValidationState.cs new file mode 100644 index 000000000000..2e2f867e0812 --- /dev/null +++ b/src/Peering/generated/api/Support/ValidationState.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Support +{ + + /// The validation state of the ASN associated with the peer. + public partial struct ValidationState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState Approved = @"Approved"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState Pending = @"Pending"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ValidationState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ValidationState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ValidationState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ValidationState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ValidationState && Equals((ValidationState)obj); + } + + /// Returns hashCode for enum ValidationState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for ValidationState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ValidationState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Implicit operator to convert string to ValidationState + /// the value to convert to an instance of . + + public static implicit operator ValidationState(string value) + { + return new ValidationState(value); + } + + /// Implicit operator to convert ValidationState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState e) + { + return e._value; + } + + /// Overriding != operator for enum ValidationState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ValidationState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState e1, Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.ValidationState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringAsn_Get.cs b/src/Peering/generated/cmdlets/GetAzPeeringAsn_Get.cs new file mode 100644 index 000000000000..2a4c67c7927e --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringAsn_Get.cs @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Gets the peer ASN with the specified name under the given subscription. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringAsn_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets the peer ASN with the specified name under the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringAsn_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The peer ASN name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The peer ASN name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The peer ASN name.", + SerializedName = @"peerAsnName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeerAsnName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringAsn_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeerAsnsGet(Name, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringAsn_GetViaIdentity.cs b/src/Peering/generated/cmdlets/GetAzPeeringAsn_GetViaIdentity.cs new file mode 100644 index 000000000000..9161f164ff1c --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringAsn_GetViaIdentity.cs @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Gets the peer ASN with the specified name under the given subscription. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringAsn_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets the peer ASN with the specified name under the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringAsn_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringAsn_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PeerAsnsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PeerAsnName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeerAsnName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PeerAsnsGet(InputObject.PeerAsnName ?? null, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringAsn_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringAsn_List.cs new file mode 100644 index 000000000000..b367680db67c --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringAsn_List.cs @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the peer ASNs under the given subscription. + /// + /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringAsn_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the peer ASNs under the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringAsn_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringAsn_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeerAsnsListBySubscription(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsnListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeerAsnsListBySubscription_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringCdnPrefix_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringCdnPrefix_List.cs new file mode 100644 index 000000000000..7a3bc250f37a --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringCdnPrefix_List.cs @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the advertised prefixes for the specified peering location + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/cdnPeeringPrefixes" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringCdnPrefix_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the advertised prefixes for the specified peering location")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringCdnPrefix_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _peeringLocation; + + /// The peering location. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The peering location.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The peering location.", + SerializedName = @"peeringLocation", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string PeeringLocation { get => this._peeringLocation; set => this._peeringLocation = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringCdnPrefix_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.CdnPeeringPrefixesList(PeeringLocation, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PeeringLocation=PeeringLocation,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PeeringLocation=PeeringLocation, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PeeringLocation=PeeringLocation, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefixListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.CdnPeeringPrefixesList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_Get.cs b/src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_Get.cs new file mode 100644 index 000000000000..b9c56de85c74 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_Get.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering + /// service. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringConnectionMonitorTest_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringConnectionMonitorTest_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the connection monitor test + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the connection monitor test")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the connection monitor test", + SerializedName = @"connectionMonitorTestName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ConnectionMonitorTestName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _peeringServiceName; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringServiceName { get => this._peeringServiceName; set => this._peeringServiceName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringConnectionMonitorTest_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ConnectionMonitorTestsGet(ResourceGroupName, PeeringServiceName, Name, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringServiceName=PeeringServiceName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_GetViaIdentity.cs b/src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_GetViaIdentity.cs new file mode 100644 index 000000000000..cae7d9edb340 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_GetViaIdentity.cs @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering + /// service. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringConnectionMonitorTest_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringConnectionMonitorTest_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringConnectionMonitorTest_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ConnectionMonitorTestsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ConnectionMonitorTestName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ConnectionMonitorTestName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ConnectionMonitorTestsGet(InputObject.ResourceGroupName ?? null, InputObject.PeeringServiceName ?? null, InputObject.ConnectionMonitorTestName ?? null, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_List.cs new file mode 100644 index 000000000000..4fccff9d14cb --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringConnectionMonitorTest_List.cs @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Lists all connection monitor tests under the given subscription, resource group and peering service. + /// + /// + /// [OpenAPI] ListByPeeringService=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringConnectionMonitorTest_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all connection monitor tests under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringConnectionMonitorTest_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _peeringServiceName; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringServiceName { get => this._peeringServiceName; set => this._peeringServiceName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringConnectionMonitorTest_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ConnectionMonitorTestsListByPeeringService(ResourceGroupName, PeeringServiceName, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringServiceName=PeeringServiceName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTestListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ConnectionMonitorTestsListByPeeringService_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringLegacy_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringLegacy_List.cs new file mode 100644 index 000000000000..f1d829557331 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringLegacy_List.cs @@ -0,0 +1,457 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Lists all of the legacy peerings under the given subscription matching the specified kind and location. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/legacyPeerings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringLegacy_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the legacy peerings under the given subscription matching the specified kind and location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringLegacy_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Backing field for property. + private int _asn; + + /// The ASN number associated with a legacy peering. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The ASN number associated with a legacy peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ASN number associated with a legacy peering.", + SerializedName = @"asn", + PossibleTypes = new [] { typeof(int) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public int Asn { get => this._asn; set => this._asn = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType _directPeeringType; + + /// The direct peering type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The direct peering type.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The direct peering type.", + SerializedName = @"directPeeringType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType DirectPeeringType { get => this._directPeeringType; set => this._directPeeringType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind _kind; + + /// The kind of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The kind of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The kind of the peering.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind Kind { get => this._kind; set => this._kind = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _peeringLocation; + + /// The location of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The location of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The location of the peering.", + SerializedName = @"peeringLocation", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string PeeringLocation { get => this._peeringLocation; set => this._peeringLocation = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringLegacy_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LegacyPeeringsList(PeeringLocation, Kind, this.InvocationInformation.BoundParameters.ContainsKey("Asn") ? Asn : default(int?), this.InvocationInformation.BoundParameters.ContainsKey("DirectPeeringType") ? DirectPeeringType : null, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PeeringLocation=PeeringLocation,Kind=Kind,Asn=this.InvocationInformation.BoundParameters.ContainsKey("Asn") ? Asn : default(int?),DirectPeeringType=this.InvocationInformation.BoundParameters.ContainsKey("DirectPeeringType") ? DirectPeeringType : null,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PeeringLocation=PeeringLocation, Kind=Kind, Asn=this.InvocationInformation.BoundParameters.ContainsKey("Asn") ? Asn : default(int?), DirectPeeringType=this.InvocationInformation.BoundParameters.ContainsKey("DirectPeeringType") ? DirectPeeringType : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PeeringLocation=PeeringLocation, Kind=Kind, Asn=this.InvocationInformation.BoundParameters.ContainsKey("Asn") ? Asn : default(int?), DirectPeeringType=this.InvocationInformation.BoundParameters.ContainsKey("DirectPeeringType") ? DirectPeeringType : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LegacyPeeringsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringLocation_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringLocation_List.cs new file mode 100644 index 000000000000..6795b08d38c0 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringLocation_List.cs @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the available peering locations for the specified kind of peering. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringLocation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the available peering locations for the specified kind of peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringLocation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType _directPeeringType; + + /// The type of direct peering. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of direct peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of direct peering.", + SerializedName = @"directPeeringType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType DirectPeeringType { get => this._directPeeringType; set => this._directPeeringType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind _kind; + + /// The kind of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The kind of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The kind of the peering.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind Kind { get => this._kind; set => this._kind = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringLocation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringLocationsList(Kind, this.InvocationInformation.BoundParameters.ContainsKey("DirectPeeringType") ? DirectPeeringType : null, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Kind=Kind,DirectPeeringType=this.InvocationInformation.BoundParameters.ContainsKey("DirectPeeringType") ? DirectPeeringType : null,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Kind=Kind, DirectPeeringType=this.InvocationInformation.BoundParameters.ContainsKey("DirectPeeringType") ? DirectPeeringType : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Kind=Kind, DirectPeeringType=this.InvocationInformation.BoundParameters.ContainsKey("DirectPeeringType") ? DirectPeeringType : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocationListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringLocationsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringOperation_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringOperation_List.cs new file mode 100644 index 000000000000..44eff37b762a --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringOperation_List.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the available API operations for peering resources. + /// + /// [OpenAPI] List=>GET:"/providers/Microsoft.Peering/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringOperation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the available API operations for peering resources.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringOperation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringOperation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList(onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperationListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringReceivedRoute_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringReceivedRoute_List.cs new file mode 100644 index 000000000000..051c2eca41f2 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringReceivedRoute_List.cs @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Lists the prefixes received over the specified peering under the given subscription and resource group. + /// + /// + /// [OpenAPI] ListByPeering=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/receivedRoutes" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringReceivedRoute_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists the prefixes received over the specified peering under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringReceivedRoute_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Backing field for property. + private string _asPath; + + /// The optional AS path that can be used to filter the routes. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The optional AS path that can be used to filter the routes.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The optional AS path that can be used to filter the routes.", + SerializedName = @"asPath", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string AsPath { get => this._asPath; set => this._asPath = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _originAsValidationState; + + /// The optional origin AS validation state that can be used to filter the routes. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The optional origin AS validation state that can be used to filter the routes.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The optional origin AS validation state that can be used to filter the routes.", + SerializedName = @"originAsValidationState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string OriginAsValidationState { get => this._originAsValidationState; set => this._originAsValidationState = value; } + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _prefix; + + /// The optional prefix that can be used to filter the routes. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The optional prefix that can be used to filter the routes.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The optional prefix that can be used to filter the routes.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string Prefix { get => this._prefix; set => this._prefix = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _rpkiValidationState; + + /// The optional RPKI validation state that can be used to filter the routes. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The optional RPKI validation state that can be used to filter the routes.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The optional RPKI validation state that can be used to filter the routes.", + SerializedName = @"rpkiValidationState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string RpkiValidationState { get => this._rpkiValidationState; set => this._rpkiValidationState = value; } + + /// Backing field for property. + private string _skipToken; + + /// + /// The optional page continuation token that is used in the event of paginated result. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The optional page continuation token that is used in the event of paginated result.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The optional page continuation token that is used in the event of paginated result.", + SerializedName = @"$skipToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string SkipToken { get => this._skipToken; set => this._skipToken = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringReceivedRoute_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReceivedRoutesListByPeering(ResourceGroupName, PeeringName, this.InvocationInformation.BoundParameters.ContainsKey("Prefix") ? Prefix : null, this.InvocationInformation.BoundParameters.ContainsKey("AsPath") ? AsPath : null, this.InvocationInformation.BoundParameters.ContainsKey("OriginAsValidationState") ? OriginAsValidationState : null, this.InvocationInformation.BoundParameters.ContainsKey("RpkiValidationState") ? RpkiValidationState : null, this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,Prefix=this.InvocationInformation.BoundParameters.ContainsKey("Prefix") ? Prefix : null,AsPath=this.InvocationInformation.BoundParameters.ContainsKey("AsPath") ? AsPath : null,OriginAsValidationState=this.InvocationInformation.BoundParameters.ContainsKey("OriginAsValidationState") ? OriginAsValidationState : null,RpkiValidationState=this.InvocationInformation.BoundParameters.ContainsKey("RpkiValidationState") ? RpkiValidationState : null,SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Prefix=this.InvocationInformation.BoundParameters.ContainsKey("Prefix") ? Prefix : null, AsPath=this.InvocationInformation.BoundParameters.ContainsKey("AsPath") ? AsPath : null, OriginAsValidationState=this.InvocationInformation.BoundParameters.ContainsKey("OriginAsValidationState") ? OriginAsValidationState : null, RpkiValidationState=this.InvocationInformation.BoundParameters.ContainsKey("RpkiValidationState") ? RpkiValidationState : null, SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Prefix=this.InvocationInformation.BoundParameters.ContainsKey("Prefix") ? Prefix : null, AsPath=this.InvocationInformation.BoundParameters.ContainsKey("AsPath") ? AsPath : null, OriginAsValidationState=this.InvocationInformation.BoundParameters.ContainsKey("OriginAsValidationState") ? OriginAsValidationState : null, RpkiValidationState=this.InvocationInformation.BoundParameters.ContainsKey("RpkiValidationState") ? RpkiValidationState : null, SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRouteListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReceivedRoutesListByPeering_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_Get.cs b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_Get.cs new file mode 100644 index 000000000000..0654ff7653ab --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_Get.cs @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringRegisteredAsn_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing registered ASN with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringRegisteredAsn_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the registered ASN. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the registered ASN.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the registered ASN.", + SerializedName = @"registeredAsnName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("RegisteredAsnName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringRegisteredAsn_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredAsnsGet(ResourceGroupName, PeeringName, Name, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_GetViaIdentity.cs b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_GetViaIdentity.cs new file mode 100644 index 000000000000..eaffde155aa0 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_GetViaIdentity.cs @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringRegisteredAsn_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing registered ASN with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringRegisteredAsn_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringRegisteredAsn_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.RegisteredAsnsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RegisteredAsnName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RegisteredAsnName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.RegisteredAsnsGet(InputObject.ResourceGroupName ?? null, InputObject.PeeringName ?? null, InputObject.RegisteredAsnName ?? null, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_List.cs new file mode 100644 index 000000000000..1db8609d6617 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredAsn_List.cs @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Lists all registered ASNs under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] ListByPeering=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringRegisteredAsn_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all registered ASNs under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringRegisteredAsn_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringRegisteredAsn_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredAsnsListByPeering(ResourceGroupName, PeeringName, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsnListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredAsnsListByPeering_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_Get.cs b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_Get.cs new file mode 100644 index 000000000000..fc2cd93a0b29 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_Get.cs @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringRegisteredPrefix_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing registered prefix with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringRegisteredPrefix_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the registered prefix. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the registered prefix.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the registered prefix.", + SerializedName = @"registeredPrefixName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("RegisteredPrefixName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringRegisteredPrefix_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredPrefixesGet(ResourceGroupName, PeeringName, Name, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_GetViaIdentity.cs b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_GetViaIdentity.cs new file mode 100644 index 000000000000..26cf8e6104c2 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_GetViaIdentity.cs @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringRegisteredPrefix_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing registered prefix with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringRegisteredPrefix_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringRegisteredPrefix_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.RegisteredPrefixesGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RegisteredPrefixName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RegisteredPrefixName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.RegisteredPrefixesGet(InputObject.ResourceGroupName ?? null, InputObject.PeeringName ?? null, InputObject.RegisteredPrefixName ?? null, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_List.cs new file mode 100644 index 000000000000..cda08e2632b6 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringRegisteredPrefix_List.cs @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Lists all registered prefixes under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] ListByPeering=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringRegisteredPrefix_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all registered prefixes under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringRegisteredPrefix_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringRegisteredPrefix_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredPrefixesListByPeering(ResourceGroupName, PeeringName, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefixListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredPrefixesListByPeering_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringRpUnbilledPrefix_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringRpUnbilledPrefix_List.cs new file mode 100644 index 000000000000..a95bb86137ad --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringRpUnbilledPrefix_List.cs @@ -0,0 +1,439 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the RP unbilled prefixes for the specified peering + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/rpUnbilledPrefixes" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringRpUnbilledPrefix_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the RP unbilled prefixes for the specified peering")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringRpUnbilledPrefix_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// Backing field for property. + private global::System.Management.Automation.SwitchParameter _consolidate; + + /// Flag to enable consolidation prefixes + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Flag to enable consolidation prefixes")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Flag to enable consolidation prefixes", + SerializedName = @"consolidate", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public global::System.Management.Automation.SwitchParameter Consolidate { get => this._consolidate; set => this._consolidate = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _peeringName; + + /// The peering name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The peering name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The peering name.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The Azure resource group name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure resource group name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure resource group name.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringRpUnbilledPrefix_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RpUnbilledPrefixesList(ResourceGroupName, PeeringName, this.InvocationInformation.BoundParameters.ContainsKey("Consolidate") ? Consolidate : default(global::System.Management.Automation.SwitchParameter?), SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,Consolidate=this.InvocationInformation.BoundParameters.ContainsKey("Consolidate") ? Consolidate : default(global::System.Management.Automation.SwitchParameter?),SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Consolidate=this.InvocationInformation.BoundParameters.ContainsKey("Consolidate") ? Consolidate : default(global::System.Management.Automation.SwitchParameter?), SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Consolidate=this.InvocationInformation.BoundParameters.ContainsKey("Consolidate") ? Consolidate : default(global::System.Management.Automation.SwitchParameter?), SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefixListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RpUnbilledPrefixesList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringServiceCountry_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringServiceCountry_List.cs new file mode 100644 index 000000000000..0ae7067723e0 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringServiceCountry_List.cs @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the available countries for peering service. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringServiceCountry_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the available countries for peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringServiceCountry_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringServiceCountry_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServiceCountriesList(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceCountryListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServiceCountriesList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringServiceLocation_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringServiceLocation_List.cs new file mode 100644 index 000000000000..6f49d2e0c95a --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringServiceLocation_List.cs @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the available locations for peering service. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceLocations" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringServiceLocation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the available locations for peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringServiceLocation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _country; + + /// The country of interest, in which the locations are to be present. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The country of interest, in which the locations are to be present.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country of interest, in which the locations are to be present.", + SerializedName = @"country", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string Country { get => this._country; set => this._country = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringServiceLocation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServiceLocationsList(this.InvocationInformation.BoundParameters.ContainsKey("Country") ? Country : null, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Country=this.InvocationInformation.BoundParameters.ContainsKey("Country") ? Country : null,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Country=this.InvocationInformation.BoundParameters.ContainsKey("Country") ? Country : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Country=this.InvocationInformation.BoundParameters.ContainsKey("Country") ? Country : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocationListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServiceLocationsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_Get.cs b/src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_Get.cs new file mode 100644 index 000000000000..0b50bd330903 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_Get.cs @@ -0,0 +1,434 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringServicePrefix_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing prefix with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringServicePrefix_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _expand; + + /// The properties to be expanded. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The properties to be expanded.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The properties to be expanded.", + SerializedName = @"$expand", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string Expand { get => this._expand; set => this._expand = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the prefix. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the prefix.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the prefix.", + SerializedName = @"prefixName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PrefixName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _peeringServiceName; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringServiceName { get => this._peeringServiceName; set => this._peeringServiceName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringServicePrefix_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrefixesGet(ResourceGroupName, PeeringServiceName, Name, this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringServiceName=PeeringServiceName,Name=Name,Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_GetViaIdentity.cs b/src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_GetViaIdentity.cs new file mode 100644 index 000000000000..188942bb5d71 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_GetViaIdentity.cs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringServicePrefix_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing prefix with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringServicePrefix_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _expand; + + /// The properties to be expanded. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The properties to be expanded.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The properties to be expanded.", + SerializedName = @"$expand", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string Expand { get => this._expand; set => this._expand = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringServicePrefix_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PrefixesGetViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PrefixName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrefixName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrefixesGet(InputObject.ResourceGroupName ?? null, InputObject.PeeringServiceName ?? null, InputObject.PrefixName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_List.cs new file mode 100644 index 000000000000..90f74cf35151 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringServicePrefix_List.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Lists all prefixes under the given subscription, resource group and peering service. + /// + /// + /// [OpenAPI] ListByPeeringService=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringServicePrefix_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all prefixes under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringServicePrefix_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _expand; + + /// The properties to be expanded. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The properties to be expanded.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The properties to be expanded.", + SerializedName = @"$expand", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string Expand { get => this._expand; set => this._expand = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _peeringServiceName; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringServiceName { get => this._peeringServiceName; set => this._peeringServiceName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringServicePrefix_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrefixesListByPeeringService(ResourceGroupName, PeeringServiceName, this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringServiceName=PeeringServiceName,Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefixListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrefixesListByPeeringService_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringServiceProvider_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringServiceProvider_List.cs new file mode 100644 index 000000000000..07f7e5385274 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringServiceProvider_List.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Lists all of the available peering service locations for the specified kind of peering. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceProviders" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringServiceProvider_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the available peering service locations for the specified kind of peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringServiceProvider_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringServiceProvider_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServiceProvidersList(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProviderListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServiceProvidersList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringService_Get.cs b/src/Peering/generated/cmdlets/GetAzPeeringService_Get.cs new file mode 100644 index 000000000000..d6098cf5aed0 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringService_Get.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing peering service with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringService_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing peering service with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringService_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeeringServiceName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringService_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServicesGet(ResourceGroupName, Name, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringService_GetViaIdentity.cs b/src/Peering/generated/cmdlets/GetAzPeeringService_GetViaIdentity.cs new file mode 100644 index 000000000000..e480552150eb --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringService_GetViaIdentity.cs @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing peering service with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringService_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing peering service with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringService_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringService_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PeeringServicesGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PeeringServicesGet(InputObject.ResourceGroupName ?? null, InputObject.PeeringServiceName ?? null, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringService_List.cs b/src/Peering/generated/cmdlets/GetAzPeeringService_List.cs new file mode 100644 index 000000000000..00f588d275bb --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringService_List.cs @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Lists all of the peering services under the given subscription and resource group. + /// + /// + /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringService_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the peering services under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringService_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringService_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServicesListByResourceGroup(ResourceGroupName, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServicesListByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeeringService_List1.cs b/src/Peering/generated/cmdlets/GetAzPeeringService_List1.cs new file mode 100644 index 000000000000..669fd61ab9b4 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeeringService_List1.cs @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the peerings under the given subscription. + /// + /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServices" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeeringService_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the peerings under the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeeringService_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeeringService_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServicesListBySubscription(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServicesListBySubscription_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeering_Get.cs b/src/Peering/generated/cmdlets/GetAzPeering_Get.cs new file mode 100644 index 000000000000..0dcd1a30bacd --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeering_Get.cs @@ -0,0 +1,404 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing peering with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeering_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing peering with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeering_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeeringName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Intializes a new instance of the cmdlet class. + public GetAzPeering_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringsGet(ResourceGroupName, Name, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeering_GetViaIdentity.cs b/src/Peering/generated/cmdlets/GetAzPeering_GetViaIdentity.cs new file mode 100644 index 000000000000..3f505945eafa --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeering_GetViaIdentity.cs @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Gets an existing peering with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeering_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Gets an existing peering with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeering_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeering_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PeeringsGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PeeringsGet(InputObject.ResourceGroupName ?? null, InputObject.PeeringName ?? null, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeering_List.cs b/src/Peering/generated/cmdlets/GetAzPeering_List.cs new file mode 100644 index 000000000000..1ccfa8303565 --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeering_List.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the peerings under the given subscription and resource group. + /// + /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeering_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the peerings under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeering_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Intializes a new instance of the cmdlet class. + public GetAzPeering_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringsListByResourceGroup(ResourceGroupName, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringsListByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/GetAzPeering_List1.cs b/src/Peering/generated/cmdlets/GetAzPeering_List1.cs new file mode 100644 index 000000000000..28ef3ff362dd --- /dev/null +++ b/src/Peering/generated/cmdlets/GetAzPeering_List1.cs @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Lists all of the peerings under the given subscription. + /// + /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPeering_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Lists all of the peerings under the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class GetAzPeering_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzPeering_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringsListBySubscription(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringsListBySubscription_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/InitializeAzPeeringServiceConnectionMonitor_Initialize.cs b/src/Peering/generated/cmdlets/InitializeAzPeeringServiceConnectionMonitor_Initialize.cs new file mode 100644 index 000000000000..4d7477b9db88 --- /dev/null +++ b/src/Peering/generated/cmdlets/InitializeAzPeeringServiceConnectionMonitor_Initialize.cs @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Initialize Peering Service for Connection Monitor functionality + /// + /// [OpenAPI] InitializeConnectionMonitor=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/initializeConnectionMonitor" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Initialize, @"AzPeeringServiceConnectionMonitor_Initialize", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Initialize Peering Service for Connection Monitor functionality")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class InitializeAzPeeringServiceConnectionMonitor_Initialize : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InitializeAzPeeringServiceConnectionMonitor_Initialize() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringServicesInitializeConnectionMonitor' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServicesInitializeConnectionMonitor(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/InitializeAzPeeringServiceConnectionMonitor_InitializeViaIdentity.cs b/src/Peering/generated/cmdlets/InitializeAzPeeringServiceConnectionMonitor_InitializeViaIdentity.cs new file mode 100644 index 000000000000..4dfc0c2202bf --- /dev/null +++ b/src/Peering/generated/cmdlets/InitializeAzPeeringServiceConnectionMonitor_InitializeViaIdentity.cs @@ -0,0 +1,383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Initialize Peering Service for Connection Monitor functionality + /// + /// [OpenAPI] InitializeConnectionMonitor=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/initializeConnectionMonitor" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Initialize, @"AzPeeringServiceConnectionMonitor_InitializeViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Initialize Peering Service for Connection Monitor functionality")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class InitializeAzPeeringServiceConnectionMonitor_InitializeViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InitializeAzPeeringServiceConnectionMonitor_InitializeViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringServicesInitializeConnectionMonitor' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PeeringServicesInitializeConnectionMonitorViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PeeringServicesInitializeConnectionMonitor(InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/NewAzPeeringAsn_CreateExpanded.cs b/src/Peering/generated/cmdlets/NewAzPeeringAsn_CreateExpanded.cs new file mode 100644 index 000000000000..7703246a4ab6 --- /dev/null +++ b/src/Peering/generated/cmdlets/NewAzPeeringAsn_CreateExpanded.cs @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPeeringAsn_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class NewAzPeeringAsn_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The essential information related to the peer's ASN. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn _peerAsnBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeerAsn(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The peer ASN name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The peer ASN name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The peer ASN name.", + SerializedName = @"peerAsnName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeerAsnName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// The Autonomous System Number (ASN) of the peer. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Autonomous System Number (ASN) of the peer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Autonomous System Number (ASN) of the peer.", + SerializedName = @"peerAsn", + PossibleTypes = new [] { typeof(int) })] + public int PeerAsn { get => _peerAsnBody.PropertiesPeerAsn ?? default(int); set => _peerAsnBody.PropertiesPeerAsn = value; } + + /// The contact details of the peer. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The contact details of the peer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The contact details of the peer.", + SerializedName = @"peerContactDetail", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[] PeerContactDetail { get => _peerAsnBody.PeerContactDetail ?? null /* arrayOf */; set => _peerAsnBody.PeerContactDetail = value; } + + /// The name of the peer. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the peer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peer.", + SerializedName = @"peerName", + PossibleTypes = new [] { typeof(string) })] + public string PeerName { get => _peerAsnBody.PeerName ?? null; set => _peerAsnBody.PeerName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzPeeringAsn_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeerAsnsCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeerAsnsCreateOrUpdate(Name, SubscriptionId, _peerAsnBody, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,body=_peerAsnBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + WriteObject((await response)); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, body=_peerAsnBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, body=_peerAsnBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/NewAzPeeringConnectionMonitorTest_CreateExpanded.cs b/src/Peering/generated/cmdlets/NewAzPeeringConnectionMonitorTest_CreateExpanded.cs new file mode 100644 index 000000000000..1f6c9869c13c --- /dev/null +++ b/src/Peering/generated/cmdlets/NewAzPeeringConnectionMonitorTest_CreateExpanded.cs @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Creates or updates a connection monitor test with the specified name under the given subscription, resource group and + /// peering service. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPeeringConnectionMonitorTest_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Creates or updates a connection monitor test with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class NewAzPeeringConnectionMonitorTest_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The Connection Monitor Test class. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest _connectionMonitorTestBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ConnectionMonitorTest(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The Connection Monitor test destination + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Connection Monitor test destination")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test destination", + SerializedName = @"destination", + PossibleTypes = new [] { typeof(string) })] + public string Destination { get => _connectionMonitorTestBody.Destination ?? null; set => _connectionMonitorTestBody.Destination = value; } + + /// The Connection Monitor test destination port + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Connection Monitor test destination port")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test destination port", + SerializedName = @"destinationPort", + PossibleTypes = new [] { typeof(int) })] + public int DestinationPort { get => _connectionMonitorTestBody.DestinationPort ?? default(int); set => _connectionMonitorTestBody.DestinationPort = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the connection monitor test + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the connection monitor test")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the connection monitor test", + SerializedName = @"connectionMonitorTestName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ConnectionMonitorTestName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _peeringServiceName; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringServiceName { get => this._peeringServiceName; set => this._peeringServiceName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// The Connection Monitor test source agent + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Connection Monitor test source agent")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test source agent", + SerializedName = @"sourceAgent", + PossibleTypes = new [] { typeof(string) })] + public string SourceAgent { get => _connectionMonitorTestBody.SourceAgent ?? null; set => _connectionMonitorTestBody.SourceAgent = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// The Connection Monitor test frequency in seconds + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Connection Monitor test frequency in seconds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Connection Monitor test frequency in seconds", + SerializedName = @"testFrequencyInSec", + PossibleTypes = new [] { typeof(int) })] + public int TestFrequencyInSec { get => _connectionMonitorTestBody.TestFrequencyInSec ?? default(int); set => _connectionMonitorTestBody.TestFrequencyInSec = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzPeeringConnectionMonitorTest_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ConnectionMonitorTestsCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ConnectionMonitorTestsCreateOrUpdate(ResourceGroupName, PeeringServiceName, Name, SubscriptionId, _connectionMonitorTestBody, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringServiceName=PeeringServiceName,Name=Name,SubscriptionId=SubscriptionId,body=_connectionMonitorTestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + WriteObject((await response)); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId, body=_connectionMonitorTestBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId, body=_connectionMonitorTestBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/NewAzPeeringRegisteredAsn_CreateExpanded.cs b/src/Peering/generated/cmdlets/NewAzPeeringRegisteredAsn_CreateExpanded.cs new file mode 100644 index 000000000000..9a74d0ef2e28 --- /dev/null +++ b/src/Peering/generated/cmdlets/NewAzPeeringRegisteredAsn_CreateExpanded.cs @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPeeringRegisteredAsn_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Creates a new registered ASN with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class NewAzPeeringRegisteredAsn_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The customer's ASN that is registered by the peering service provider. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn _registeredAsnBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredAsn(); + + /// The customer's ASN from which traffic originates. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer's ASN from which traffic originates.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer's ASN from which traffic originates.", + SerializedName = @"asn", + PossibleTypes = new [] { typeof(int) })] + public int Asn { get => _registeredAsnBody.Asn ?? default(int); set => _registeredAsnBody.Asn = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the ASN. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the ASN.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the ASN.", + SerializedName = @"registeredAsnName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("RegisteredAsnName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzPeeringRegisteredAsn_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'RegisteredAsnsCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredAsnsCreateOrUpdate(ResourceGroupName, PeeringName, Name, SubscriptionId, _registeredAsnBody, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,Name=Name,SubscriptionId=SubscriptionId,body=_registeredAsnBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + WriteObject((await response)); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId, body=_registeredAsnBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId, body=_registeredAsnBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/NewAzPeeringRegisteredPrefix_CreateExpanded.cs b/src/Peering/generated/cmdlets/NewAzPeeringRegisteredPrefix_CreateExpanded.cs new file mode 100644 index 000000000000..e3074d274c38 --- /dev/null +++ b/src/Peering/generated/cmdlets/NewAzPeeringRegisteredPrefix_CreateExpanded.cs @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPeeringRegisteredPrefix_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Creates a new registered prefix with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class NewAzPeeringRegisteredPrefix_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The customer's prefix that is registered by the peering service provider. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix _registeredPrefixBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringRegisteredPrefix(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the registered prefix. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the registered prefix.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the registered prefix.", + SerializedName = @"registeredPrefixName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("RegisteredPrefixName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The customer's prefix from which traffic originates. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer's prefix from which traffic originates.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer's prefix from which traffic originates.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + public string Prefix { get => _registeredPrefixBody.Prefix ?? null; set => _registeredPrefixBody.Prefix = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzPeeringRegisteredPrefix_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'RegisteredPrefixesCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredPrefixesCreateOrUpdate(ResourceGroupName, PeeringName, Name, SubscriptionId, _registeredPrefixBody, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,Name=Name,SubscriptionId=SubscriptionId,body=_registeredPrefixBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + WriteObject((await response)); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId, body=_registeredPrefixBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId, body=_registeredPrefixBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/NewAzPeeringServicePrefix_CreateExpanded.cs b/src/Peering/generated/cmdlets/NewAzPeeringServicePrefix_CreateExpanded.cs new file mode 100644 index 000000000000..45d2bb551ad2 --- /dev/null +++ b/src/Peering/generated/cmdlets/NewAzPeeringServicePrefix_CreateExpanded.cs @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Creates a new prefix with the specified name under the given subscription, resource group and peering service. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPeeringServicePrefix_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Creates a new prefix with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class NewAzPeeringServicePrefix_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The peering service prefix class. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix _peeringServicePrefixBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringServicePrefix(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the prefix. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the prefix.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the prefix.", + SerializedName = @"prefixName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PrefixName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _peeringServiceName; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringServiceName { get => this._peeringServiceName; set => this._peeringServiceName = value; } + + /// The peering service prefix key + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The peering service prefix key")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The peering service prefix key", + SerializedName = @"peeringServicePrefixKey", + PossibleTypes = new [] { typeof(string) })] + public string PeeringServicePrefixKey { get => _peeringServicePrefixBody.Key ?? null; set => _peeringServicePrefixBody.Key = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The prefix from which your traffic originates. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The prefix from which your traffic originates.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The prefix from which your traffic originates.", + SerializedName = @"prefix", + PossibleTypes = new [] { typeof(string) })] + public string Prefix { get => _peeringServicePrefixBody.Prefix ?? null; set => _peeringServicePrefixBody.Prefix = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzPeeringServicePrefix_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrefixesCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrefixesCreateOrUpdate(ResourceGroupName, PeeringServiceName, Name, SubscriptionId, _peeringServicePrefixBody, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringServiceName=PeeringServiceName,Name=Name,SubscriptionId=SubscriptionId,body=_peeringServicePrefixBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + WriteObject((await response)); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId, body=_peeringServicePrefixBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId, body=_peeringServicePrefixBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/NewAzPeeringService_CreateExpanded.cs b/src/Peering/generated/cmdlets/NewAzPeeringService_CreateExpanded.cs new file mode 100644 index 000000000000..5520663877f4 --- /dev/null +++ b/src/Peering/generated/cmdlets/NewAzPeeringService_CreateExpanded.cs @@ -0,0 +1,529 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Creates a new peering service or updates an existing peering with the specified name under the given subscription and + /// resource group. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPeeringService_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Creates a new peering service or updates an existing peering with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class NewAzPeeringService_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Peering Service + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService _peeringServiceBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.PeeringService(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The location of the resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The location of the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The location of the resource.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _peeringServiceBody.Location ?? null; set => _peeringServiceBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeeringServiceName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// The location (state/province) of the customer. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The location (state/province) of the customer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The location (state/province) of the customer.", + SerializedName = @"peeringServiceLocation", + PossibleTypes = new [] { typeof(string) })] + public string PeeringServiceLocation { get => _peeringServiceBody.PeeringServiceLocation ?? null; set => _peeringServiceBody.PeeringServiceLocation = value; } + + /// The name of the service provider. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the service provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the service provider.", + SerializedName = @"peeringServiceProvider", + PossibleTypes = new [] { typeof(string) })] + public string PeeringServiceProvider { get => _peeringServiceBody.Provider ?? null; set => _peeringServiceBody.Provider = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The backup peering (Microsoft/service provider) location to be used for customer traffic. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The backup peering (Microsoft/service provider) location to be used for customer traffic.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The backup peering (Microsoft/service provider) location to be used for customer traffic.", + SerializedName = @"providerBackupPeeringLocation", + PossibleTypes = new [] { typeof(string) })] + public string ProviderBackupPeeringLocation { get => _peeringServiceBody.ProviderBackupPeeringLocation ?? null; set => _peeringServiceBody.ProviderBackupPeeringLocation = value; } + + /// + /// The primary peering (Microsoft/service provider) location to be used for customer traffic. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The primary peering (Microsoft/service provider) location to be used for customer traffic.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary peering (Microsoft/service provider) location to be used for customer traffic.", + SerializedName = @"providerPrimaryPeeringLocation", + PossibleTypes = new [] { typeof(string) })] + public string ProviderPrimaryPeeringLocation { get => _peeringServiceBody.ProviderPrimaryPeeringLocation ?? null; set => _peeringServiceBody.ProviderPrimaryPeeringLocation = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// The name of the peering service SKU. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the peering service SKU.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering service SKU.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("SkuName")] + public string Sku { get => _peeringServiceBody.SkuName ?? null; set => _peeringServiceBody.SkuName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// The resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceTags Tag { get => _peeringServiceBody.Tag ?? null /* object */; set => _peeringServiceBody.Tag = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzPeeringService_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringServicesCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServicesCreateOrUpdate(ResourceGroupName, Name, SubscriptionId, _peeringServiceBody, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId,body=_peeringServiceBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + WriteObject((await response)); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_peeringServiceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_peeringServiceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/NewAzPeering_CreateExpanded.cs b/src/Peering/generated/cmdlets/NewAzPeering_CreateExpanded.cs new file mode 100644 index 000000000000..47c0d341668e --- /dev/null +++ b/src/Peering/generated/cmdlets/NewAzPeering_CreateExpanded.cs @@ -0,0 +1,564 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Creates a new peering or updates an existing peering with the specified name under the given subscription and resource + /// group. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPeering_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Creates a new peering or updates an existing peering with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class NewAzPeering_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// + /// Peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering _peeringBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.Peering(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The set of connections that constitute a direct peering. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The set of connections that constitute a direct peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The set of connections that constitute a direct peering.", + SerializedName = @"connections", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] DirectConnection { get => _peeringBody.DirectConnection ?? null /* arrayOf */; set => _peeringBody.DirectConnection = value; } + + /// The identifier of the referenced resource. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identifier of the referenced resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identifier of the referenced resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + public string DirectPeerAsnId { get => _peeringBody.DirectPeerAsnId ?? null; set => _peeringBody.DirectPeerAsnId = value; } + + /// The type of direct peering. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of direct peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of direct peering.", + SerializedName = @"directPeeringType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType DirectPeeringType { get => _peeringBody.DirectPeeringType ?? ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType)""); set => _peeringBody.DirectPeeringType = value; } + + /// The set of connections that constitute an exchange peering. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The set of connections that constitute an exchange peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The set of connections that constitute an exchange peering.", + SerializedName = @"connections", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] ExchangeConnection { get => _peeringBody.ExchangeConnection ?? null /* arrayOf */; set => _peeringBody.ExchangeConnection = value; } + + /// The identifier of the referenced resource. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identifier of the referenced resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identifier of the referenced resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + public string ExchangePeerAsnId { get => _peeringBody.ExchangePeerAsnId ?? null; set => _peeringBody.ExchangePeerAsnId = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The kind of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The kind of the peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The kind of the peering.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind Kind { get => _peeringBody.Kind; set => _peeringBody.Kind = value; } + + /// The location of the resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The location of the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The location of the resource.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _peeringBody.Location ?? null; set => _peeringBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeeringName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// The location of the peering. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The location of the peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The location of the peering.", + SerializedName = @"peeringLocation", + PossibleTypes = new [] { typeof(string) })] + public string PeeringLocation { get => _peeringBody.PeeringLocation ?? null; set => _peeringBody.PeeringLocation = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// The name of the peering SKU. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the peering SKU.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the peering SKU.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("SkuName")] + public string Sku { get => _peeringBody.SkuName ?? null; set => _peeringBody.SkuName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// The resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringTags Tag { get => _peeringBody.Tag ?? null /* object */; set => _peeringBody.Tag = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzPeering_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringsCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringsCreateOrUpdate(ResourceGroupName, Name, SubscriptionId, _peeringBody, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId,body=_peeringBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + WriteObject((await response)); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_peeringBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_peeringBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringAsn_Delete.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringAsn_Delete.cs new file mode 100644 index 000000000000..0b0fe522220f --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringAsn_Delete.cs @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing peer ASN with the specified name under the given subscription. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringAsn_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing peer ASN with the specified name under the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringAsn_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The peer ASN name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The peer ASN name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The peer ASN name.", + SerializedName = @"peerAsnName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeerAsnName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeerAsnsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeerAsnsDelete(Name, SubscriptionId, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringAsn_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringAsn_DeleteViaIdentity.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringAsn_DeleteViaIdentity.cs new file mode 100644 index 000000000000..b9304180632d --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringAsn_DeleteViaIdentity.cs @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing peer ASN with the specified name under the given subscription. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringAsn_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing peer ASN with the specified name under the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringAsn_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeerAsnsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PeerAsnsDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PeerAsnName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeerAsnName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PeerAsnsDelete(InputObject.PeerAsnName ?? null, InputObject.SubscriptionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringAsn_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringConnectionMonitorTest_Delete.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringConnectionMonitorTest_Delete.cs new file mode 100644 index 000000000000..01dace797ef8 --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringConnectionMonitorTest_Delete.cs @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering + /// service. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringConnectionMonitorTest_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringConnectionMonitorTest_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the connection monitor test + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the connection monitor test")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the connection monitor test", + SerializedName = @"connectionMonitorTestName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ConnectionMonitorTestName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// Backing field for property. + private string _peeringServiceName; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringServiceName { get => this._peeringServiceName; set => this._peeringServiceName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ConnectionMonitorTestsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ConnectionMonitorTestsDelete(ResourceGroupName, PeeringServiceName, Name, SubscriptionId, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringServiceName=PeeringServiceName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringConnectionMonitorTest_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringConnectionMonitorTest_DeleteViaIdentity.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringConnectionMonitorTest_DeleteViaIdentity.cs new file mode 100644 index 000000000000..79caa5c29296 --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringConnectionMonitorTest_DeleteViaIdentity.cs @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering + /// service. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringConnectionMonitorTest_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringConnectionMonitorTest_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ConnectionMonitorTestsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ConnectionMonitorTestsDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ConnectionMonitorTestName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ConnectionMonitorTestName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ConnectionMonitorTestsDelete(InputObject.ResourceGroupName ?? null, InputObject.PeeringServiceName ?? null, InputObject.ConnectionMonitorTestName ?? null, InputObject.SubscriptionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringConnectionMonitorTest_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredAsn_Delete.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredAsn_Delete.cs new file mode 100644 index 000000000000..8d3a5fa342b4 --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredAsn_Delete.cs @@ -0,0 +1,459 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringRegisteredAsn_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringRegisteredAsn_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the registered ASN. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the registered ASN.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the registered ASN.", + SerializedName = @"registeredAsnName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("RegisteredAsnName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'RegisteredAsnsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredAsnsDelete(ResourceGroupName, PeeringName, Name, SubscriptionId, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringRegisteredAsn_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredAsn_DeleteViaIdentity.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredAsn_DeleteViaIdentity.cs new file mode 100644 index 000000000000..5aca173dcea2 --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredAsn_DeleteViaIdentity.cs @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringRegisteredAsn_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringRegisteredAsn_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'RegisteredAsnsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.RegisteredAsnsDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RegisteredAsnName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RegisteredAsnName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.RegisteredAsnsDelete(InputObject.ResourceGroupName ?? null, InputObject.PeeringName ?? null, InputObject.RegisteredAsnName ?? null, InputObject.SubscriptionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringRegisteredAsn_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredPrefix_Delete.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredPrefix_Delete.cs new file mode 100644 index 000000000000..828c4b105b9b --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredPrefix_Delete.cs @@ -0,0 +1,459 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringRegisteredPrefix_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringRegisteredPrefix_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the registered prefix. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the registered prefix.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the registered prefix.", + SerializedName = @"registeredPrefixName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("RegisteredPrefixName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'RegisteredPrefixesDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredPrefixesDelete(ResourceGroupName, PeeringName, Name, SubscriptionId, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringRegisteredPrefix_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredPrefix_DeleteViaIdentity.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredPrefix_DeleteViaIdentity.cs new file mode 100644 index 000000000000..3dd9c769267f --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringRegisteredPrefix_DeleteViaIdentity.cs @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringRegisteredPrefix_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringRegisteredPrefix_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'RegisteredPrefixesDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.RegisteredPrefixesDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RegisteredPrefixName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RegisteredPrefixName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.RegisteredPrefixesDelete(InputObject.ResourceGroupName ?? null, InputObject.PeeringName ?? null, InputObject.RegisteredPrefixName ?? null, InputObject.SubscriptionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringRegisteredPrefix_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringServicePrefix_Delete.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringServicePrefix_Delete.cs new file mode 100644 index 000000000000..708a2d4cd9bc --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringServicePrefix_Delete.cs @@ -0,0 +1,459 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringServicePrefix_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing prefix with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringServicePrefix_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the prefix. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the prefix.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the prefix.", + SerializedName = @"prefixName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PrefixName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// Backing field for property. + private string _peeringServiceName; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringServiceName { get => this._peeringServiceName; set => this._peeringServiceName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrefixesDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrefixesDelete(ResourceGroupName, PeeringServiceName, Name, SubscriptionId, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringServiceName=PeeringServiceName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringServicePrefix_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringServiceName=PeeringServiceName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringServicePrefix_DeleteViaIdentity.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringServicePrefix_DeleteViaIdentity.cs new file mode 100644 index 000000000000..f3e6e035f33b --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringServicePrefix_DeleteViaIdentity.cs @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringServicePrefix_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing prefix with the specified name under the given subscription, resource group and peering service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringServicePrefix_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrefixesDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PrefixesDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PrefixName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrefixName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrefixesDelete(InputObject.ResourceGroupName ?? null, InputObject.PeeringServiceName ?? null, InputObject.PrefixName ?? null, InputObject.SubscriptionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringServicePrefix_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringService_Delete.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringService_Delete.cs new file mode 100644 index 000000000000..c4b000b9eb7e --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringService_Delete.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing peering service with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringService_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing peering service with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringService_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeeringServiceName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringServicesDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServicesDelete(ResourceGroupName, Name, SubscriptionId, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringService_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeeringService_DeleteViaIdentity.cs b/src/Peering/generated/cmdlets/RemoveAzPeeringService_DeleteViaIdentity.cs new file mode 100644 index 000000000000..b063be7d81ca --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeeringService_DeleteViaIdentity.cs @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing peering service with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeeringService_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing peering service with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeeringService_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringServicesDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PeeringServicesDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PeeringServicesDelete(InputObject.ResourceGroupName ?? null, InputObject.PeeringServiceName ?? null, InputObject.SubscriptionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeeringService_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeering_Delete.cs b/src/Peering/generated/cmdlets/RemoveAzPeering_Delete.cs new file mode 100644 index 000000000000..6297df3536ec --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeering_Delete.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing peering with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeering_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing peering with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeering_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeeringName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringsDelete(ResourceGroupName, Name, SubscriptionId, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeering_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/RemoveAzPeering_DeleteViaIdentity.cs b/src/Peering/generated/cmdlets/RemoveAzPeering_DeleteViaIdentity.cs new file mode 100644 index 000000000000..38c873c0283e --- /dev/null +++ b/src/Peering/generated/cmdlets/RemoveAzPeering_DeleteViaIdentity.cs @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Deletes an existing peering with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzPeering_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Deletes an existing peering with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class RemoveAzPeering_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PeeringsDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PeeringsDelete(InputObject.ResourceGroupName ?? null, InputObject.PeeringName ?? null, InputObject.SubscriptionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzPeering_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/StartAzPeeringInvokeLookingGlass_Invoke.cs b/src/Peering/generated/cmdlets/StartAzPeeringInvokeLookingGlass_Invoke.cs new file mode 100644 index 000000000000..fe3e627c2ccd --- /dev/null +++ b/src/Peering/generated/cmdlets/StartAzPeeringInvokeLookingGlass_Invoke.cs @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Run looking glass functionality + /// + /// [OpenAPI] Invoke=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/lookingGlass" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Start, @"AzPeeringInvokeLookingGlass_Invoke", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Run looking glass functionality")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class StartAzPeeringInvokeLookingGlass_Invoke : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand _command; + + /// The command to be executed: ping, traceroute, bgpRoute. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The command to be executed: ping, traceroute, bgpRoute.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The command to be executed: ping, traceroute, bgpRoute.", + SerializedName = @"command", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand Command { get => this._command; set => this._command = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _destinationIP; + + /// The IP address of the destination. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The IP address of the destination.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The IP address of the destination.", + SerializedName = @"destinationIP", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string DestinationIP { get => this._destinationIP; set => this._destinationIP = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _sourceLocation; + + /// The location of the source. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The location of the source.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The location of the source.", + SerializedName = @"sourceLocation", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string SourceLocation { get => this._sourceLocation; set => this._sourceLocation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType _sourceType; + + /// The type of the source: Edge site or Azure Region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The type of the source: Edge site or Azure Region.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The type of the source: Edge site or Azure Region.", + SerializedName = @"sourceType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType SourceType { get => this._sourceType; set => this._sourceType = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LookingGlassInvoke' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LookingGlassInvoke(Command, SourceType, SourceLocation, DestinationIP, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Command=Command,SourceType=SourceType,SourceLocation=SourceLocation,DestinationIP=DestinationIP,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StartAzPeeringInvokeLookingGlass_Invoke() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Command=Command, SourceType=SourceType, SourceLocation=SourceLocation, DestinationIP=DestinationIP, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Command=Command, SourceType=SourceType, SourceLocation=SourceLocation, DestinationIP=DestinationIP, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/StartAzPeeringInvokeLookingGlass_InvokeViaIdentity.cs b/src/Peering/generated/cmdlets/StartAzPeeringInvokeLookingGlass_InvokeViaIdentity.cs new file mode 100644 index 000000000000..a9a4bb83e1cf --- /dev/null +++ b/src/Peering/generated/cmdlets/StartAzPeeringInvokeLookingGlass_InvokeViaIdentity.cs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// Run looking glass functionality + /// + /// [OpenAPI] Invoke=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/lookingGlass" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Start, @"AzPeeringInvokeLookingGlass_InvokeViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Run looking glass functionality")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class StartAzPeeringInvokeLookingGlass_InvokeViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand _command; + + /// The command to be executed: ping, traceroute, bgpRoute. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The command to be executed: ping, traceroute, bgpRoute.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The command to be executed: ping, traceroute, bgpRoute.", + SerializedName = @"command", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand Command { get => this._command; set => this._command = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _destinationIP; + + /// The IP address of the destination. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The IP address of the destination.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The IP address of the destination.", + SerializedName = @"destinationIP", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string DestinationIP { get => this._destinationIP; set => this._destinationIP = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _sourceLocation; + + /// The location of the source. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The location of the source.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The location of the source.", + SerializedName = @"sourceLocation", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + public string SourceLocation { get => this._sourceLocation; set => this._sourceLocation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType _sourceType; + + /// The type of the source: Edge site or Azure Region. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The type of the source: Edge site or Azure Region.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The type of the source: Edge site or Azure Region.", + SerializedName = @"sourceType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Query)] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType))] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType SourceType { get => this._sourceType; set => this._sourceType = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LookingGlassInvoke' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.LookingGlassInvokeViaIdentity(InputObject.Id, Command, SourceType, SourceLocation, DestinationIP, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.LookingGlassInvoke(Command, SourceType, SourceLocation, DestinationIP, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Command=Command,SourceType=SourceType,SourceLocation=SourceLocation,DestinationIP=DestinationIP}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StartAzPeeringInvokeLookingGlass_InvokeViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Command=Command, SourceType=SourceType, SourceLocation=SourceLocation, DestinationIP=DestinationIP }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Command=Command, SourceType=SourceType, SourceLocation=SourceLocation, DestinationIP=DestinationIP }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/TestAzPeeringRegisteredPrefix_Validate.cs b/src/Peering/generated/cmdlets/TestAzPeeringRegisteredPrefix_Validate.cs new file mode 100644 index 000000000000..96a3d366f911 --- /dev/null +++ b/src/Peering/generated/cmdlets/TestAzPeeringRegisteredPrefix_Validate.cs @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Validate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}/validate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzPeeringRegisteredPrefix_Validate", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Validates an existing registered prefix with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class TestAzPeeringRegisteredPrefix_Validate : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the registered prefix. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the registered prefix.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the registered prefix.", + SerializedName = @"registeredPrefixName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("RegisteredPrefixName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _peeringName; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string PeeringName { get => this._peeringName; set => this._peeringName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'RegisteredPrefixesValidate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RegisteredPrefixesValidate(ResourceGroupName, PeeringName, Name, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,PeeringName=PeeringName,Name=Name,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzPeeringRegisteredPrefix_Validate() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, PeeringName=PeeringName, Name=Name, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/TestAzPeeringRegisteredPrefix_ValidateViaIdentity.cs b/src/Peering/generated/cmdlets/TestAzPeeringRegisteredPrefix_ValidateViaIdentity.cs new file mode 100644 index 000000000000..9c55e52fd117 --- /dev/null +++ b/src/Peering/generated/cmdlets/TestAzPeeringRegisteredPrefix_ValidateViaIdentity.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. + /// + /// + /// [OpenAPI] Validate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}/validate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzPeeringRegisteredPrefix_ValidateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Validates an existing registered prefix with the specified name under the given subscription, resource group and peering.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class TestAzPeeringRegisteredPrefix_ValidateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'RegisteredPrefixesValidate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.RegisteredPrefixesValidateViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RegisteredPrefixName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RegisteredPrefixName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.RegisteredPrefixesValidate(InputObject.ResourceGroupName ?? null, InputObject.PeeringName ?? null, InputObject.RegisteredPrefixName ?? null, InputObject.SubscriptionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzPeeringRegisteredPrefix_ValidateViaIdentity() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_Check.cs b/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_Check.cs new file mode 100644 index 000000000000..de7c44e000a4 --- /dev/null +++ b/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_Check.cs @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Checks if the peering service provider is present within 1000 miles of customer's location + /// + /// + /// [OpenAPI] CheckServiceProviderAvailability=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzPeeringServiceProviderAvailability_Check", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(string))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Checks if the peering service provider is present within 1000 miles of customer's location")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class TestAzPeeringServiceProviderAvailability_Check : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// + /// Backing field for property. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput _checkServiceProviderAvailabilityInput; + + /// Class for CheckServiceProviderAvailabilityInput + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Class for CheckServiceProviderAvailabilityInput", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Class for CheckServiceProviderAvailabilityInput", + SerializedName = @"checkServiceProviderAvailabilityInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput CheckServiceProviderAvailabilityInput { get => this._checkServiceProviderAvailabilityInput; set => this._checkServiceProviderAvailabilityInput = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a string from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'CheckServiceProviderAvailability' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.CheckServiceProviderAvailability(SubscriptionId, CheckServiceProviderAvailabilityInput, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,body=CheckServiceProviderAvailabilityInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzPeeringServiceProviderAvailability_Check() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, body=CheckServiceProviderAvailabilityInput }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, body=CheckServiceProviderAvailabilityInput }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a string from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be string + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckExpanded.cs b/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckExpanded.cs new file mode 100644 index 000000000000..d7f6f09ece23 --- /dev/null +++ b/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckExpanded.cs @@ -0,0 +1,400 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Checks if the peering service provider is present within 1000 miles of customer's location + /// + /// + /// [OpenAPI] CheckServiceProviderAvailability=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzPeeringServiceProviderAvailability_CheckExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(string))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Checks if the peering service provider is present within 1000 miles of customer's location")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class TestAzPeeringServiceProviderAvailability_CheckExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Class for CheckServiceProviderAvailabilityInput + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput _checkServiceProviderAvailabilityInputBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Gets or sets the peering service location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the peering service location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the peering service location.", + SerializedName = @"peeringServiceLocation", + PossibleTypes = new [] { typeof(string) })] + public string PeeringServiceLocation { get => _checkServiceProviderAvailabilityInputBody.PeeringServiceLocation ?? null; set => _checkServiceProviderAvailabilityInputBody.PeeringServiceLocation = value; } + + /// Gets or sets the peering service provider. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the peering service provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the peering service provider.", + SerializedName = @"peeringServiceProvider", + PossibleTypes = new [] { typeof(string) })] + public string PeeringServiceProvider { get => _checkServiceProviderAvailabilityInputBody.PeeringServiceProvider ?? null; set => _checkServiceProviderAvailabilityInputBody.PeeringServiceProvider = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a string from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'CheckServiceProviderAvailability' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.CheckServiceProviderAvailability(SubscriptionId, _checkServiceProviderAvailabilityInputBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,body=_checkServiceProviderAvailabilityInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzPeeringServiceProviderAvailability_CheckExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, body=_checkServiceProviderAvailabilityInputBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, body=_checkServiceProviderAvailabilityInputBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a string from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be string + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckViaIdentity.cs b/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckViaIdentity.cs new file mode 100644 index 000000000000..42f32b914c5d --- /dev/null +++ b/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckViaIdentity.cs @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Checks if the peering service provider is present within 1000 miles of customer's location + /// + /// + /// [OpenAPI] CheckServiceProviderAvailability=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzPeeringServiceProviderAvailability_CheckViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(string))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Checks if the peering service provider is present within 1000 miles of customer's location")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class TestAzPeeringServiceProviderAvailability_CheckViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// + /// Backing field for property. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput _checkServiceProviderAvailabilityInput; + + /// Class for CheckServiceProviderAvailabilityInput + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Class for CheckServiceProviderAvailabilityInput", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Class for CheckServiceProviderAvailabilityInput", + SerializedName = @"checkServiceProviderAvailabilityInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput CheckServiceProviderAvailabilityInput { get => this._checkServiceProviderAvailabilityInput; set => this._checkServiceProviderAvailabilityInput = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a string from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'CheckServiceProviderAvailability' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.CheckServiceProviderAvailabilityViaIdentity(InputObject.Id, CheckServiceProviderAvailabilityInput, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.CheckServiceProviderAvailability(InputObject.SubscriptionId ?? null, CheckServiceProviderAvailabilityInput, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=CheckServiceProviderAvailabilityInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzPeeringServiceProviderAvailability_CheckViaIdentity() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=CheckServiceProviderAvailabilityInput }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=CheckServiceProviderAvailabilityInput }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a string from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be string + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckViaIdentityExpanded.cs b/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckViaIdentityExpanded.cs new file mode 100644 index 000000000000..d3a3236cedba --- /dev/null +++ b/src/Peering/generated/cmdlets/TestAzPeeringServiceProviderAvailability_CheckViaIdentityExpanded.cs @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Checks if the peering service provider is present within 1000 miles of customer's location + /// + /// + /// [OpenAPI] CheckServiceProviderAvailability=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzPeeringServiceProviderAvailability_CheckViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(string))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Checks if the peering service provider is present within 1000 miles of customer's location")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class TestAzPeeringServiceProviderAvailability_CheckViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Class for CheckServiceProviderAvailabilityInput + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput _checkServiceProviderAvailabilityInputBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Gets or sets the peering service location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the peering service location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the peering service location.", + SerializedName = @"peeringServiceLocation", + PossibleTypes = new [] { typeof(string) })] + public string PeeringServiceLocation { get => _checkServiceProviderAvailabilityInputBody.PeeringServiceLocation ?? null; set => _checkServiceProviderAvailabilityInputBody.PeeringServiceLocation = value; } + + /// Gets or sets the peering service provider. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the peering service provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the peering service provider.", + SerializedName = @"peeringServiceProvider", + PossibleTypes = new [] { typeof(string) })] + public string PeeringServiceProvider { get => _checkServiceProviderAvailabilityInputBody.PeeringServiceProvider ?? null; set => _checkServiceProviderAvailabilityInputBody.PeeringServiceProvider = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a string from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'CheckServiceProviderAvailability' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.CheckServiceProviderAvailabilityViaIdentity(InputObject.Id, _checkServiceProviderAvailabilityInputBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.CheckServiceProviderAvailability(InputObject.SubscriptionId ?? null, _checkServiceProviderAvailabilityInputBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_checkServiceProviderAvailabilityInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public TestAzPeeringServiceProviderAvailability_CheckViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_checkServiceProviderAvailabilityInputBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_checkServiceProviderAvailabilityInputBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a string from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be string + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/UpdateAzPeeringService_UpdateExpanded.cs b/src/Peering/generated/cmdlets/UpdateAzPeeringService_UpdateExpanded.cs new file mode 100644 index 000000000000..57b198c87526 --- /dev/null +++ b/src/Peering/generated/cmdlets/UpdateAzPeeringService_UpdateExpanded.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Updates tags for a peering service with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzPeeringService_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Updates tags for a peering service with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class UpdateAzPeeringService_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The resource tags. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 _tagsBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTags1(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the peering service. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering service.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering service.", + SerializedName = @"peeringServiceName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeeringServiceName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Gets or sets the tags, a dictionary of descriptors arm object + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the tags, a dictionary of descriptors arm object")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the tags, a dictionary of descriptors arm object", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags Tag { get => _tagsBody.Tag ?? null /* object */; set => _tagsBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringServicesUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringServicesUpdate(ResourceGroupName, Name, SubscriptionId, _tagsBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId,body=_tagsBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzPeeringService_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_tagsBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_tagsBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/UpdateAzPeeringService_UpdateViaIdentityExpanded.cs b/src/Peering/generated/cmdlets/UpdateAzPeeringService_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..dbf8c6f927ef --- /dev/null +++ b/src/Peering/generated/cmdlets/UpdateAzPeeringService_UpdateViaIdentityExpanded.cs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Updates tags for a peering service with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzPeeringService_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Updates tags for a peering service with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class UpdateAzPeeringService_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The resource tags. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 _tagsBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTags1(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Gets or sets the tags, a dictionary of descriptors arm object + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the tags, a dictionary of descriptors arm object")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the tags, a dictionary of descriptors arm object", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags Tag { get => _tagsBody.Tag ?? null /* object */; set => _tagsBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringServicesUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PeeringServicesUpdateViaIdentity(InputObject.Id, _tagsBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringServiceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringServiceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PeeringServicesUpdate(InputObject.ResourceGroupName ?? null, InputObject.PeeringServiceName ?? null, InputObject.SubscriptionId ?? null, _tagsBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_tagsBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzPeeringService_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_tagsBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_tagsBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/UpdateAzPeering_UpdateExpanded.cs b/src/Peering/generated/cmdlets/UpdateAzPeering_UpdateExpanded.cs new file mode 100644 index 000000000000..72c78d79c043 --- /dev/null +++ b/src/Peering/generated/cmdlets/UpdateAzPeering_UpdateExpanded.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Updates tags for a peering with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzPeering_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Updates tags for a peering with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class UpdateAzPeering_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The resource tags. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 _tagsBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTags1(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the peering. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the peering.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the peering.", + SerializedName = @"peeringName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PeeringName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The Azure subscription ID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Azure subscription ID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Azure subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Gets or sets the tags, a dictionary of descriptors arm object + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the tags, a dictionary of descriptors arm object")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the tags, a dictionary of descriptors arm object", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags Tag { get => _tagsBody.Tag ?? null /* object */; set => _tagsBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PeeringsUpdate(ResourceGroupName, Name, SubscriptionId, _tagsBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,Name=Name,SubscriptionId=SubscriptionId,body=_tagsBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzPeering_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_tagsBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, Name=Name, SubscriptionId=SubscriptionId, body=_tagsBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/cmdlets/UpdateAzPeering_UpdateViaIdentityExpanded.cs b/src/Peering/generated/cmdlets/UpdateAzPeering_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..6a26be804d9b --- /dev/null +++ b/src/Peering/generated/cmdlets/UpdateAzPeering_UpdateViaIdentityExpanded.cs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + using System; + + /// + /// Updates tags for a peering with the specified name under the given subscription and resource group. + /// + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzPeering_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Description(@"Updates tags for a peering with the specified name under the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Generated] + public partial class UpdateAzPeering_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The resource tags. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags1 _tagsBody = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ResourceTags1(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Peering Client => Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Gets or sets the tags, a dictionary of descriptors arm object + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the tags, a dictionary of descriptors arm object")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Peering.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Peering.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the tags, a dictionary of descriptors arm object", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResourceTags Tag { get => _tagsBody.Tag ?? null /* object */; set => _tagsBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PeeringsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Peering.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PeeringsUpdateViaIdentity(InputObject.Id, _tagsBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PeeringName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PeeringName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PeeringsUpdate(InputObject.ResourceGroupName ?? null, InputObject.PeeringName ?? null, InputObject.SubscriptionId ?? null, _tagsBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_tagsBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzPeering_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_tagsBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_tagsBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/AsyncCommandRuntime.cs b/src/Peering/generated/runtime/AsyncCommandRuntime.cs new file mode 100644 index 000000000000..c4bbb3db2b3f --- /dev/null +++ b/src/Peering/generated/runtime/AsyncCommandRuntime.cs @@ -0,0 +1,832 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + using System.Linq; + + internal interface IAsyncCommandRuntimeExtensions + { + Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep func); + System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs); + + T ExecuteSync(System.Func step); + } + + public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable + { + private ICommandRuntime2 originalCommandRuntime; + private System.Threading.Thread originalThread; + public bool AllowInteractive { get; set; } = false; + + public CancellationToken cancellationToken; + SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); + ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); + ManualResetEventSlim completed = new ManualResetEventSlim(false); + + System.Action runOnMainThread; + + private System.Management.Automation.PSCmdlet cmdlet; + + internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) + { + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + this.cancellationToken = cancellationToken; + this.cmdlet = cmdlet; + if (cmdlet.PagingParameters != null) + { + WriteDebug("Client side pagination is enabled for this cmdlet"); + } + cmdlet.CommandRuntime = this; + } + + public PSHost Host => this.originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; + + private void CheckForInteractive() + { + // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; + if (!AllowInteractive) + { + throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); + } + } + private void WaitOurTurn() + { + // wait for our turn to play + semaphore?.Wait(cancellationToken); + + // ensure that completed is not set + completed.Reset(); + } + + private void WaitForCompletion() + { + // wait for the result (or cancellation!) + WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); + + // let go of the semaphore + semaphore?.Release(); + + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target, string action) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target, action); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + ShouldProcessReason reason = ShouldProcessReason.None; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + shouldProcessReason = reason; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.ThrowTerminatingError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool TransactionAvailable() + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.TransactionAvailable(); + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteCommandDetail(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteCommandDetail(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteDebug(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteDebug(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteDebug(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteInformation(informationRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(sourceId, progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteVerbose(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteVerbose(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteWarning(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteWarning(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteWarning(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) + { + do + { + WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); + if (readyToRun.IsSet) + { + // reset the request for the next time + readyToRun.Reset(); + + // run the delegate on this thread + runOnMainThread(); + + // tell the originator everything is complete + completed.Set(); + } + } + while (!ProcessRecordAsyncTask.IsCompleted); + if (ProcessRecordAsyncTask.IsFaulted) + { + // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. + // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { + // throw aggregate.InnerException; + // } + throw ProcessRecordAsyncTask.Exception; + } + } + public Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync>(() => func(p1, p2, p3)); + public System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs) => funcs?.Select(Wrap); + + public T ExecuteSync(System.Func step) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return step(); + } + + T result = default(T); + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + // set the function to run + runOnMainThread = () => { result = step(); }; + // tell the main thread to go ahead + readyToRun.Set(); + // wait for the result (or cancellation!) + WaitForCompletion(); + // return + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Dispose() + { + if (cmdlet != null) + { + cmdlet.CommandRuntime = this.originalCommandRuntime; + cmdlet = null; + } + + semaphore?.Dispose(); + semaphore = null; + readyToRun?.Dispose(); + readyToRun = null; + completed?.Dispose(); + completed = null; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/AsyncJob.cs b/src/Peering/generated/runtime/AsyncJob.cs new file mode 100644 index 000000000000..4714fa3ec1f7 --- /dev/null +++ b/src/Peering/generated/runtime/AsyncJob.cs @@ -0,0 +1,270 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + + using System.Threading.Tasks; + + public class LongRunningJobCancelledException : System.Exception + { + public LongRunningJobCancelledException(string message) : base(message) + { + + } + } + + public class AsyncJob : Job, System.Management.Automation.ICommandRuntime2 + { + const int MaxRecords = 1000; + + private string _statusMessage = string.Empty; + + public override string StatusMessage => _statusMessage; + + public override bool HasMoreData => Output.Count > 0 || Progress.Count > 0 || Error.Count > 0 || Warning.Count > 0 || Verbose.Count > 0 || Debug.Count > 0; + + public override string Location => "localhost"; + + public PSHost Host => originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => originalCommandRuntime.CurrentPSTransaction; + + public override void StopJob() + { + Cancel(); + } + + private readonly PSCmdlet cmdlet; + private readonly ICommandRuntime2 originalCommandRuntime; + private readonly System.Threading.Thread originalThread; + + private void CheckForInteractive() + { + // This is an interactive call -- We should never allow interactivity in AsnycJob cmdlets. + throw new System.Exception("Cmdlets in AsyncJob; interactive calls are not permitted."); + } + private bool IsJobDone => CancellationToken.IsCancellationRequested || this.JobStateInfo.State == JobState.Failed || this.JobStateInfo.State == JobState.Stopped || this.JobStateInfo.State == JobState.Stopping || this.JobStateInfo.State == JobState.Completed; + + private readonly System.Action Cancel; + private readonly CancellationToken CancellationToken; + + internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name) + { + SetJobState(JobState.NotStarted); + // know how to cancel/check for cancelation + this.CancellationToken = cancellationToken; + this.Cancel = cancelMethod; + + // we might need these. + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + + // the instance of the cmdlet we're going to run + this.cmdlet = cmdlet; + + // set the command runtime to the AsyncJob + cmdlet.CommandRuntime = this; + } + + /// + /// Monitors the task (which should be ProcessRecordAsync) to control + /// the lifetime of the job itself + /// + /// + public void Monitor(Task task) + { + SetJobState(JobState.Running); + task.ContinueWith(antecedent => + { + if (antecedent.IsCanceled) + { + // if the task was canceled, we're just going to call it completed. + SetJobState(JobState.Completed); + } + else if (antecedent.IsFaulted) + { + foreach (var innerException in antecedent.Exception.Flatten().InnerExceptions) + { + WriteError(new System.Management.Automation.ErrorRecord(innerException, string.Empty, System.Management.Automation.ErrorCategory.NotSpecified, null)); + } + + // a fault indicates an actual failure + SetJobState(JobState.Failed); + } + else + { + // otherwiser it's a completed state. + SetJobState(JobState.Completed); + } + }, CancellationToken); + } + + private void CheckForCancellation() + { + if (IsJobDone) + { + throw new LongRunningJobCancelledException("Long running job is canceled or stopping, continuation of the cmdlet is not permitted."); + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + CheckForCancellation(); + + this.Information.Add(informationRecord); + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public void WriteDebug(string text) + { + _statusMessage = text; + CheckForCancellation(); + + if (Debug.IsOpen && Debug.Count < MaxRecords) + { + Debug.Add(new DebugRecord(text)); + } + } + + public void WriteError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + + public void WriteObject(object sendToPipeline) + { + CheckForCancellation(); + + if (Output.IsOpen) + { + Output.Add(new PSObject(sendToPipeline)); + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + CheckForCancellation(); + + if (enumerateCollection && sendToPipeline is System.Collections.IEnumerable enumerable) + { + foreach (var item in enumerable) + { + WriteObject(item); + } + } + else + { + WriteObject(sendToPipeline); + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteVerbose(string text) + { + CheckForCancellation(); + + if (Verbose.IsOpen && Verbose.Count < MaxRecords) + { + Verbose.Add(new VerboseRecord(text)); + } + } + + public void WriteWarning(string text) + { + CheckForCancellation(); + + if (Warning.IsOpen && Warning.Count < MaxRecords) + { + Warning.Add(new WarningRecord(text)); + } + } + + public void WriteCommandDetail(string text) + { + WriteVerbose(text); + } + + public bool ShouldProcess(string target) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string target, string action) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + CheckForInteractive(); + shouldProcessReason = ShouldProcessReason.None; + return false; + } + + public bool ShouldContinue(string query, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public bool TransactionAvailable() + { + // interactivity required? + return false; + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/AsyncOperationResponse.cs b/src/Peering/generated/runtime/AsyncOperationResponse.cs new file mode 100644 index 000000000000..31a27931fe42 --- /dev/null +++ b/src/Peering/generated/runtime/AsyncOperationResponse.cs @@ -0,0 +1,176 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + [System.ComponentModel.TypeConverter(typeof(AsyncOperationResponseTypeConverter))] + public class AsyncOperationResponse + { + private string _target; + public string Target { get => _target; set => _target = value; } + public AsyncOperationResponse() + { + } + internal AsyncOperationResponse(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json) + { + // pull target + { Target = If(json?.PropertyT("target"), out var _v) ? (string)_v : (string)Target; } + } + public string ToJsonString() + { + return $"{{ \"target\" : \"{this.Target}\" }}"; + } + + public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject json ? new AsyncOperationResponse(json) : null; + } + + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(jsonText)); + + } + + public partial class AsyncOperationResponseTypeConverter : System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to a type + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static object ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(AsyncOperationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsyncOperationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); ; + } + catch + { + // Unable to use JSON pattern + } + + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as System.Management.Automation.PSObject).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as global::System.Collections.IDictionary).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs new file mode 100644 index 000000000000..6997775bab28 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "CmdletSurface")] + [DoNotExport] + public class ExportCmdletSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CmdletFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool IncludeGeneralParameters { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetScriptCmdlets(this, CmdletFolder) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + foreach (var profileGroup in profileGroups) + { + var variantGroups = profileGroup.Variants + .GroupBy(v => new { v.CmdletName }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), String.Empty, profileGroup.ProfileName)); + var sb = UseExpandedFormat ? ExpandedFormat(variantGroups) : CondensedFormat(variantGroups); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, $"CmdletSurface-{profileGroup.ProfileName}.md"), sb.ToString()); + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private StringBuilder ExpandedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + foreach (var variantGroup in variantGroups.OrderBy(vg => vg.CmdletName)) + { + sb.Append($"### {variantGroup.CmdletName}{Environment.NewLine}"); + var parameterGroups = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private StringBuilder CondensedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + var condensedGroups = variantGroups + .GroupBy(vg => vg.CmdletNoun) + .Select(vgg => ( + CmdletNoun: vgg.Key, + CmdletVerbs: vgg.Select(vg => vg.CmdletVerb).OrderBy(cv => cv).ToArray(), + ParameterGroups: vgg.SelectMany(vg => vg.ParameterGroups).DistinctBy(p => p.ParameterName).ToArray(), + OutputTypes: vgg.SelectMany(vg => vg.OutputTypes).Select(ot => ot.Type).DistinctBy(t => t.Name).Select(t => t.ToSyntaxTypeName()).ToArray())) + .OrderBy(vg => vg.CmdletNoun); + foreach (var condensedGroup in condensedGroups) + { + sb.Append($"### {condensedGroup.CmdletNoun} [{String.Join(", ", condensedGroup.CmdletVerbs)}] `{String.Join(", ", condensedGroup.OutputTypes)}`{Environment.NewLine}"); + var parameterGroups = condensedGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs new file mode 100644 index 000000000000..6111e0b7b0aa --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ExampleStub")] + [DoNotExport] + public class ExportExampleStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + + var exampleText = String.Join(String.Empty, DefaultExampleHelpInfos.Select(ehi => ehi.ToHelpExampleOutput())); + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var cmdletFilePaths = GetScriptCmdlets(exportDirectory).Select(fi => Path.Combine(outputFolder, $"{fi.Name}.md")).ToArray(); + var currentExamplesFilePaths = Directory.GetFiles(outputFolder).ToArray(); + // Remove examples of non-existing cmdlets + var removedCmdletFilePaths = currentExamplesFilePaths.Except(cmdletFilePaths); + foreach (var removedCmdletFilePath in removedCmdletFilePaths) + { + File.Delete(removedCmdletFilePath); + } + + // Only create example stubs if they don't exist + foreach (var cmdletFilePath in cmdletFilePaths.Except(currentExamplesFilePaths)) + { + File.WriteAllText(cmdletFilePath, exampleText); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs new file mode 100644 index 000000000000..06e1c9c27f4c --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -0,0 +1,101 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "FormatPs1xml")] + [DoNotExport] + public class ExportFormatPs1xml : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string FilePath { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Peering.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Peering.Support"; + private const string PropertiesExcludedForTableview = @"Id,Type"; + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + protected override void ProcessRecord() + { + try + { + var viewModels = GetFilteredViewParameters().Select(CreateViewModel).ToList(); + var ps1xml = new Configuration + { + ViewDefinitions = new ViewDefinitions + { + Views = viewModels + } + }; + File.WriteAllText(FilePath, ps1xml.ToXmlString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static IEnumerable GetFilteredViewParameters() + { + //https://stackoverflow.com/a/79738/294804 + //https://stackoverflow.com/a/949285/294804 + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass + && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace)) + && !t.GetCustomAttributes().Any()); + return types.Select(t => new ViewParameters(t, t.GetProperties() + .Select(p => new PropertyFormat(p)) + .Where(pf => !pf.Property.GetCustomAttributes().Any() + && (!PropertiesExcludedForTableview.Split(',').Contains(pf.Property.Name)) + && (pf.FormatTable != null || (pf.Origin != PropertyOrigin.Inlined && pf.Property.PropertyType.IsPsSimple()))) + .OrderByDescending(pf => pf.Index.HasValue) + .ThenBy(pf => pf.Index) + .ThenByDescending(pf => pf.Origin.HasValue) + .ThenBy(pf => pf.Origin))).Where(vp => vp.Properties.Any()); + } + + private static View CreateViewModel(ViewParameters viewParameters) + { + var entries = viewParameters.Properties.Select(pf => + (TableColumnHeader: new TableColumnHeader { Label = pf.Label, Width = pf.Width }, + TableColumnItem: new TableColumnItem { PropertyName = pf.Property.Name })).ToArray(); + + return new View + { + Name = viewParameters.Type.FullName, + ViewSelectedBy = new ViewSelectedBy + { + TypeName = viewParameters.Type.FullName + }, + TableControl = new TableControl + { + TableHeaders = new TableHeaders + { + TableColumnHeaders = entries.Select(e => e.TableColumnHeader).ToList() + }, + TableRowEntries = new TableRowEntries + { + TableRowEntry = new TableRowEntry + { + TableColumnItems = new TableColumnItems + { + TableItems = entries.Select(e => e.TableColumnItem).ToList() + } + } + } + } + }; + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs new file mode 100644 index 000000000000..bf5293078f80 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.MarkdownRenderer; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "HelpMarkdown")] + [DoNotExport] + public class ExportHelpMarkdown : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSModuleInfo ModuleInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] FunctionInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] HelpInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + var helpInfos = HelpInfo.Select(hi => hi.ToPsHelpInfo()); + var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() + .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) + .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs new file mode 100644 index 000000000000..e0484768b32c --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ModelSurface")] + [DoNotExport] + public class ExportModelSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Peering.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Peering.Support"; + + protected override void ProcessRecord() + { + try + { + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace))); + var typeInfos = types.Select(t => new ModelTypeInfo + { + Type = t, + TypeName = t.Name, + Properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => !p.GetIndexParameters().Any()).OrderBy(p => p.Name).ToArray(), + NamespaceGroup = t.Namespace.Split('.').LastOrDefault().EmptyIfNull() + }).Where(mti => mti.Properties.Any()); + var sb = UseExpandedFormat ? ExpandedFormat(typeInfos) : CondensedFormat(typeInfos); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, "ModelSurface.md"), sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static StringBuilder ExpandedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + foreach (var typeInfo in typeInfos.OrderBy(mti => mti.TypeName).ThenBy(mti => mti.NamespaceGroup)) + { + sb.Append($"### {typeInfo.TypeName} [{typeInfo.NamespaceGroup}]{Environment.NewLine}"); + foreach (var property in typeInfo.Properties) + { + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private static StringBuilder CondensedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + var typeGroups = typeInfos + .GroupBy(mti => mti.TypeName) + .Select(tig => ( + Types: tig.Select(mti => mti.Type).ToArray(), + TypeName: tig.Key, + Properties: tig.SelectMany(mti => mti.Properties).DistinctBy(p => p.Name).OrderBy(p => p.Name).ToArray(), + NamespaceGroups: tig.Select(mti => mti.NamespaceGroup).OrderBy(ng => ng).ToArray() + )) + .OrderBy(tg => tg.TypeName); + foreach (var typeGroup in typeGroups) + { + var aType = typeGroup.Types.Select(GetAssociativeType).FirstOrDefault(t => t != null); + var aText = aType != null ? $@" \<{aType.ToSyntaxTypeName()}\>" : String.Empty; + sb.Append($"### {typeGroup.TypeName}{aText} [{String.Join(", ", typeGroup.NamespaceGroups)}]{Environment.NewLine}"); + foreach (var property in typeGroup.Properties) + { + var propertyAType = GetAssociativeType(property.PropertyType); + var propertyAText = propertyAType != null ? $" <{propertyAType.ToSyntaxTypeName()}>" : String.Empty; + var enumNames = GetEnumFieldNames(property.PropertyType.Unwrap()); + var enumNamesText = enumNames.Any() ? $" **{{{String.Join(", ", enumNames)}}}**" : String.Empty; + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}{propertyAText}`{enumNamesText}{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + //https://stackoverflow.com/a/4963190/294804 + private static Type GetAssociativeType(Type type) => + type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>))?.GetGenericArguments().First(); + + private static string[] GetEnumFieldNames(Type type) => + type.IsValueType && !type.IsPrimitive && type != typeof(decimal) && type != typeof(DateTime) + ? type.GetFields(BindingFlags.Public | BindingFlags.Static).Where(f => f.FieldType == type).Select(p => p.Name).ToArray() + : new string[] { }; + + private class ModelTypeInfo + { + public Type Type { get; set; } + public string TypeName { get; set; } + public PropertyInfo[] Properties { get; set; } + public string NamespaceGroup { get; set; } + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs new file mode 100644 index 000000000000..b1138d473e43 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsHelpers; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.MarkdownRenderer; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsProxyTypeExtensions; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ProxyCmdlet", DefaultParameterSetName = "Docs")] + [DoNotExport] + public class ExportProxyCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string[] ModulePath { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string InternalFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [AllowEmptyString] + public string ModuleDescription { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + public Guid ModuleGuid { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] + public SwitchParameter ExcludeDocs { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetModuleCmdletsAndHelpInfo(this, ModulePath).SelectMany(ci => ci.ToVariants()).Where(v => !v.IsDoNotExport).ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + var variantGroups = profileGroups.SelectMany(pg => pg.Variants + .GroupBy(v => new { v.CmdletName, v.IsInternal }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + .ToArray(); + + var license = new StringBuilder(); + license.Append(@" +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +"); + HashSet LicenseSet = new HashSet(); + foreach (var variantGroup in variantGroups) + { + var parameterGroups = variantGroup.ParameterGroups.ToList(); + var isValidProfile = !String.IsNullOrEmpty(variantGroup.ProfileName) && variantGroup.ProfileName != NoProfiles; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, variantGroup.ProfileName) : ExamplesFolder; + var markdownInfo = new MarkdownHelpInfo(variantGroup, examplesFolder); + List examples = new List(); + foreach (var it in markdownInfo.Examples) + { + examples.Add(it); + } + variantGroup.HelpInfo.Examples = examples.ToArray(); + var sb = new StringBuilder(); + sb.Append($"{Environment.NewLine}"); + sb.Append(variantGroup.ToHelpCommentOutput()); + sb.Append($"function {variantGroup.CmdletName} {{{Environment.NewLine}"); + sb.Append(variantGroup.Aliases.ToAliasOutput()); + sb.Append(variantGroup.OutputTypes.ToOutputTypeOutput()); + sb.Append(variantGroup.ToCmdletBindingOutput()); + sb.Append(variantGroup.ProfileName.ToProfileOutput()); + + sb.Append("param("); + sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + foreach (var parameterGroup in parameterGroups) + { + var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; + parameters = parameters.Where(p => !p.IsHidden()); + if (!parameters.Any()) + { + continue; + } + foreach (var parameter in parameters) + { + sb.Append(parameter.ToParameterOutput(variantGroup.HasMultipleVariants, parameterGroup.HasAllVariants)); + } + sb.Append(parameterGroup.Aliases.ToAliasOutput(true)); + sb.Append(parameterGroup.HasValidateNotNull.ToValidateNotNullOutput()); + sb.Append(parameterGroup.HasAllowEmptyArray.ToAllowEmptyArray()); + sb.Append(parameterGroup.CompleterInfo.ToArgumentCompleterOutput()); + sb.Append(parameterGroup.OrderCategory.ToParameterCategoryOutput()); + sb.Append(parameterGroup.InfoAttribute.ToInfoOutput(parameterGroup.ParameterType)); + sb.Append(parameterGroup.ToDefaultInfoOutput()); + sb.Append(parameterGroup.ParameterType.ToParameterTypeOutput()); + sb.Append(parameterGroup.Description.ToParameterDescriptionOutput()); + sb.Append(parameterGroup.ParameterName.ToParameterNameOutput(parameterGroups.IndexOf(parameterGroup) == parameterGroups.Count - 1)); + } + sb.Append($"){Environment.NewLine}{Environment.NewLine}"); + + sb.Append(variantGroup.ToBeginOutput()); + sb.Append(variantGroup.ToProcessOutput()); + sb.Append(variantGroup.ToEndOutput()); + + sb.Append($"}}{Environment.NewLine}"); + + Directory.CreateDirectory(variantGroup.OutputFolder); + File.WriteAllText(variantGroup.FilePath, license.ToString()); + File.AppendAllText(variantGroup.FilePath, sb.ToString()); + if (!LicenseSet.Contains(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"))) + { + // only add license in the header + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), license.ToString()); + LicenseSet.Add(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1")); + } + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), sb.ToString()); + } + + if (!ExcludeDocs) + { + var moduleInfo = new PsModuleHelpInfo(ModuleName, ModuleGuid, ModuleDescription); + foreach (var variantGroupsByProfile in variantGroups.GroupBy(vg => vg.ProfileName)) + { + var profileName = variantGroupsByProfile.Key; + var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; + var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs new file mode 100644 index 000000000000..2224c1d14527 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -0,0 +1,191 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "Psd1")] + [DoNotExport] + public class ExportPsd1 : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CustomFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + [Parameter(Mandatory = true)] + public Guid ModuleGuid { get; set; } + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private const string CustomFolderRelative = "./custom"; + private const string Indent = Psd1Indent; + private const string Undefined = "undefined"; + private bool IsUndefined(string value) => string.Equals(Undefined, value, StringComparison.OrdinalIgnoreCase); + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + if (!Directory.Exists(CustomFolder)) + { + throw new ArgumentException($"Custom folder '{CustomFolder}' does not exist"); + } + + string version = Convert.ToString(@"0.1.0"); + // Validate the module version should be semantic version + // Following regex is official from https://semver.org/ + Regex rx = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled); + if (rx.Matches(version).Count != 1) + { + throw new ArgumentException("Module-version is not a valid Semantic Version"); + } + + string previewVersion = null; + if (version.Contains('-')) + { + string[] versions = version.Split("-".ToCharArray(), 2); + version = versions[0]; + previewVersion = versions[1]; + } + + var sb = new StringBuilder(); + sb.AppendLine("@{"); + sb.AppendLine($@"{GuidStart} = '{ModuleGuid}'"); + sb.AppendLine($@"{Indent}RootModule = '{"./Az.Peering.psm1"}'"); + sb.AppendLine($@"{Indent}ModuleVersion = '{version}'"); + sb.AppendLine($@"{Indent}CompatiblePSEditions = 'Core', 'Desktop'"); + sb.AppendLine($@"{Indent}Author = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}CompanyName = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}Copyright = '{"Microsoft Corporation. All rights reserved."}'"); + sb.AppendLine($@"{Indent}Description = '{"Microsoft Azure PowerShell: Peering cmdlets"}'"); + sb.AppendLine($@"{Indent}PowerShellVersion = '5.1'"); + sb.AppendLine($@"{Indent}DotNetFrameworkVersion = '4.7.2'"); + + // RequiredModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredModules = @({"undefined"})"); + } + + // RequiredAssemblies + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredAssemblies = @({"undefined"})"); + } + else + { + sb.AppendLine($@"{Indent}RequiredAssemblies = '{"./bin/Az.Peering.private.dll"}'"); + } + + // NestedModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}NestedModules = @({"undefined"})"); + } + + // FormatsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FormatsToProcess = @({"undefined"})"); + } + else + { + var customFormatPs1xmlFiles = Directory.GetFiles(CustomFolder) + .Where(f => f.EndsWith(".format.ps1xml")) + .Select(f => $"{CustomFolderRelative}/{Path.GetFileName(f)}"); + var formatList = customFormatPs1xmlFiles.Prepend("./Az.Peering.format.ps1xml").ToPsList(); + sb.AppendLine($@"{Indent}FormatsToProcess = {formatList}"); + } + + // TypesToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}TypesToProcess = @({"undefined"})"); + } + + // ScriptsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}ScriptsToProcess = @({"undefined"})"); + } + + var functionInfos = GetScriptCmdlets(ExportsFolder).ToArray(); + // FunctionsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FunctionsToExport = @({"undefined"})"); + } + else + { + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); + } + + // AliasesToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}AliasesToExport = @({"undefined"})"); + } + else + { + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + } + + // CmdletsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}CmdletsToExport = @({"undefined"})"); + } + + sb.AppendLine($@"{Indent}PrivateData = @{{"); + sb.AppendLine($@"{Indent}{Indent}PSData = @{{"); + + if (previewVersion != null) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = '{previewVersion}'"); + } + sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule Peering".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ProjectUri = '{"https://github.com/Azure/azure-powershell"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ReleaseNotes = ''"); + var profilesList = ""; + if (IsAzure && !String.IsNullOrEmpty(profilesList)) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Profiles = {profilesList}"); + } + + sb.AppendLine($@"{Indent}{Indent}}}"); + sb.AppendLine($@"{Indent}}}"); + sb.AppendLine(@"}"); + + File.WriteAllText(Psd1Path, sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs new file mode 100644 index 000000000000..6ccf42ab63f7 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -0,0 +1,148 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeGenerated { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + var utilFile = Path.Combine(OutputFolder, "utils.ps1"); + if (!File.Exists(utilFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} +"); + File.WriteAllText(utilFile, sc.ToString()); + } + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var variantGroups = GetScriptCmdlets(exportDirectory) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .GroupBy(v => v.CmdletName) + .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) + .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); + + foreach (var variantGroup in variantGroups) + { + var sb = new StringBuilder(); + sb.AppendLine($"if(($null -eq $TestName) -or ($TestName -contains '{variantGroup.CmdletName}'))"); + sb.AppendLine(@"{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath)" +); + sb.AppendLine($@" $TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); + sb.AppendLine(@" $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} +"); + + + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); + + foreach (var variant in variants) + { + sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); + sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); + var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; + sb.AppendLine($"{Indent}}}{variantSeparator}"); + } + sb.AppendLine("}"); + + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs new file mode 100644 index 000000000000..6190644a85e8 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "CommonParameter")] + [OutputType(typeof(Dictionary))] + [DoNotExport] + public class GetCommonParameter : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCmdlet PSCmdlet { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public Dictionary PSBoundParameter { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = PSCmdlet.MyInvocation.MyCommand.ToVariants(); + var commonParameterNames = variants.ToParameterGroups() + .Where(pg => pg.OrderCategory == ParameterCategory.Azure || pg.OrderCategory == ParameterCategory.Runtime) + .Select(pg => pg.ParameterName); + if (variants.Any(v => v.SupportsShouldProcess)) + { + commonParameterNames = commonParameterNames.Append("Confirm").Append("WhatIf"); + } + if (variants.Any(v => v.SupportsPaging)) + { + commonParameterNames = commonParameterNames.Append("First").Append("Skip").Append("IncludeTotalCount"); + } + + var names = commonParameterNames.ToArray(); + var keys = PSBoundParameter.Keys.Where(k => names.Contains(k)); + WriteObject(keys.ToDictionary(key => key, key => PSBoundParameter[key]), true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs new file mode 100644 index 000000000000..329d9b62832d --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ModuleGuid")] + [DoNotExport] + public class GetModuleGuid : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + protected override void ProcessRecord() + { + try + { + WriteObject(ReadGuidFromPsd1(Psd1Path)); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs b/src/Peering/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs new file mode 100644 index 000000000000..958b4d35e270 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs @@ -0,0 +1,54 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] + [OutputType(typeof(string[]))] + [DoNotExport] + public class GetScriptCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ScriptFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeDoNotExport { get; set; } + + [Parameter] + public SwitchParameter AsAlias { get; set; } + + [Parameter] + public SwitchParameter AsFunctionInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var functionInfos = GetScriptCmdlets(this, ScriptFolder) + .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType().Any()) + .ToArray(); + if (AsFunctionInfo) + { + WriteObject(functionInfos, true); + return; + } + var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); + var names = functionInfos.Select(fi => fi.Name).Distinct(); + var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); + WriteObject(output, true); + } + catch (System.Exception ee) + { + System.Console.Error.WriteLine($"{ee.GetType().Name}: {ee.Message}"); + System.Console.Error.WriteLine(ee.StackTrace); + throw ee; + } + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/CollectionExtensions.cs b/src/Peering/generated/runtime/BuildTime/CollectionExtensions.cs new file mode 100644 index 000000000000..490721908a45 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/CollectionExtensions.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal static class CollectionExtensions + { + public static T[] NullIfEmpty(this T[] collection) => (collection?.Any() ?? false) ? collection : null; + public static IEnumerable EmptyIfNull(this IEnumerable collection) => collection ?? Enumerable.Empty(); + + // https://stackoverflow.com/a/4158364/294804 + public static IEnumerable DistinctBy(this IEnumerable collection, Func selector) => + collection.GroupBy(selector).Select(group => group.First()); + } +} diff --git a/src/Peering/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/Peering/generated/runtime/BuildTime/MarkdownRenderer.cs new file mode 100644 index 000000000000..14901b64619c --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsProxyOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal static class MarkdownRenderer + { + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder) + { + Directory.CreateDirectory(docsFolder); + var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); + + foreach (var markdownInfo in markdownInfos) + { + var sb = new StringBuilder(); + sb.Append(markdownInfo.ToHelpMetadataOutput()); + sb.Append($"# {markdownInfo.CmdletName}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"## SYNOPSIS{Environment.NewLine}{markdownInfo.Synopsis.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## SYNTAX{Environment.NewLine}{Environment.NewLine}"); + var hasMultipleParameterSets = markdownInfo.SyntaxInfos.Length > 1; + foreach (var syntaxInfo in markdownInfo.SyntaxInfos) + { + sb.Append(syntaxInfo.ToHelpSyntaxOutput(hasMultipleParameterSets)); + } + + sb.Append($"## DESCRIPTION{Environment.NewLine}{markdownInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## EXAMPLES{Environment.NewLine}{Environment.NewLine}"); + foreach (var exampleInfo in markdownInfo.Examples) + { + sb.Append(exampleInfo.ToHelpExampleOutput()); + } + + sb.Append($"## PARAMETERS{Environment.NewLine}{Environment.NewLine}"); + foreach (var parameter in markdownInfo.Parameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + if (markdownInfo.SupportsShouldProcess) + { + foreach (var parameter in SupportsShouldProcessParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + + sb.Append($"### CommonParameters{Environment.NewLine}This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## INPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var input in markdownInfo.Inputs) + { + sb.Append($"### {input}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## OUTPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var output in markdownInfo.Outputs) + { + sb.Append($"### {output}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); + foreach (var alias in markdownInfo.Aliases) + { + sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); + } + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); + foreach (var relatedLink in markdownInfo.RelatedLinks) + { + sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); + } + + WriteModulePage(moduleHelpInfo, markdownInfos, docsFolder); + } + + private static void WriteModulePage(PsModuleHelpInfo moduleInfo, MarkdownHelpInfo[] markdownInfos, string docsFolder) + { + var sb = new StringBuilder(); + sb.Append(moduleInfo.ToModulePageMetadataOutput()); + sb.Append($"# {moduleInfo.Name} Module{Environment.NewLine}"); + sb.Append($"## Description{Environment.NewLine}{moduleInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## {moduleInfo.Name} Cmdlets{Environment.NewLine}"); + foreach (var markdownInfo in markdownInfos) + { + sb.Append(markdownInfo.ToModulePageCmdletOutput()); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{moduleInfo.Name}.md"), sb.ToString()); + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Models/PsFormatTypes.cs b/src/Peering/generated/runtime/BuildTime/Models/PsFormatTypes.cs new file mode 100644 index 000000000000..fea66d61d486 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Models/PsFormatTypes.cs @@ -0,0 +1,138 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal class ViewParameters + { + public Type Type { get; } + public IEnumerable Properties { get; } + + public ViewParameters(Type type, IEnumerable properties) + { + Type = type; + Properties = properties; + } + } + + internal class PropertyFormat + { + public PropertyInfo Property { get; } + public FormatTableAttribute FormatTable { get; } + + public int? Index { get; } + public string Label { get; } + public int? Width { get; } + public PropertyOrigin? Origin { get; } + + public PropertyFormat(PropertyInfo propertyInfo) + { + Property = propertyInfo; + FormatTable = Property.GetCustomAttributes().FirstOrDefault(); + var origin = Property.GetCustomAttributes().FirstOrDefault(); + + Index = FormatTable?.HasIndex ?? false ? (int?)FormatTable.Index : null; + Label = FormatTable?.Label ?? propertyInfo.Name; + Width = FormatTable?.HasWidth ?? false ? (int?)FormatTable.Width : null; + // If we have an index, we don't want to use Origin. + Origin = FormatTable?.HasIndex ?? false ? null : origin?.Origin; + } + } + + [Serializable] + [XmlRoot(nameof(Configuration))] + public class Configuration + { + [XmlElement("ViewDefinitions")] + public ViewDefinitions ViewDefinitions { get; set; } + } + + [Serializable] + public class ViewDefinitions + { + //https://stackoverflow.com/a/10518657/294804 + [XmlElement("View")] + public List Views { get; set; } + } + + [Serializable] + public class View + { + [XmlElement(nameof(Name))] + public string Name { get; set; } + [XmlElement(nameof(ViewSelectedBy))] + public ViewSelectedBy ViewSelectedBy { get; set; } + [XmlElement(nameof(TableControl))] + public TableControl TableControl { get; set; } + } + + [Serializable] + public class ViewSelectedBy + { + [XmlElement(nameof(TypeName))] + public string TypeName { get; set; } + } + + [Serializable] + public class TableControl + { + [XmlElement(nameof(TableHeaders))] + public TableHeaders TableHeaders { get; set; } + [XmlElement(nameof(TableRowEntries))] + public TableRowEntries TableRowEntries { get; set; } + } + + [Serializable] + public class TableHeaders + { + [XmlElement("TableColumnHeader")] + public List TableColumnHeaders { get; set; } + } + + [Serializable] + public class TableColumnHeader + { + [XmlElement(nameof(Label))] + public string Label { get; set; } + [XmlElement(nameof(Width))] + public int? Width { get; set; } + + //https://stackoverflow.com/a/4095225/294804 + public bool ShouldSerializeWidth() => Width.HasValue; + } + + [Serializable] + public class TableRowEntries + { + [XmlElement(nameof(TableRowEntry))] + public TableRowEntry TableRowEntry { get; set; } + } + + [Serializable] + public class TableRowEntry + { + [XmlElement(nameof(TableColumnItems))] + public TableColumnItems TableColumnItems { get; set; } + } + + [Serializable] + public class TableColumnItems + { + [XmlElement("TableColumnItem")] + public List TableItems { get; set; } + } + + [Serializable] + public class TableColumnItem + { + [XmlElement(nameof(PropertyName))] + public string PropertyName { get; set; } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/src/Peering/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs new file mode 100644 index 000000000000..368646b743c8 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -0,0 +1,199 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal class HelpMetadataOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public HelpMetadataOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"--- +external help file:{(!String.IsNullOrEmpty(HelpInfo.ExternalHelpFilename) ? $" {HelpInfo.ExternalHelpFilename}" : String.Empty)} +Module Name: {HelpInfo.ModuleName} +online version: {HelpInfo.OnlineVersion} +schema: {HelpInfo.Schema.ToString(3)} +--- + +"; + } + + internal class HelpSyntaxOutput + { + public MarkdownSyntaxHelpInfo SyntaxInfo { get; } + public bool HasMultipleParameterSets { get; } + + public HelpSyntaxOutput(MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) + { + SyntaxInfo = syntaxInfo; + HasMultipleParameterSets = hasMultipleParameterSets; + } + + public override string ToString() + { + var psnText = HasMultipleParameterSets ? $"### {SyntaxInfo.ParameterSetName}{(SyntaxInfo.IsDefault ? " (Default)" : String.Empty)}{Environment.NewLine}" : String.Empty; + return $@"{psnText}``` +{SyntaxInfo.SyntaxText} +``` + +"; + } + } + + internal class HelpExampleOutput + { + private string ExampleTemplate = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + Environment.NewLine; + + private string ExampleTemplateWithOutput = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + "{6}" + Environment.NewLine + "{7}" + Environment.NewLine + Environment.NewLine + + "{8}" + Environment.NewLine + Environment.NewLine; + + public MarkdownExampleHelpInfo ExampleInfo { get; } + + public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) + { + ExampleInfo = exampleInfo; + } + + public override string ToString() + { + if (string.IsNullOrEmpty(ExampleInfo.Output)) + { + return string.Format(ExampleTemplate, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleInfo.Description.ToDescriptionFormat()); + } + else + { + return string.Format(ExampleTemplateWithOutput, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleOutputHeader, ExampleInfo.Output, ExampleOutputFooter, + ExampleInfo.Description.ToDescriptionFormat()); ; + } + } + } + + internal class HelpParameterOutput + { + public MarkdownParameterHelpInfo ParameterInfo { get; } + + public HelpParameterOutput(MarkdownParameterHelpInfo parameterInfo) + { + ParameterInfo = parameterInfo; + } + + public override string ToString() + { + var pipelineInputTypes = new[] + { + ParameterInfo.AcceptsPipelineByValue ? "ByValue" : String.Empty, + ParameterInfo.AcceptsPipelineByPropertyName ? "ByPropertyName" : String.Empty + }.JoinIgnoreEmpty(", "); + var pipelineInput = ParameterInfo.AcceptsPipelineByValue || ParameterInfo.AcceptsPipelineByPropertyName + ? $@"{true} ({pipelineInputTypes})" + : false.ToString(); + + return $@"### -{ParameterInfo.Name} +{ParameterInfo.Description.ToDescriptionFormat()} + +```yaml +Type: {ParameterInfo.Type.FullName} +Parameter Sets: {(ParameterInfo.HasAllParameterSets ? "(All)" : ParameterInfo.ParameterSetNames.JoinIgnoreEmpty(", "))} +Aliases:{(ParameterInfo.Aliases.Any() ? $" {ParameterInfo.Aliases.JoinIgnoreEmpty(", ")}" : String.Empty)} + +Required: {ParameterInfo.IsRequired} +Position: {ParameterInfo.Position} +Default value: {ParameterInfo.DefaultValue} +Accept pipeline input: {pipelineInput} +Accept wildcard characters: {ParameterInfo.AcceptsWildcardCharacters} +``` + +"; + } + } + + internal class ModulePageMetadataOutput + { + public PsModuleHelpInfo ModuleInfo { get; } + + private static string HelpLinkPrefix { get; } = @"https://learn.microsoft.com/powershell/module/"; + + public ModulePageMetadataOutput(PsModuleHelpInfo moduleInfo) + { + ModuleInfo = moduleInfo; + } + + public override string ToString() => $@"--- +Module Name: {ModuleInfo.Name} +Module Guid: {ModuleInfo.Guid} +Download Help Link: {HelpLinkPrefix}{ModuleInfo.Name.ToLowerInvariant()} +Help Version: 1.0.0.0 +Locale: en-US +--- + +"; + } + + internal class ModulePageCmdletOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) +{HelpInfo.Synopsis.ToDescriptionFormat()} + +"; + } + + internal static class PsHelpOutputExtensions + { + public static string EscapeAngleBrackets(this string text) => text?.Replace("<", @"\<").Replace(">", @"\>"); + public static string ReplaceSentenceEndWithNewline(this string text) => text?.Replace(". ", $".{Environment.NewLine}").Replace(". ", $".{Environment.NewLine}"); + public static string ReplaceBrWithNewline(this string text) => text?.Replace("
", $"{Environment.NewLine}"); + public static string ToDescriptionFormat(this string text, bool escapeAngleBrackets = true) + { + var description = text?.ReplaceBrWithNewline(); + description = escapeAngleBrackets ? description?.EscapeAngleBrackets() : description; + return description?.ReplaceSentenceEndWithNewline().Trim(); + } + + public const string ExampleNameHeader = "### "; + public const string ExampleCodeHeader = "```powershell"; + public const string ExampleCodeFooter = "```"; + public const string ExampleOutputHeader = "```output"; + public const string ExampleOutputFooter = "```"; + + public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); + + public static HelpSyntaxOutput ToHelpSyntaxOutput(this MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) => new HelpSyntaxOutput(syntaxInfo, hasMultipleParameterSets); + + public static HelpExampleOutput ToHelpExampleOutput(this MarkdownExampleHelpInfo exampleInfo) => new HelpExampleOutput(exampleInfo); + + public static HelpParameterOutput ToHelpParameterOutput(this MarkdownParameterHelpInfo parameterInfo) => new HelpParameterOutput(parameterInfo); + + public static ModulePageMetadataOutput ToModulePageMetadataOutput(this PsModuleHelpInfo moduleInfo) => new ModulePageMetadataOutput(moduleInfo); + + public static ModulePageCmdletOutput ToModulePageCmdletOutput(this MarkdownHelpInfo helpInfo) => new ModulePageCmdletOutput(helpInfo); + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/src/Peering/generated/runtime/BuildTime/Models/PsHelpTypes.cs new file mode 100644 index 000000000000..ac47f14a88d0 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -0,0 +1,202 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal class PsHelpInfo + { + public string CmdletName { get; } + public string ModuleName { get; } + public string Synopsis { get; } + public string Description { get; } + public string AlertText { get; } + public string Category { get; } + public PsHelpLinkInfo OnlineVersion { get; } + public PsHelpLinkInfo[] RelatedLinks { get; } + public bool? HasCommonParameters { get; } + public bool? HasWorkflowCommonParameters { get; } + + public PsHelpTypeInfo[] InputTypes { get; } + public PsHelpTypeInfo[] OutputTypes { get; } + public PsHelpExampleInfo[] Examples { get; set; } + public string[] Aliases { get; } + + public PsParameterHelpInfo[] Parameters { get; } + public PsHelpSyntaxInfo[] Syntax { get; } + + public object Component { get; } + public object Functionality { get; } + public object PsSnapIn { get; } + public object Role { get; } + public string NonTerminatingErrors { get; } + + public PsHelpInfo(PSObject helpObject = null) + { + helpObject = helpObject ?? new PSObject(); + CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); + ModuleName = helpObject.GetProperty("ModuleName"); + Synopsis = helpObject.GetProperty("Synopsis"); + Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? + helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); + Category = helpObject.GetProperty("Category"); + HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); + HasWorkflowCommonParameters = helpObject.GetProperty("WorkflowCommonParameters").ToNullableBool(); + + var links = helpObject.GetNestedProperty("relatedLinks", "navigationLink").EmptyIfNull().Select(nl => nl.ToLinkInfo()).ToArray(); + OnlineVersion = links.FirstOrDefault(l => l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length == 1); + RelatedLinks = links.Where(l => !l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length != 1).ToArray(); + + InputTypes = helpObject.GetNestedProperty("inputTypes", "inputType").EmptyIfNull().Select(it => it.ToTypeInfo()).ToArray(); + OutputTypes = helpObject.GetNestedProperty("returnValues", "returnValue").EmptyIfNull().Select(rv => rv.ToTypeInfo()).ToArray(); + Examples = helpObject.GetNestedProperty("examples", "example").EmptyIfNull().Select(e => e.ToExampleInfo()).ToArray(); + Aliases = helpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + Parameters = helpObject.GetNestedProperty("parameters", "parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + Syntax = helpObject.GetNestedProperty("syntax", "syntaxItem").EmptyIfNull().Select(si => si.ToSyntaxInfo()).ToArray(); + + Component = helpObject.GetProperty("Component"); + Functionality = helpObject.GetProperty("Functionality"); + PsSnapIn = helpObject.GetProperty("PSSnapIn"); + Role = helpObject.GetProperty("Role"); + NonTerminatingErrors = helpObject.GetProperty("nonTerminatingErrors"); + } + } + + internal class PsHelpTypeInfo + { + public string Name { get; } + public string Description { get; } + + public PsHelpTypeInfo(PSObject typeObject) + { + Name = typeObject.GetNestedProperty("type", "name").EmptyIfNull().Trim(); + Description = typeObject.GetProperty("description").EmptyIfNull().ToDescriptionText(); + } + } + + internal class PsHelpLinkInfo + { + public string Uri { get; } + public string Text { get; } + + public PsHelpLinkInfo(PSObject linkObject) + { + Uri = linkObject.GetProperty("uri"); + Text = linkObject.GetProperty("linkText"); + } + } + + internal class PsHelpSyntaxInfo + { + public string CmdletName { get; } + public PsParameterHelpInfo[] Parameters { get; } + + public PsHelpSyntaxInfo(PSObject syntaxObject) + { + CmdletName = syntaxObject.GetProperty("name"); + Parameters = syntaxObject.GetProperty("parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + } + } + + internal class PsHelpExampleInfo + { + public string Title { get; } + public string Code { get; } + public string Output { get; } + public string Remarks { get; } + + public PsHelpExampleInfo(PSObject exampleObject) + { + Title = exampleObject.GetProperty("title"); + Code = exampleObject.GetProperty("code"); + Output = exampleObject.GetProperty("output"); + Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); + } + public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) + { + Title = markdownExample.Name; + Code = markdownExample.Code; + Output = markdownExample.Output; + Remarks = markdownExample.Description; + } + + public static implicit operator PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) => new PsHelpExampleInfo(markdownExample); + } + + internal class PsParameterHelpInfo + { + public string DefaultValueAsString { get; } + + public string Name { get; } + public string TypeName { get; } + public string Description { get; } + public string SupportsPipelineInput { get; } + public string PositionText { get; } + public string[] ParameterSetNames { get; } + public string[] Aliases { get; } + + public bool? SupportsGlobbing { get; } + public bool? IsRequired { get; } + public bool? IsVariableLength { get; } + public bool? IsDynamic { get; } + + public PsParameterHelpInfo(PSObject parameterHelpObject = null) + { + parameterHelpObject = parameterHelpObject ?? new PSObject(); + DefaultValueAsString = parameterHelpObject.GetProperty("defaultValue"); + Name = parameterHelpObject.GetProperty("name"); + TypeName = parameterHelpObject.GetProperty("parameterValue").NullIfEmpty() ?? parameterHelpObject.GetNestedProperty("type", "name"); + Description = parameterHelpObject.GetProperty("Description").EmptyIfNull().ToDescriptionText(); + SupportsPipelineInput = parameterHelpObject.GetProperty("pipelineInput"); + PositionText = parameterHelpObject.GetProperty("position"); + ParameterSetNames = parameterHelpObject.GetProperty("parameterSetName").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + Aliases = parameterHelpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + + SupportsGlobbing = parameterHelpObject.GetProperty("globbing").ToNullableBool(); + IsRequired = parameterHelpObject.GetProperty("required").ToNullableBool(); + IsVariableLength = parameterHelpObject.GetProperty("variableLength").ToNullableBool(); + IsDynamic = parameterHelpObject.GetProperty("isDynamic").ToNullableBool(); + } + } + + internal class PsModuleHelpInfo + { + public string Name { get; } + public Guid Guid { get; } + public string Description { get; } + + public PsModuleHelpInfo(PSModuleInfo moduleInfo) + : this(moduleInfo?.Name ?? String.Empty, moduleInfo?.Guid ?? Guid.NewGuid(), moduleInfo?.Description ?? String.Empty) + { + } + + public PsModuleHelpInfo(string name, Guid guid, string description) + { + Name = name; + Guid = guid; + Description = description; + } + } + + internal static class HelpTypesExtensions + { + public static PsHelpInfo ToPsHelpInfo(this PSObject helpObject) => new PsHelpInfo(helpObject); + public static PsParameterHelpInfo ToPsParameterHelpInfo(this PSObject parameterHelpObject) => new PsParameterHelpInfo(parameterHelpObject); + + public static string ToDescriptionText(this IEnumerable descriptionObject) => descriptionObject != null + ? String.Join(Environment.NewLine, descriptionObject.Select(dl => dl.GetProperty("Text").EmptyIfNull())).NullIfWhiteSpace() + : null; + public static PsHelpTypeInfo ToTypeInfo(this PSObject typeObject) => new PsHelpTypeInfo(typeObject); + public static PsHelpExampleInfo ToExampleInfo(this PSObject exampleObject) => new PsHelpExampleInfo(exampleObject); + public static PsHelpLinkInfo ToLinkInfo(this PSObject linkObject) => new PsHelpLinkInfo(linkObject); + public static PsHelpSyntaxInfo ToSyntaxInfo(this PSObject syntaxObject) => new PsHelpSyntaxInfo(syntaxObject); + public static PsModuleHelpInfo ToModuleInfo(this PSModuleInfo moduleInfo) => new PsModuleHelpInfo(moduleInfo); + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/src/Peering/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs new file mode 100644 index 000000000000..86e6254b5f02 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -0,0 +1,294 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal class MarkdownHelpInfo + { + public string ExternalHelpFilename { get; } + public string ModuleName { get; } + public string OnlineVersion { get; } + public Version Schema { get; } + + public string CmdletName { get; } + public string[] Aliases { get; } + public string Synopsis { get; } + public string Description { get; } + + public MarkdownSyntaxHelpInfo[] SyntaxInfos { get; } + public MarkdownExampleHelpInfo[] Examples { get; } + public MarkdownParameterHelpInfo[] Parameters { get; } + + public string[] Inputs { get; } + public string[] Outputs { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + public string[] RelatedLinks { get; } + + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") + { + ExternalHelpFilename = externalHelpFilename; + ModuleName = variantGroup.RootModuleName != "" ? variantGroup.RootModuleName : variantGroup.ModuleName; + var helpInfo = variantGroup.HelpInfo; + var commentInfo = variantGroup.CommentInfo; + Schema = Version.Parse("2.0.0"); + + CmdletName = variantGroup.CmdletName; + Aliases = (variantGroup.Aliases.NullIfEmpty() ?? helpInfo.Aliases).Where(a => a != "None").ToArray(); + Synopsis = commentInfo.Synopsis; + Description = commentInfo.Description; + + SyntaxInfos = variantGroup.Variants + .Select(v => new MarkdownSyntaxHelpInfo(v, variantGroup.ParameterGroups, v.VariantName == variantGroup.DefaultParameterSetName)) + .OrderByDescending(v => v.IsDefault).ThenBy(v => v.ParameterSetName).ToArray(); + Examples = GetExamplesFromMarkdown(examplesFolder).NullIfEmpty() + ?? helpInfo.Examples.Select(e => e.ToExampleHelpInfo()).ToArray().NullIfEmpty() + ?? DefaultExampleHelpInfos; + + Parameters = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && !pg.Parameters.All(p => p.IsHidden())) + .Select(pg => new MarkdownParameterHelpInfo( + variantGroup.Variants.SelectMany(v => v.HelpInfo.Parameters).Where(phi => phi.Name == pg.ParameterName).ToArray(), pg)) + .OrderBy(phi => phi.Name).ToArray(); + + Inputs = commentInfo.Inputs; + Outputs = commentInfo.Outputs; + + ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; + OnlineVersion = commentInfo.OnlineVersion; + RelatedLinks = commentInfo.RelatedLinks; + + SupportsShouldProcess = variantGroup.SupportsShouldProcess; + SupportsPaging = variantGroup.SupportsPaging; + } + + private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) + { + var filePath = Path.Combine(examplesFolder, $"{CmdletName}.md"); + if (!Directory.Exists(examplesFolder) || !File.Exists(filePath)) return null; + + var lines = File.ReadAllLines(filePath); + var nameIndices = lines.Select((l, i) => l.StartsWith(ExampleNameHeader) ? i : -1).Where(i => i != -1).ToArray(); + //https://codereview.stackexchange.com/a/187148/68772 + var indexCountGroups = nameIndices.Skip(1).Append(lines.Length).Zip(nameIndices, (next, current) => (NameIndex: current, LineCount: next - current)); + var exampleGroups = indexCountGroups.Select(icg => lines.Skip(icg.NameIndex).Take(icg.LineCount).ToArray()); + return exampleGroups.Select(eg => + { + var name = eg.First().Replace(ExampleNameHeader, String.Empty); + var codeStartIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var codeEndIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i != codeStartIndex); + var code = codeStartIndex.HasValue && codeEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) + : String.Empty; + var outputStartIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var outputEndIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i > outputStartIndex); + var output = outputStartIndex.HasValue && outputEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(outputStartIndex.Value + 1).Take(outputEndIndex.Value - (outputStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (outputEndIndex ?? (codeEndIndex ?? 0)) + 1; + descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; + var descriptionEndIndex = eg.Length - 1; + descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; + var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); + return new MarkdownExampleHelpInfo(name, code, output, description); + }).ToArray(); + } + } + + internal class MarkdownSyntaxHelpInfo + { + public Variant Variant { get; } + public bool IsDefault { get; } + public string ParameterSetName { get; } + public Parameter[] Parameters { get; } + public string SyntaxText { get; } + + public MarkdownSyntaxHelpInfo(Variant variant, ParameterGroup[] parameterGroups, bool isDefault) + { + Variant = variant; + IsDefault = isDefault; + ParameterSetName = Variant.VariantName; + Parameters = Variant.Parameters + .Where(p => !p.DontShow && !p.IsHidden()).OrderByDescending(p => p.IsMandatory) + //https://stackoverflow.com/a/6461526/294804 + .ThenByDescending(p => p.Position.HasValue).ThenBy(p => p.Position) + // Use the OrderCategory of the parameter group because the final order category is the highest of the group, and not the order category of the individual parameters from the variants. + .ThenBy(p => parameterGroups.First(pg => pg.ParameterName == p.ParameterName).OrderCategory).ThenBy(p => p.ParameterName).ToArray(); + SyntaxText = CreateSyntaxFormat(); + } + + //https://github.com/PowerShell/platyPS/blob/a607a926bfffe1e1a1e53c19e0057eddd0c07611/src/Markdown.MAML/Renderer/Markdownv2Renderer.cs#L29-L32 + private const int SyntaxLineWidth = 110; + private string CreateSyntaxFormat() + { + var parameterStrings = Parameters.Select(p => p.ToPropertySyntaxOutput().ToString()); + if (Variant.SupportsShouldProcess) + { + parameterStrings = parameterStrings.Append(" [-Confirm]").Append(" [-WhatIf]"); + } + parameterStrings = parameterStrings.Append(" []"); + + var lines = new List(20); + return parameterStrings.Aggregate(Variant.CmdletName, (current, ps) => + { + var combined = current + ps; + if (combined.Length <= SyntaxLineWidth) return combined; + + lines.Add(current); + return ps; + }, last => + { + lines.Add(last); + return String.Join(Environment.NewLine, lines); + }); + } + } + + internal class MarkdownExampleHelpInfo + { + public string Name { get; } + public string Code { get; } + public string Output { get; } + public string Description { get; } + + public MarkdownExampleHelpInfo(string name, string code, string output, string description) + { + Name = name; + Code = code; + Output = output; + Description = description; + } + } + + internal class MarkdownParameterHelpInfo + { + public string Name { get; set; } + public string Description { get; set; } + public Type Type { get; set; } + public string Position { get; set; } + public string DefaultValue { get; set; } + + public bool HasAllParameterSets { get; set; } + public string[] ParameterSetNames { get; set; } + public string[] Aliases { get; set; } + + public bool IsRequired { get; set; } + public bool IsDynamic { get; set; } + public bool AcceptsPipelineByValue { get; set; } + public bool AcceptsPipelineByPropertyName { get; set; } + public bool AcceptsWildcardCharacters { get; set; } + + // For use by common parameters that have no backing data in the objects themselves. + public MarkdownParameterHelpInfo() { } + + public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, ParameterGroup parameterGroup) + { + Name = parameterGroup.ParameterName; + Description = parameterGroup.Description.NullIfEmpty() + ?? parameterHelpInfos.Select(phi => phi.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + Type = parameterGroup.ParameterType; + Position = parameterGroup.FirstPosition?.ToString() + ?? parameterHelpInfos.Select(phi => phi.PositionText).FirstOrDefault(d => !String.IsNullOrEmpty(d)).ToUpperFirstCharacter().NullIfEmpty() + ?? "Named"; + // This no longer uses firstHelpInfo.DefaultValueAsString since it seems to be broken. For example, it has a value of 0 for Int32, but no default value was declared. + DefaultValue = parameterGroup.DefaultInfo?.Script ?? "None"; + + HasAllParameterSets = parameterGroup.HasAllVariants; + ParameterSetNames = (parameterGroup.Parameters.Select(p => p.VariantName).ToArray().NullIfEmpty() + ?? parameterHelpInfos.SelectMany(phi => phi.ParameterSetNames).Distinct()) + .OrderBy(psn => psn).ToArray(); + Aliases = parameterGroup.Aliases.NullIfEmpty() ?? parameterHelpInfos.SelectMany(phi => phi.Aliases).ToArray(); + + IsRequired = parameterHelpInfos.Select(phi => phi.IsRequired).FirstOrDefault(r => r == true) ?? parameterGroup.Parameters.Any(p => p.IsMandatory); + IsDynamic = parameterHelpInfos.Select(phi => phi.IsDynamic).FirstOrDefault(d => d == true) ?? false; + AcceptsPipelineByValue = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByValue")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipeline; + AcceptsPipelineByPropertyName = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByPropertyName")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipelineByPropertyName; + AcceptsWildcardCharacters = parameterGroup.SupportsWildcards; + } + } + + internal static class MarkdownTypesExtensions + { + public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Output, exampleInfo.Remarks); + + public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = + { + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"), + }; + + public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = + { + new MarkdownParameterHelpInfo + { + Name = "Confirm", + Description ="Prompts you for confirmation before running the cmdlet.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "cf" } + }, + new MarkdownParameterHelpInfo + { + Name = "WhatIf", + Description ="Shows what would happen if the cmdlet runs. The cmdlet is not run.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "wi" } + } + }; + + public static MarkdownParameterHelpInfo[] SupportsPagingParameters = + { + new MarkdownParameterHelpInfo + { + Name = "First", + Description ="Gets only the first 'n' objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "IncludeTotalCount", + Description ="Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns \"Unknown total count\".", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "Skip", + Description ="Ignores the first 'n' objects and then gets the remaining objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + } + }; + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/Peering/generated/runtime/BuildTime/Models/PsProxyOutputs.cs new file mode 100644 index 000000000000..ec0c328f4b31 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -0,0 +1,611 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal class OutputTypeOutput + { + public PSTypeName[] OutputTypes { get; } + + public OutputTypeOutput(IEnumerable outputTypes) + { + OutputTypes = outputTypes.ToArray(); + } + + public override string ToString() => OutputTypes != null && OutputTypes.Any() ? $"[OutputType({OutputTypes.Select(ot => $"[{ot}]").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class CmdletBindingOutput + { + public VariantGroup VariantGroup { get; } + + public CmdletBindingOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() + { + var dpsText = VariantGroup.DefaultParameterSetName.IsValidDefaultParameterSetName() ? $"DefaultParameterSetName='{VariantGroup.DefaultParameterSetName}'" : String.Empty; + var sspText = VariantGroup.SupportsShouldProcess ? $"SupportsShouldProcess{ItemSeparator}ConfirmImpact='Medium'" : String.Empty; + var pbText = $"PositionalBinding={false.ToPsBool()}"; + var propertyText = new[] { dpsText, pbText, sspText }.JoinIgnoreEmpty(ItemSeparator); + return $"[CmdletBinding({propertyText})]{Environment.NewLine}"; + } + } + + internal class ParameterOutput + { + public Parameter Parameter { get; } + public bool HasMultipleVariantsInVariantGroup { get; } + public bool HasAllVariantsInParameterGroup { get; } + + public ParameterOutput(Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) + { + Parameter = parameter; + HasMultipleVariantsInVariantGroup = hasMultipleVariantsInVariantGroup; + HasAllVariantsInParameterGroup = hasAllVariantsInParameterGroup; + } + + public override string ToString() + { + var psnText = HasMultipleVariantsInVariantGroup && !HasAllVariantsInParameterGroup ? $"ParameterSetName='{Parameter.VariantName}'" : String.Empty; + var positionText = Parameter.Position != null ? $"Position={Parameter.Position}" : String.Empty; + var mandatoryText = Parameter.IsMandatory ? "Mandatory" : String.Empty; + var dontShowText = Parameter.DontShow ? "DontShow" : String.Empty; + var vfpText = Parameter.ValueFromPipeline ? "ValueFromPipeline" : String.Empty; + var vfpbpnText = Parameter.ValueFromPipelineByPropertyName ? "ValueFromPipelineByPropertyName" : String.Empty; + var propertyText = new[] { psnText, positionText, mandatoryText, dontShowText, vfpText, vfpbpnText }.JoinIgnoreEmpty(ItemSeparator); + return $"{Indent}[Parameter({propertyText})]{Environment.NewLine}"; + } + } + + internal class AliasOutput + { + public string[] Aliases { get; } + public bool IncludeIndent { get; } + + public AliasOutput(string[] aliases, bool includeIndent = false) + { + Aliases = aliases; + IncludeIndent = includeIndent; + } + + public override string ToString() => Aliases?.Any() ?? false ? $"{(IncludeIndent ? Indent : String.Empty)}[Alias({Aliases.Select(an => $"'{an}'").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class ValidateNotNullOutput + { + public bool HasValidateNotNull { get; } + + public ValidateNotNullOutput(bool hasValidateNotNull) + { + HasValidateNotNull = hasValidateNotNull; + } + + public override string ToString() => HasValidateNotNull ? $"{Indent}[ValidateNotNull()]{Environment.NewLine}" : String.Empty; + } + + internal class AllowEmptyArrayOutput + { + public bool HasAllowEmptyArray { get; } + + public AllowEmptyArrayOutput(bool hasAllowEmptyArray) + { + HasAllowEmptyArray = hasAllowEmptyArray; + } + + public override string ToString() => HasAllowEmptyArray ? $"{Indent}[AllowEmptyCollection()]{Environment.NewLine}" : String.Empty; + } + internal class ArgumentCompleterOutput + { + public CompleterInfo CompleterInfo { get; } + + public ArgumentCompleterOutput(CompleterInfo completerInfo) + { + CompleterInfo = completerInfo; + } + + public override string ToString() => CompleterInfo != null + ? $"{Indent}[ArgumentCompleter({(CompleterInfo.IsTypeCompleter ? $"[{CompleterInfo.Type.Unwrap().ToPsType()}]" : $"{{{CompleterInfo.Script.ToPsSingleLine("; ")}}}")})]{Environment.NewLine}" + : String.Empty; + } + + internal class DefaultInfoOutput + { + public bool HasDefaultInfo { get; } + public DefaultInfo DefaultInfo { get; } + + public DefaultInfoOutput(ParameterGroup parameterGroup) + { + HasDefaultInfo = parameterGroup.HasDefaultInfo; + DefaultInfo = parameterGroup.DefaultInfo; + } + + public override string ToString() + { + var nameText = !String.IsNullOrEmpty(DefaultInfo?.Name) ? $"Name='{DefaultInfo?.Name}'" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(DefaultInfo?.Description) ? $"Description='{DefaultInfo?.Description.ToPsStringLiteral()}'" : String.Empty; + var scriptText = !String.IsNullOrEmpty(DefaultInfo?.Script) ? $"Script='{DefaultInfo?.Script.ToPsSingleLine("; ")}'" : String.Empty; + var propertyText = new[] { nameText, descriptionText, scriptText }.JoinIgnoreEmpty(ItemSeparator); + return HasDefaultInfo ? $"{Indent}[{typeof(DefaultInfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class ParameterTypeOutput + { + public Type ParameterType { get; } + + public ParameterTypeOutput(Type parameterType) + { + ParameterType = parameterType; + } + + public override string ToString() => $"{Indent}[{ParameterType.ToPsType()}]{Environment.NewLine}"; + } + + internal class ParameterNameOutput + { + public string ParameterName { get; } + public bool IsLast { get; } + + public ParameterNameOutput(string parameterName, bool isLast) + { + ParameterName = parameterName; + IsLast = isLast; + } + + public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; + } + + internal class BaseOutput + { + public VariantGroup VariantGroup { get; } + + protected static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public BaseOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + public string ClearTelemetryContext() + { + return (!VariantGroup.IsInternal && IsAzure) ? $@"{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext()" : ""; + } + } + + internal class BeginOutput : BaseOutput + { + public BeginOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + public string GetProcessCustomAttributesAtRuntime() + { + return VariantGroup.IsInternal ? "" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; + } + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() +{Indent}{Indent}}} +{Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}$internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}{Indent}if ($internalCalledCmdlets -eq '') {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' +{Indent}{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"begin {{ +{Indent}try {{ +{Indent}{Indent}$outBuffer = $null +{Indent}{Indent}if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {{ +{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 +{Indent}{Indent}}} +{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{GetTelemetry()} +{GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} +{GetProcessCustomAttributesAtRuntime()} +{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} +{Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) +{Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} + +"; + + private string GetParameterSetToCmdletMapping() + { + var sb = new StringBuilder(); + sb.AppendLine($"{Indent}{Indent}$mapping = @{{"); + foreach (var variant in VariantGroup.Variants) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}{variant.VariantName} = '{variant.PrivateModuleName}\{variant.PrivateCmdletName}';"); + } + sb.Append($"{Indent}{Indent}}}"); + return sb.ToString(); + } + + private string GetDefaultValuesStatements() + { + var defaultInfos = VariantGroup.ParameterGroups.Where(pg => pg.HasDefaultInfo).Select(pg => pg.DefaultInfo).ToArray(); + var sb = new StringBuilder(); + + foreach (var defaultInfo in defaultInfos) + { + var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); + var parameterName = defaultInfo.ParameterGroup.ParameterName; + sb.AppendLine(); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); + sb.Append($"{Indent}{Indent}}}"); + } + return sb.ToString(); + } + } + + internal class ProcessOutput : BaseOutput + { + public ProcessOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetFinally() + { + if (IsAzure && !VariantGroup.IsInternal) + { + return $@" +{Indent}finally {{ +{Indent}{Indent}$backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}$backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"process {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.Process($_) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +{GetFinally()} +}} +"; + } + + internal class EndOutput : BaseOutput + { + public EndOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Peering.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}{Indent}}} +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId +"; + } + return ""; + } + public override string ToString() => $@"end {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.End() +{GetTelemetry()} +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} +"; + } + + internal class HelpCommentOutput + { + public VariantGroup VariantGroup { get; } + public CommentInfo CommentInfo { get; } + + public HelpCommentOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + CommentInfo = variantGroup.CommentInfo; + } + + public override string ToString() + { + var inputs = String.Join(Environment.NewLine, CommentInfo.Inputs.Select(i => $".Inputs{Environment.NewLine}{i}")); + var inputsText = !String.IsNullOrEmpty(inputs) ? $"{Environment.NewLine}{inputs}" : String.Empty; + var outputs = String.Join(Environment.NewLine, CommentInfo.Outputs.Select(o => $".Outputs{Environment.NewLine}{o}")); + var outputsText = !String.IsNullOrEmpty(outputs) ? $"{Environment.NewLine}{outputs}" : String.Empty; + var notes = String.Join($"{Environment.NewLine}{Environment.NewLine}", VariantGroup.ComplexInterfaceInfos.Select(cii => cii.ToNoteOutput())); + var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; + var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); + var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var examples = ""; + foreach (var example in VariantGroup.HelpInfo.Examples) + { + examples = examples + ".Example" + "\r\n" + example.Code + "\r\n"; + } + return $@"<# +.Synopsis +{CommentInfo.Synopsis.ToDescriptionFormat(false)} +.Description +{CommentInfo.Description.ToDescriptionFormat(false)} +{examples}{inputsText}{outputsText}{notesText} +.Link +{CommentInfo.OnlineVersion}{relatedLinksText} +#> +"; + } + } + + internal class ParameterDescriptionOutput + { + public string Description { get; } + + public ParameterDescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) + ? Description.ToDescriptionFormat(false).NormalizeNewLines() + .Split(new[] { Environment.NewLine }, StringSplitOptions.None) + .Aggregate(String.Empty, (c, n) => c + $"{Indent}# {n}{Environment.NewLine}") + : String.Empty; + } + + internal class ProfileOutput + { + public string ProfileName { get; } + + public ProfileOutput(string profileName) + { + ProfileName = profileName; + } + + public override string ToString() => ProfileName != NoProfiles ? $"[{typeof(ProfileAttribute).ToPsAttributeType()}('{ProfileName}')]{Environment.NewLine}" : String.Empty; + } + + internal class DescriptionOutput + { + public string Description { get; } + + public DescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) ? $"[{typeof(DescriptionAttribute).ToPsAttributeType()}('{Description.ToPsStringLiteral()}')]{Environment.NewLine}" : String.Empty; + } + + internal class ParameterCategoryOutput + { + public ParameterCategory Category { get; } + + public ParameterCategoryOutput(ParameterCategory category) + { + Category = category; + } + + public override string ToString() => $"{Indent}[{typeof(CategoryAttribute).ToPsAttributeType()}('{Category}')]{Environment.NewLine}"; + } + + internal class InfoOutput + { + public InfoAttribute Info { get; } + public Type ParameterType { get; } + + public InfoOutput(InfoAttribute info, Type parameterType) + { + Info = info; + ParameterType = parameterType; + } + + public override string ToString() + { + // Rendering of InfoAttribute members that are not used currently + /*var serializedNameText = Info.SerializedName != null ? $"SerializedName='{Info.SerializedName}'" : String.Empty; + var readOnlyText = Info.ReadOnly ? "ReadOnly" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(Info.Description) ? $"Description='{Info.Description.ToPsStringLiteral()}'" : String.Empty;*/ + + var requiredText = Info.Required ? "Required" : String.Empty; + var unwrappedType = ParameterType.Unwrap(); + var hasValidPossibleTypes = Info.PossibleTypes.Any(pt => pt != unwrappedType); + var possibleTypesText = hasValidPossibleTypes + ? $"PossibleTypes=({Info.PossibleTypes.Select(pt => $"[{pt.ToPsType()}]").JoinIgnoreEmpty(ItemSeparator)})" + : String.Empty; + var propertyText = new[] { /*serializedNameText, */requiredText,/* readOnlyText,*/ possibleTypesText/*, descriptionText*/ }.JoinIgnoreEmpty(ItemSeparator); + return hasValidPossibleTypes ? $"{Indent}[{typeof(InfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class PropertySyntaxOutput + { + public string ParameterName { get; } + public Type ParameterType { get; } + public bool IsMandatory { get; } + public int? Position { get; } + + public bool IncludeSpace { get; } + public bool IncludeDash { get; } + + public PropertySyntaxOutput(Parameter parameter) + { + ParameterName = parameter.ParameterName; + ParameterType = parameter.ParameterType; + IsMandatory = parameter.IsMandatory; + Position = parameter.Position; + IncludeSpace = true; + IncludeDash = true; + } + + public PropertySyntaxOutput(ComplexInterfaceInfo complexInterfaceInfo) + { + ParameterName = complexInterfaceInfo.Name; + ParameterType = complexInterfaceInfo.Type; + IsMandatory = complexInterfaceInfo.Required; + Position = null; + IncludeSpace = false; + IncludeDash = false; + } + + public override string ToString() + { + var leftOptional = !IsMandatory ? "[" : String.Empty; + var leftPositional = Position != null ? "[" : String.Empty; + var rightPositional = Position != null ? "]" : String.Empty; + var type = ParameterType != typeof(SwitchParameter) ? $" <{ParameterType.ToSyntaxTypeName()}>" : String.Empty; + var rightOptional = !IsMandatory ? "]" : String.Empty; + var space = IncludeSpace ? " " : String.Empty; + var dash = IncludeDash ? "-" : String.Empty; + return $"{space}{leftOptional}{leftPositional}{dash}{ParameterName}{rightPositional}{type}{rightOptional}"; + } + } + + internal static class PsProxyOutputExtensions + { + public const string NoParameters = "__NoParameters"; + + public const string AllParameterSets = "__AllParameterSets"; + + public const string HalfIndent = " "; + + public const string Indent = HalfIndent + HalfIndent; + + public const string ItemSeparator = ", "; + + public static readonly string ComplexParameterHeader = $"COMPLEX PARAMETER PROPERTIES{Environment.NewLine}{Environment.NewLine}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.{Environment.NewLine}{Environment.NewLine}"; + + public static string ToPsBool(this bool value) => $"${value.ToString().ToLowerInvariant()}"; + + public static string ToPsType(this Type type) + { + var regex = new Regex(@"^(.*)`{1}\d+(.*)$"); + var typeText = type.ToString(); + var match = regex.Match(typeText); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : typeText; + } + + public static string ToPsAttributeType(this Type type) => type.ToPsType().RemoveEnd("Attribute"); + + // https://stackoverflow.com/a/5284606/294804 + private static string RemoveEnd(this string text, string suffix) => text.EndsWith(suffix) ? text.Substring(0, text.Length - suffix.Length) : text; + + public static string ToPsSingleLine(this string value, string replacer = " ") => value.ReplaceNewLines(replacer, new[] { "
", "\r\n", "\n" }); + + public static string ToPsStringLiteral(this string value) => value?.Replace("'", "''").Replace("‘", "''").Replace("’", "''").ToPsSingleLine().Trim() ?? String.Empty; + + public static string JoinIgnoreEmpty(this IEnumerable values, string separator) => String.Join(separator, values?.Where(v => !String.IsNullOrEmpty(v))); + + // https://stackoverflow.com/a/41961738/294804 + public static string ToSyntaxTypeName(this Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return $"{type.GetGenericArguments().First().ToSyntaxTypeName()}?"; + } + + if (type.IsGenericType) + { + var genericTypes = String.Join(ItemSeparator, type.GetGenericArguments().Select(ToSyntaxTypeName)); + return $"{type.Name.Split('`').First()}<{genericTypes}>"; + } + + return type.Name; + } + + public static OutputTypeOutput ToOutputTypeOutput(this IEnumerable outputTypes) => new OutputTypeOutput(outputTypes); + + public static CmdletBindingOutput ToCmdletBindingOutput(this VariantGroup variantGroup) => new CmdletBindingOutput(variantGroup); + + public static ParameterOutput ToParameterOutput(this Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) => new ParameterOutput(parameter, hasMultipleVariantsInVariantGroup, hasAllVariantsInParameterGroup); + + public static AliasOutput ToAliasOutput(this string[] aliases, bool includeIndent = false) => new AliasOutput(aliases, includeIndent); + + public static ValidateNotNullOutput ToValidateNotNullOutput(this bool hasValidateNotNull) => new ValidateNotNullOutput(hasValidateNotNull); + + public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray); + + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + + public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); + + public static ParameterTypeOutput ToParameterTypeOutput(this Type parameterType) => new ParameterTypeOutput(parameterType); + + public static ParameterNameOutput ToParameterNameOutput(this string parameterName, bool isLast) => new ParameterNameOutput(parameterName, isLast); + + public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); + + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(variantGroup); + + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(variantGroup); + + public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); + + public static ParameterDescriptionOutput ToParameterDescriptionOutput(this string description) => new ParameterDescriptionOutput(description); + + public static ProfileOutput ToProfileOutput(this string profileName) => new ProfileOutput(profileName); + + public static DescriptionOutput ToDescriptionOutput(this string description) => new DescriptionOutput(description); + + public static ParameterCategoryOutput ToParameterCategoryOutput(this ParameterCategory category) => new ParameterCategoryOutput(category); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this Parameter parameter) => new PropertySyntaxOutput(parameter); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this ComplexInterfaceInfo complexInterfaceInfo) => new PropertySyntaxOutput(complexInterfaceInfo); + + public static InfoOutput ToInfoOutput(this InfoAttribute info, Type parameterType) => new InfoOutput(info, parameterType); + + public static string ToNoteOutput(this ComplexInterfaceInfo complexInterfaceInfo, string currentIndent = "", bool includeDashes = false, bool includeBackticks = false, bool isFirst = true) + { + string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool backtick) => + $"{indent}{(dash ? "- " : String.Empty)}{(backtick ? "`" : String.Empty)}{info.ToPropertySyntaxOutput()}{(backtick ? "`" : String.Empty)}: {info.Description}"; + + var nested = complexInterfaceInfo.NestedInfos.Select(ni => + { + var nestedIndent = $"{currentIndent}{HalfIndent}"; + return ni.IsComplexInterface + ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) + : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks)); + return String.Join(Environment.NewLine, nested); + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/src/Peering/generated/runtime/BuildTime/Models/PsProxyTypes.cs new file mode 100644 index 000000000000..f6a4f589b89f --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -0,0 +1,514 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal class ProfileGroup + { + public string ProfileName { get; } + public Variant[] Variants { get; } + public string ProfileFolder { get; } + + public ProfileGroup(Variant[] variants, string profileName = NoProfiles) + { + ProfileName = profileName; + Variants = variants; + ProfileFolder = ProfileName != NoProfiles ? ProfileName : String.Empty; + } + } + + internal class VariantGroup + { + public string ModuleName { get; } + + public string RootModuleName {get => @"";} + public string CmdletName { get; } + public string CmdletVerb { get; } + public string CmdletNoun { get; } + public string ProfileName { get; } + public Variant[] Variants { get; } + public ParameterGroup[] ParameterGroups { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + + public string[] Aliases { get; } + public PSTypeName[] OutputTypes { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + public string DefaultParameterSetName { get; } + public bool HasMultipleVariants { get; } + public PsHelpInfo HelpInfo { get; } + public bool IsGenerated { get; } + public bool IsInternal { get; } + + public string OutputFolder { get; } + public string FileName { get; } + public string FilePath { get; } + + public CommentInfo CommentInfo { get; } + + public VariantGroup(string moduleName, string cmdletName, Variant[] variants, string outputFolder, string profileName = NoProfiles, bool isTest = false, bool isInternal = false) + { + ModuleName = moduleName; + CmdletName = cmdletName; + var cmdletNameParts = CmdletName.Split('-'); + CmdletVerb = cmdletNameParts.First(); + CmdletNoun = cmdletNameParts.Last(); + ProfileName = profileName; + Variants = variants; + ParameterGroups = Variants.ToParameterGroups().OrderBy(pg => pg.OrderCategory).ThenByDescending(pg => pg.IsMandatory).ToArray(); + var aliasDuplicates = ParameterGroups.SelectMany(pg => pg.Aliases) + //https://stackoverflow.com/a/18547390/294804 + .GroupBy(a => a).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); + if (aliasDuplicates.Any()) + { + throw new ParsingMetadataException($"The alias(es) [{String.Join(", ", aliasDuplicates)}] are defined on multiple parameters for cmdlet '{CmdletName}', which is not supported."); + } + ComplexInterfaceInfos = ParameterGroups.Where(pg => !pg.DontShow && pg.IsComplexInterface).OrderBy(pg => pg.ParameterName).Select(pg => pg.ComplexInterfaceInfo).ToArray(); + + Aliases = Variants.SelectMany(v => v.Attributes).ToAliasNames().ToArray(); + OutputTypes = Variants.SelectMany(v => v.Info.OutputType).Where(ot => ot.Type != null).GroupBy(ot => ot.Type).Select(otg => otg.First()).ToArray(); + SupportsShouldProcess = Variants.Any(v => v.SupportsShouldProcess); + SupportsPaging = Variants.Any(v => v.SupportsPaging); + DefaultParameterSetName = DetermineDefaultParameterSetName(); + HasMultipleVariants = Variants.Length > 1; + HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); + IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); + IsInternal = isInternal; + + OutputFolder = outputFolder; + FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; + FilePath = Path.Combine(OutputFolder, FileName); + + CommentInfo = new CommentInfo(this); + } + + private string DetermineDefaultParameterSetName() + { + var defaultParameterSet = Variants + .Select(v => v.Metadata.DefaultParameterSetName) + .LastOrDefault(dpsn => dpsn.IsValidDefaultParameterSetName()); + + if (String.IsNullOrEmpty(defaultParameterSet)) + { + var variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); + var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); + defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; + } + + return defaultParameterSet; + } + } + + internal class Variant + { + public string CmdletName { get; } + public string VariantName { get; } + public CommandInfo Info { get; } + public CommandMetadata Metadata { get; } + public PsHelpInfo HelpInfo { get; } + public bool HasParameterSets { get; } + public bool IsFunction { get; } + public string PrivateModuleName { get; } + public string PrivateCmdletName { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public Attribute[] Attributes { get; } + public Parameter[] Parameters { get; } + public Parameter[] CmdletOnlyParameters { get; } + public bool IsInternal { get; } + public bool IsDoNotExport { get; } + public string[] Profiles { get; } + + public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) + { + CmdletName = cmdletName; + VariantName = variantName; + Info = info; + HelpInfo = helpInfo ?? new PsHelpInfo(); + Metadata = metadata; + HasParameterSets = hasParameterSets; + IsFunction = Info.CommandType == CommandTypes.Function; + PrivateModuleName = Info.Source; + PrivateCmdletName = Metadata.Name; + SupportsShouldProcess = Metadata.SupportsShouldProcess; + SupportsPaging = Metadata.SupportsPaging; + + Attributes = this.ToAttributes(); + Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); + IsInternal = Attributes.OfType().Any(); + IsDoNotExport = Attributes.OfType().Any(); + CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); + Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); + } + } + + internal class ParameterGroup + { + public string ParameterName { get; } + public Parameter[] Parameters { get; } + + public string[] VariantNames { get; } + public string[] AllVariantNames { get; } + public bool HasAllVariants { get; } + public Type ParameterType { get; } + public string Description { get; } + + public string[] Aliases { get; } + public bool HasValidateNotNull { get; } + public bool HasAllowEmptyArray { get; } + public CompleterInfo CompleterInfo { get; } + public DefaultInfo DefaultInfo { get; } + public bool HasDefaultInfo { get; } + public ParameterCategory OrderCategory { get; } + public bool DontShow { get; } + public bool IsMandatory { get; } + public bool SupportsWildcards { get; } + public bool IsComplexInterface { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public InfoAttribute InfoAttribute { get; } + + public int? FirstPosition { get; } + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public bool IsInputType { get; } + + public ParameterGroup(string parameterName, Parameter[] parameters, string[] allVariantNames) + { + ParameterName = parameterName; + Parameters = parameters; + + VariantNames = Parameters.Select(p => p.VariantName).ToArray(); + AllVariantNames = allVariantNames; + HasAllVariants = VariantNames.Any(vn => vn == AllParameterSets) || !AllVariantNames.Except(VariantNames).Any(); + var types = Parameters.Select(p => p.ParameterType).Distinct().ToArray(); + if (types.Length > 1) + { + throw new ParsingMetadataException($"The parameter '{ParameterName}' has multiple parameter types [{String.Join(", ", types.Select(t => t.Name))}] defined, which is not supported."); + } + ParameterType = types.First(); + Description = Parameters.Select(p => p.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + + Aliases = Parameters.SelectMany(p => p.Attributes).ToAliasNames().ToArray(); + HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); + DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) + ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); + HasDefaultInfo = DefaultInfo != null && !String.IsNullOrEmpty(DefaultInfo.Script); + // When DefaultInfo is present, force all parameters from this group to be optional. + if (HasDefaultInfo) + { + foreach (var parameter in Parameters) + { + parameter.IsMandatory = false; + } + } + OrderCategory = Parameters.Select(p => p.OrderCategory).Distinct().DefaultIfEmpty(ParameterCategory.Body).Min(); + DontShow = Parameters.All(p => p.DontShow); + IsMandatory = HasAllVariants && Parameters.Any(p => p.IsMandatory); + SupportsWildcards = Parameters.Any(p => p.SupportsWildcards); + IsComplexInterface = Parameters.Any(p => p.IsComplexInterface); + ComplexInterfaceInfo = Parameters.Where(p => p.IsComplexInterface).Select(p => p.ComplexInterfaceInfo).FirstOrDefault(); + InfoAttribute = Parameters.Select(p => p.InfoAttribute).First(); + + FirstPosition = Parameters.Select(p => p.Position).FirstOrDefault(p => p != null); + ValueFromPipeline = Parameters.Any(p => p.ValueFromPipeline); + ValueFromPipelineByPropertyName = Parameters.Any(p => p.ValueFromPipelineByPropertyName); + IsInputType = ValueFromPipeline || ValueFromPipelineByPropertyName; + } + } + + internal class Parameter + { + public string VariantName { get; } + public string ParameterName { get; } + public ParameterMetadata Metadata { get; } + public PsParameterHelpInfo HelpInfo { get; } + public Type ParameterType { get; } + + public Attribute[] Attributes { get; } + public ParameterCategory[] Categories { get; } + public ParameterCategory OrderCategory { get; } + public PSDefaultValueAttribute DefaultValueAttribute { get; } + public DefaultInfoAttribute DefaultInfoAttribute { get; } + public ParameterAttribute ParameterAttribute { get; } + public bool SupportsWildcards { get; } + public CompleterInfoAttribute CompleterInfoAttribute { get; } + public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public int? Position { get; } + public bool DontShow { get; } + public bool IsMandatory { get; set; } + + public InfoAttribute InfoAttribute { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public bool IsComplexInterface { get; } + public string Description { get; } + + public Parameter(string variantName, string parameterName, ParameterMetadata metadata, PsParameterHelpInfo helpInfo = null) + { + VariantName = variantName; + ParameterName = parameterName; + Metadata = metadata; + HelpInfo = helpInfo ?? new PsParameterHelpInfo(); + + Attributes = Metadata.Attributes.ToArray(); + ParameterType = Attributes.OfType().FirstOrDefault()?.Type ?? Metadata.ParameterType; + Categories = Attributes.OfType().SelectMany(ca => ca.Categories).Distinct().ToArray(); + OrderCategory = Categories.DefaultIfEmpty(ParameterCategory.Body).Min(); + DefaultValueAttribute = Attributes.OfType().FirstOrDefault(); + DefaultInfoAttribute = Attributes.OfType().FirstOrDefault(); + ParameterAttribute = Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == VariantName || pa.ParameterSetName == AllParameterSets); + if (ParameterAttribute == null) + { + throw new ParsingMetadataException($"The variant '{VariantName}' has multiple parameter sets defined, which is not supported."); + } + SupportsWildcards = Attributes.OfType().Any(); + CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + + ValueFromPipeline = ParameterAttribute.ValueFromPipeline; + ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; + Position = ParameterAttribute.Position == Int32.MinValue ? (int?)null : ParameterAttribute.Position; + DontShow = ParameterAttribute.DontShow; + IsMandatory = ParameterAttribute.Mandatory; + + var complexParameterName = ParameterName.ToUpperInvariant(); + var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; + // Remove the complex type message as it will be reinserted if this is a complex type + description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + // Make an InfoAttribute for processing only if one isn't provided + InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; + // Set the description if the InfoAttribute does not have one since they are exported without a description + InfoAttribute.Description = String.IsNullOrEmpty(InfoAttribute.Description) ? description : InfoAttribute.Description; + ComplexInterfaceInfo = InfoAttribute.ToComplexInterfaceInfo(complexParameterName, ParameterType, true); + IsComplexInterface = ComplexInterfaceInfo.IsComplexInterface; + Description = $"{description}{(IsComplexInterface ? complexMessage : String.Empty)}"; + } + } + + internal class ComplexInterfaceInfo + { + public InfoAttribute InfoAttribute { get; } + + public string Name { get; } + public Type Type { get; } + public bool Required { get; } + public bool ReadOnly { get; } + public string Description { get; } + + public ComplexInterfaceInfo[] NestedInfos { get; } + public bool IsComplexInterface { get; } + + public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool? required, List seenTypes) + { + Name = name; + Type = type; + InfoAttribute = infoAttribute; + + Required = required ?? InfoAttribute.Required; + ReadOnly = InfoAttribute.ReadOnly; + Description = InfoAttribute.Description.ToPsSingleLine(); + + var unwrappedType = Type.Unwrap(); + var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; + (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + unwrappedType.GetInterfaces() + .Concat(InfoAttribute.PossibleTypes) + .SelectMany(pt => pt.GetProperties() + .SelectMany(pi => pi.GetCustomAttributes(true).OfType() + .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes)))) + .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray(); + // https://stackoverflow.com/a/503359/294804 + var associativeArrayInnerType = Type.GetInterfaces() + .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>)) + ?.GetTypeInfo().GetGenericArguments().First(); + if (!hasBeenSeen && associativeArrayInnerType != null) + { + var anyInfo = new InfoAttribute { Description = "This indicates any property can be added to this object." }; + NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray(); + } + IsComplexInterface = NestedInfos.Any(); + } + } + + internal class CommentInfo + { + public string Description { get; } + public string Synopsis { get; } + + public string[] Examples { get; } + public string[] Inputs { get; } + public string[] Outputs { get; } + + public string OnlineVersion { get; } + public string[] RelatedLinks { get; } + + private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; + + public CommentInfo(VariantGroup variantGroup) + { + var helpInfo = variantGroup.HelpInfo; + Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() + ?? helpInfo.Description.EmptyIfNull(); + // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. + var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; + Synopsis = synopsis.NullIfEmpty() ?? Description; + + Examples = helpInfo.Examples.Select(rl => rl.Code).ToArray(); + + Inputs = (variantGroup.ParameterGroups.Where(pg => pg.IsInputType).Select(pg => pg.ParameterType.FullName).ToArray().NullIfEmpty() ?? + helpInfo.InputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(it => it.Name).ToArray()) + .Where(i => i != "None").Distinct().OrderBy(i => i).ToArray(); + Outputs = (variantGroup.OutputTypes.Select(ot => ot.Type.FullName).ToArray().NullIfEmpty() ?? + helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) + .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); + + // Use root module name in the help link + var moduleName = variantGroup.RootModuleName == "" ? variantGroup.ModuleName.ToLowerInvariant() : variantGroup.RootModuleName.ToLowerInvariant(); + OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{moduleName}/{variantGroup.CmdletName.ToLowerInvariant()}"; + RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + } + } + + internal class CompleterInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public Type Type { get; } + public bool IsTypeCompleter { get; } + + public CompleterInfo(CompleterInfoAttribute infoAttribute) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + } + + public CompleterInfo(ArgumentCompleterAttribute completerAttribute) + { + Script = completerAttribute.ScriptBlock?.ToString(); + if (completerAttribute.Type != null) + { + Type = completerAttribute.Type; + IsTypeCompleter = true; + } + } + } + + internal class DefaultInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public ParameterGroup ParameterGroup { get; } + + public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + ParameterGroup = parameterGroup; + } + + public DefaultInfo(PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) + { + Description = defaultValueAttribute.Help; + ParameterGroup = parameterGroup; + if (defaultValueAttribute.Value != null) + { + Script = defaultValueAttribute.Value.ToString(); + } + } + } + + internal static class PsProxyTypeExtensions + { + public const string NoProfiles = "__NoProfiles"; + + public static bool IsValidDefaultParameterSetName(this string parameterSetName) => + !String.IsNullOrEmpty(parameterSetName) && parameterSetName != AllParameterSets; + + public static Variant[] ToVariants(this CommandInfo info, PsHelpInfo helpInfo) + { + var metadata = new CommandMetadata(info); + var privateCmdletName = metadata.Name.Split('!').First(); + var parts = privateCmdletName.Split('_'); + return parts.Length > 1 + ? new[] { new Variant(parts[0], parts[1], info, metadata, helpInfo: helpInfo) } + // Process multiple parameter sets, so we declare a variant per parameter set. + : info.ParameterSets.Select(ps => new Variant(privateCmdletName, ps.Name, info, metadata, true, helpInfo)).ToArray(); + } + + public static Variant[] ToVariants(this CmdletAndHelpInfo info) => info.CommandInfo.ToVariants(info.HelpInfo); + + public static Variant[] ToVariants(this CommandInfo info, PSObject helpInfo = null) => info.ToVariants(helpInfo?.ToPsHelpInfo()); + + public static Parameter[] ToParameters(this Variant variant) + { + var parameters = variant.Metadata.Parameters.AsEnumerable(); + var parameterHelp = variant.HelpInfo.Parameters.AsEnumerable(); + + if (variant.HasParameterSets) + { + parameters = parameters.Where(p => p.Value.ParameterSets.Keys.Any(k => k == variant.VariantName || k == AllParameterSets)); + parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount"); + } + var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))); + if (variant.SupportsPaging) { + // If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters + variant.Info.Parameters["First"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects."; + variant.Info.Parameters["Skip"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects."; + result = result.Append(new Parameter(variant.VariantName, "First", variant.Info.Parameters["First"], parameterHelp.FirstOrDefault(ph => ph.Name == "First"))); + result = result.Append(new Parameter(variant.VariantName, "Skip", variant.Info.Parameters["Skip"], parameterHelp.FirstOrDefault(ph => ph.Name == "Skip"))); + } + return result.ToArray(); + } + + public static Attribute[] ToAttributes(this Variant variant) => variant.IsFunction + ? ((FunctionInfo)variant.Info).ScriptBlock.Attributes.ToArray() + : variant.Metadata.CommandType.GetCustomAttributes(false).Cast().ToArray(); + + public static IEnumerable ToParameterGroups(this Variant[] variants) + { + var allVariantNames = variants.Select(vg => vg.VariantName).ToArray(); + return variants + .SelectMany(v => v.Parameters) + .GroupBy(p => p.ParameterName, StringComparer.InvariantCultureIgnoreCase) + .Select(pg => new ParameterGroup(pg.Key, pg.Select(p => p).ToArray(), allVariantNames)); + } + + public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool? required = null, List seenTypes = null) + => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes); + + public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); + public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); + + public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); + public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); + } +} diff --git a/src/Peering/generated/runtime/BuildTime/PsAttributes.cs b/src/Peering/generated/runtime/BuildTime/PsAttributes.cs new file mode 100644 index 000000000000..462e36b6897a --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/PsAttributes.cs @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering +{ + [AttributeUsage(AttributeTargets.Class)] + public class DescriptionAttribute : Attribute + { + public string Description { get; } + + public DescriptionAttribute(string description) + { + Description = description; + } + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class InternalExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class GeneratedAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotFormatAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class ProfileAttribute : Attribute + { + public string[] Profiles { get; } + + public ProfileAttribute(params string[] profiles) + { + Profiles = profiles; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class CategoryAttribute : Attribute + { + public ParameterCategory[] Categories { get; } + + public CategoryAttribute(params ParameterCategory[] categories) + { + Categories = categories; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAsAttribute : Attribute + { + public Type Type { get; set; } + + public ExportAsAttribute(Type type) + { + Type = type; + } + } + + public enum ParameterCategory + { + // Note: Order is significant + Uri = 0, + Path, + Query, + Header, + Cookie, + Body, + Azure, + Runtime + } + + [AttributeUsage(AttributeTargets.Property)] + public class OriginAttribute : Attribute + { + public PropertyOrigin Origin { get; } + + public OriginAttribute(PropertyOrigin origin) + { + Origin = origin; + } + } + + public enum PropertyOrigin + { + // Note: Order is significant + Inherited = 0, + Owned, + Inlined + } + + [AttributeUsage(AttributeTargets.Property)] + public class FormatTableAttribute : Attribute + { + public int Index { get; set; } = -1; + public bool HasIndex => Index != -1; + public string Label { get; set; } + public int Width { get; set; } = -1; + public bool HasWidth => Width != -1; + } +} diff --git a/src/Peering/generated/runtime/BuildTime/PsExtensions.cs b/src/Peering/generated/runtime/BuildTime/PsExtensions.cs new file mode 100644 index 000000000000..7790289a4ef4 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/PsExtensions.cs @@ -0,0 +1,169 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal static class PsExtensions + { + // https://stackoverflow.com/a/863944/294804 + // https://stackoverflow.com/a/4452598/294804 + // https://stackoverflow.com/a/28701974/294804 + // Note: This will unwrap nested collections, but we don't generate nested collections. + public static Type Unwrap(this Type type) + { + if (type.IsArray) + { + return type.GetElementType().Unwrap(); + } + + var typeInfo = type.GetTypeInfo(); + if (typeInfo.IsGenericType + && (typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>) || typeof(IEnumerable<>).IsAssignableFrom(type))) + { + return typeInfo.GetGenericArguments().First().Unwrap(); + } + + return type; + } + + // https://stackoverflow.com/a/863944/294804 + private static bool IsSimple(this Type type) + { + var typeInfo = type.GetTypeInfo(); + return typeInfo.IsPrimitive + || typeInfo.IsEnum + || type == typeof(string) + || type == typeof(decimal); + } + + // https://stackoverflow.com/a/32025393/294804 + private static bool HasImplicitConversion(this Type baseType, Type targetType) => + baseType.GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(mi => mi.Name == "op_Implicit" && mi.ReturnType == targetType) + .Any(mi => mi.GetParameters().FirstOrDefault()?.ParameterType == baseType); + + public static bool IsPsSimple(this Type type) + { + var unwrappedType = type.Unwrap(); + return unwrappedType.IsSimple() + || unwrappedType == typeof(SwitchParameter) + || unwrappedType == typeof(Hashtable) + || unwrappedType == typeof(PSCredential) + || unwrappedType == typeof(ScriptBlock) + || unwrappedType == typeof(DateTime) + || unwrappedType == typeof(Uri) + || unwrappedType.HasImplicitConversion(typeof(string)); + } + + public static string ToPsList(this IEnumerable items) => String.Join(", ", items.Select(i => $"'{i}'")); + + public static IEnumerable ToAliasNames(this IEnumerable attributes) => attributes.OfType().SelectMany(aa => aa.AliasNames).Distinct(); + + public static bool IsArrayAndElementTypeIsT(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return itemType.IsArray && !tType.IsArray && tType.IsAssignableFrom(itemType.GetElementType()); + } + + public static bool IsTArrayAndElementTypeIsItem(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return !itemType.IsArray && tType.IsArray && (tType.GetElementType()?.IsAssignableFrom(itemType) ?? false); + } + + public static bool IsTypeOrArrayOfType(this object item) => item is T || item.IsArrayAndElementTypeIsT() || item.IsTArrayAndElementTypeIsItem(); + + public static T NormalizeArrayType(this object item) + { + if (item is T result) + { + return result; + } + + if (item.IsArrayAndElementTypeIsT()) + { + var array = (T[])Convert.ChangeType(item, typeof(T[])); + return array.FirstOrDefault(); + } + + if (item.IsTArrayAndElementTypeIsItem()) + { + var tType = typeof(T); + var array = Array.CreateInstance(tType.GetElementType(), 1); + array.SetValue(item, 0); + return (T)Convert.ChangeType(array, tType); + } + + return default(T); + } + + public static T GetNestedProperty(this PSObject psObject, params string[] names) => psObject.Properties.GetNestedProperty(names); + + public static T GetNestedProperty(this PSMemberInfoCollection properties, params string[] names) + { + var lastName = names.Last(); + var nestedProperties = names.Take(names.Length - 1).Aggregate(properties, (p, n) => p?.GetProperty(n)?.Properties); + return nestedProperties != null ? nestedProperties.GetProperty(lastName) : default(T); + } + + public static T GetProperty(this PSObject psObject, string name) => psObject.Properties.GetProperty(name); + + public static T GetProperty(this PSMemberInfoCollection properties, string name) + { + switch (properties[name]?.Value) + { + case PSObject psObject when psObject.BaseObject is PSCustomObject && psObject.ImmediateBaseObject.IsTypeOrArrayOfType(): + return psObject.ImmediateBaseObject.NormalizeArrayType(); + case PSObject psObject when psObject.BaseObject.IsTypeOrArrayOfType(): + return psObject.BaseObject.NormalizeArrayType(); + case object value when value.IsTypeOrArrayOfType(): + return value.NormalizeArrayType(); + default: + return default(T); + } + } + + public static IEnumerable RunScript(this PSCmdlet cmdlet, string script) + => PsHelpers.RunScript(cmdlet.InvokeCommand, script); + + public static void RunScript(this PSCmdlet cmdlet, string script) + => cmdlet.RunScript(script); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, string script) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, script); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, string script) + => engineIntrinsics.RunScript(script); + + public static IEnumerable RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => PsHelpers.RunScript(cmdlet.InvokeCommand, block.ToString()); + + public static void RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => cmdlet.RunScript(block.ToString()); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, block.ToString()); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => engineIntrinsics.RunScript(block.ToString()); + + /// + /// Returns if a parameter should be hidden by checking for . + /// + /// A PowerShell parameter. + public static bool IsHidden(this Parameter parameter) + { + return parameter.Attributes.Any(attr => attr is DoNotExportAttribute); + } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/PsHelpers.cs b/src/Peering/generated/runtime/BuildTime/PsHelpers.cs new file mode 100644 index 000000000000..2c177f523fc6 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/PsHelpers.cs @@ -0,0 +1,105 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using Pwsh = System.Management.Automation.PowerShell; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal static class PsHelpers + { + public static IEnumerable RunScript(string script) + => Pwsh.Create().AddScript(script).Invoke(); + + public static void RunScript(string script) + => RunScript(script); + + public static IEnumerable RunScript(CommandInvocationIntrinsics cii, string script) + => cii.InvokeScript(script).Select(o => o?.BaseObject).Where(o => o != null).OfType(); + + public static void RunScript(CommandInvocationIntrinsics cii, string script) + => RunScript(cii, script); + + public static IEnumerable GetModuleCmdlets(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletsCommand = String.Join(" + ", modulePaths.Select(mp => $"(Get-Command -Module (Import-Module '{mp}' -PassThru))")); + return (cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand)) + .Where(ci => ci.CommandType != CommandTypes.Alias); + } + + public static IEnumerable GetModuleCmdlets(params string[] modulePaths) + => GetModuleCmdlets(null, modulePaths); + + public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) + { + // https://stackoverflow.com/a/40969712/294804 + var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'"; + var getCmdletsCommand = $@" +$currentFunctions = Get-ChildItem function: +Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} +"; + return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); + } + + public static IEnumerable GetScriptCmdlets(string scriptFolder) + => GetScriptCmdlets(null, scriptFolder); + + public static IEnumerable GetScriptHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var importModules = String.Join(Environment.NewLine, modulePaths.Select(mp => $"Import-Module '{mp}'")); + var getHelpCommand = $@" +$currentFunctions = Get-ChildItem function: +{importModules} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} | ForEach-Object {{ Get-Help -Name $_.Name -Full }} +"; + return cmdlet?.RunScript(getHelpCommand) ?? RunScript(getHelpCommand); + } + + public static IEnumerable GetScriptHelpInfo(params string[] modulePaths) + => GetScriptHelpInfo(null, modulePaths); + + public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" + )); + return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) + .Select(h => new CmdletAndHelpInfo { CommandInfo = (h["CommandInfo"] as PSObject)?.BaseObject as CommandInfo, HelpInfo = h["HelpInfo"] as PSObject }); + } + + public static IEnumerable GetModuleCmdletsAndHelpInfo(params string[] modulePaths) + => GetModuleCmdletsAndHelpInfo(null, modulePaths); + + public static CmdletAndHelpInfo ToCmdletAndHelpInfo(this CommandInfo commandInfo, PSObject helpInfo) => new CmdletAndHelpInfo { CommandInfo = commandInfo, HelpInfo = helpInfo }; + + public const string Psd1Indent = " "; + public const string GuidStart = Psd1Indent + "GUID"; + + public static Guid ReadGuidFromPsd1(string psd1Path) + { + var guid = Guid.NewGuid(); + if (File.Exists(psd1Path)) + { + var currentGuid = File.ReadAllLines(psd1Path) + .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .LastOrDefault()?.Replace("'", String.Empty); + guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; + } + + return guid; + } + } + + internal class CmdletAndHelpInfo + { + public CommandInfo CommandInfo { get; set; } + public PSObject HelpInfo { get; set; } + } +} diff --git a/src/Peering/generated/runtime/BuildTime/StringExtensions.cs b/src/Peering/generated/runtime/BuildTime/StringExtensions.cs new file mode 100644 index 000000000000..6facf7b289cb --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/StringExtensions.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal static class StringExtensions + { + public static string NullIfEmpty(this string text) => String.IsNullOrEmpty(text) ? null : text; + public static string NullIfWhiteSpace(this string text) => String.IsNullOrWhiteSpace(text) ? null : text; + public static string EmptyIfNull(this string text) => text ?? String.Empty; + + public static bool? ToNullableBool(this string text) => String.IsNullOrEmpty(text) ? (bool?)null : Convert.ToBoolean(text.ToLowerInvariant()); + + public static string ToUpperFirstCharacter(this string text) => String.IsNullOrEmpty(text) ? text : $"{text[0].ToString().ToUpperInvariant()}{text.Remove(0, 1)}"; + + public static string ReplaceNewLines(this string value, string replacer = " ", string[] newLineSymbols = null) + => (newLineSymbols ?? new []{ "\r\n", "\n" }).Aggregate(value.EmptyIfNull(), (current, symbol) => current.Replace(symbol, replacer)); + public static string NormalizeNewLines(this string value) => value.ReplaceNewLines("\u00A0").Replace("\u00A0", Environment.NewLine); + } +} diff --git a/src/Peering/generated/runtime/BuildTime/XmlExtensions.cs b/src/Peering/generated/runtime/BuildTime/XmlExtensions.cs new file mode 100644 index 000000000000..4215d9d43846 --- /dev/null +++ b/src/Peering/generated/runtime/BuildTime/XmlExtensions.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal static class XmlExtensions + { + public static string ToXmlString(this T inputObject, bool excludeDeclaration = false) + { + var serializer = new XmlSerializer(typeof(T)); + //https://stackoverflow.com/a/760290/294804 + //https://stackoverflow.com/a/3732234/294804 + var namespaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); + var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = excludeDeclaration, Indent = true }; + using (var stringWriter = new StringWriter()) + using (var xmlWriter = XmlWriter.Create(stringWriter, xmlSettings)) + { + serializer.Serialize(xmlWriter, inputObject, namespaces); + return stringWriter.ToString(); + } + } + } +} diff --git a/src/Peering/generated/runtime/CmdInfoHandler.cs b/src/Peering/generated/runtime/CmdInfoHandler.cs new file mode 100644 index 000000000000..0ceebe59b7e5 --- /dev/null +++ b/src/Peering/generated/runtime/CmdInfoHandler.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Management.Automation; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using NextDelegate = Func, Task>, Task>; + using SignalDelegate = Func, Task>; + + public class CmdInfoHandler + { + private readonly string processRecordId; + private readonly string parameterSetName; + private readonly InvocationInfo invocationInfo; + + public CmdInfoHandler(string processRecordId, InvocationInfo invocationInfo, string parameterSetName) + { + this.processRecordId = processRecordId; + this.parameterSetName = parameterSetName; + this.invocationInfo = invocationInfo; + } + + public Task SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next) + { + request.Headers.Add("x-ms-client-request-id", processRecordId); + request.Headers.Add("CommandName", invocationInfo?.InvocationName); + request.Headers.Add("FullCommandName", invocationInfo?.MyCommand?.Name); + request.Headers.Add("ParameterSetName", parameterSetName); + + // continue with pipeline. + return next(request, token, cancel, signal); + } + } +} diff --git a/src/Peering/generated/runtime/Conversions/ConversionException.cs b/src/Peering/generated/runtime/Conversions/ConversionException.cs new file mode 100644 index 000000000000..14b94943805c --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/ConversionException.cs @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal class ConversionException : Exception + { + internal ConversionException(string message) + : base(message) { } + + internal ConversionException(JsonNode node, Type targetType) + : base($"Cannot convert '{node.Type}' to a {targetType.Name}") { } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/IJsonConverter.cs b/src/Peering/generated/runtime/Conversions/IJsonConverter.cs new file mode 100644 index 000000000000..fcf4028abf80 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/IJsonConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal interface IJsonConverter + { + JsonNode ToJson(object value); + + object FromJson(JsonNode node); + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/BinaryConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/BinaryConverter.cs new file mode 100644 index 000000000000..d0a9d98804b0 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/BinaryConverter.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class BinaryConverter : JsonConverter + { + internal override JsonNode ToJson(byte[] value) => new XBinary(value); + + internal override byte[] FromJson(JsonNode node) + { + switch (node.Type) + { + case JsonType.String : return Convert.FromBase64String(node.ToString()); // Base64 Encoded + case JsonType.Binary : return ((XBinary)node).Value; + } + + throw new ConversionException(node, typeof(byte[])); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/BooleanConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/BooleanConverter.cs new file mode 100644 index 000000000000..ba074d83349d --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/BooleanConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class BooleanConverter : JsonConverter + { + internal override JsonNode ToJson(bool value) => new JsonBoolean(value); + + internal override bool FromJson(JsonNode node) => (bool)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/DateTimeConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/DateTimeConverter.cs new file mode 100644 index 000000000000..4c77a3d6cfff --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/DateTimeConverter.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class DateTimeConverter : JsonConverter + { + internal override JsonNode ToJson(DateTime value) + { + return new JsonDate(value); + } + + internal override DateTime FromJson(JsonNode node) => (DateTime)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs new file mode 100644 index 000000000000..cf578b1a030b --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class DateTimeOffsetConverter : JsonConverter + { + internal override JsonNode ToJson(DateTimeOffset value) => new JsonDate(value); + + internal override DateTimeOffset FromJson(JsonNode node) => (DateTimeOffset)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/DecimalConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/DecimalConverter.cs new file mode 100644 index 000000000000..2bba0ec76df6 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/DecimalConverter.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class DecimalConverter : JsonConverter + { + internal override JsonNode ToJson(decimal value) => new JsonNumber(value.ToString()); + + internal override decimal FromJson(JsonNode node) + { + return (decimal)node; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/DoubleConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/DoubleConverter.cs new file mode 100644 index 000000000000..d0ba69aefd97 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/DoubleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class DoubleConverter : JsonConverter + { + internal override JsonNode ToJson(double value) => new JsonNumber(value); + + internal override double FromJson(JsonNode node) => (double)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/EnumConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/EnumConverter.cs new file mode 100644 index 000000000000..5d2e508a6eae --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/EnumConverter.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class EnumConverter : IJsonConverter + { + private readonly Type type; + + internal EnumConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + } + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + + public object FromJson(JsonNode node) + { + if (node.Type == JsonType.Number) + { + return Enum.ToObject(type, (int)node); + } + + return Enum.Parse(type, node.ToString(), ignoreCase: true); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/GuidConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/GuidConverter.cs new file mode 100644 index 000000000000..d687a3c6e1d9 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/GuidConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class GuidConverter : JsonConverter + { + internal override JsonNode ToJson(Guid value) => new JsonString(value.ToString()); + + internal override Guid FromJson(JsonNode node) => (Guid)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/HashSet'1Converter.cs b/src/Peering/generated/runtime/Conversions/Instances/HashSet'1Converter.cs new file mode 100644 index 000000000000..021849275f09 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/HashSet'1Converter.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class HashSetConverter : JsonConverter> + { + internal override JsonNode ToJson(HashSet value) + { + return new XSet(value); + } + + internal override HashSet FromJson(JsonNode node) + { + var collection = node as ICollection; + + if (collection.Count == 0) return null; + + // TODO: Remove Linq depedency + return new HashSet(collection.Cast()); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/Int16Converter.cs b/src/Peering/generated/runtime/Conversions/Instances/Int16Converter.cs new file mode 100644 index 000000000000..57cc9adae1de --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/Int16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class Int16Converter : JsonConverter + { + internal override JsonNode ToJson(short value) => new JsonNumber(value); + + internal override short FromJson(JsonNode node) => (short)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/Int32Converter.cs b/src/Peering/generated/runtime/Conversions/Instances/Int32Converter.cs new file mode 100644 index 000000000000..bf0066ac0ee7 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/Int32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class Int32Converter : JsonConverter + { + internal override JsonNode ToJson(int value) => new JsonNumber(value); + + internal override int FromJson(JsonNode node) => (int)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/Int64Converter.cs b/src/Peering/generated/runtime/Conversions/Instances/Int64Converter.cs new file mode 100644 index 000000000000..975c0a16c571 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/Int64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class Int64Converter : JsonConverter + { + internal override JsonNode ToJson(long value) => new JsonNumber(value); + + internal override long FromJson(JsonNode node) => (long)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/JsonArrayConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/JsonArrayConverter.cs new file mode 100644 index 000000000000..803084173736 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/JsonArrayConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class JsonArrayConverter : JsonConverter + { + internal override JsonNode ToJson(JsonArray value) => value; + + internal override JsonArray FromJson(JsonNode node) => (JsonArray)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/JsonObjectConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/JsonObjectConverter.cs new file mode 100644 index 000000000000..b6784208c3ae --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/JsonObjectConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class JsonObjectConverter : JsonConverter + { + internal override JsonNode ToJson(JsonObject value) => value; + + internal override JsonObject FromJson(JsonNode node) => (JsonObject)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/SingleConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/SingleConverter.cs new file mode 100644 index 000000000000..c5a1c2023b89 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/SingleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class SingleConverter : JsonConverter + { + internal override JsonNode ToJson(float value) => new JsonNumber(value.ToString()); + + internal override float FromJson(JsonNode node) => (float)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/StringConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/StringConverter.cs new file mode 100644 index 000000000000..079516c50413 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/StringConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class StringConverter : JsonConverter + { + internal override JsonNode ToJson(string value) => new JsonString(value); + + internal override string FromJson(JsonNode node) => node.ToString(); + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/TimeSpanConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/TimeSpanConverter.cs new file mode 100644 index 000000000000..c7515a5bba84 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/TimeSpanConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class TimeSpanConverter : JsonConverter + { + internal override JsonNode ToJson(TimeSpan value) => new JsonString(value.ToString()); + + internal override TimeSpan FromJson(JsonNode node) => (TimeSpan)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/UInt16Converter.cs b/src/Peering/generated/runtime/Conversions/Instances/UInt16Converter.cs new file mode 100644 index 000000000000..4e3b1352c101 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/UInt16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class UInt16Converter : JsonConverter + { + internal override JsonNode ToJson(ushort value) => new JsonNumber(value); + + internal override ushort FromJson(JsonNode node) => (ushort)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/UInt32Converter.cs b/src/Peering/generated/runtime/Conversions/Instances/UInt32Converter.cs new file mode 100644 index 000000000000..10d3580a1afa --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/UInt32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class UInt32Converter : JsonConverter + { + internal override JsonNode ToJson(uint value) => new JsonNumber(value); + + internal override uint FromJson(JsonNode node) => (uint)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/UInt64Converter.cs b/src/Peering/generated/runtime/Conversions/Instances/UInt64Converter.cs new file mode 100644 index 000000000000..9b781195945d --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/UInt64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class UInt64Converter : JsonConverter + { + internal override JsonNode ToJson(ulong value) => new JsonNumber(value.ToString()); + + internal override ulong FromJson(JsonNode node) => (ulong)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/Instances/UriConverter.cs b/src/Peering/generated/runtime/Conversions/Instances/UriConverter.cs new file mode 100644 index 000000000000..4c02c55ce83c --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/Instances/UriConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class UriConverter : JsonConverter + { + internal override JsonNode ToJson(Uri value) => new JsonString(value.AbsoluteUri); + + internal override Uri FromJson(JsonNode node) => (Uri)node; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/JsonConverter.cs b/src/Peering/generated/runtime/Conversions/JsonConverter.cs new file mode 100644 index 000000000000..d76477f1cc0a --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/JsonConverter.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public abstract class JsonConverter : IJsonConverter + { + internal abstract T FromJson(JsonNode node); + + internal abstract JsonNode ToJson(T value); + + #region IConverter + + object IJsonConverter.FromJson(JsonNode node) => FromJson(node); + + JsonNode IJsonConverter.ToJson(object value) => ToJson((T)value); + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/JsonConverterAttribute.cs b/src/Peering/generated/runtime/Conversions/JsonConverterAttribute.cs new file mode 100644 index 000000000000..f5d33a6cd6c9 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/JsonConverterAttribute.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class JsonConverterAttribute : Attribute + { + internal JsonConverterAttribute(Type type) + { + Converter = (IJsonConverter)Activator.CreateInstance(type); + } + + internal IJsonConverter Converter { get; } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/JsonConverterFactory.cs b/src/Peering/generated/runtime/Conversions/JsonConverterFactory.cs new file mode 100644 index 000000000000..a71abc257d32 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/JsonConverterFactory.cs @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class JsonConverterFactory + { + private static readonly Dictionary converters = new Dictionary(); + + static JsonConverterFactory() + { + AddInternal(new BooleanConverter()); + AddInternal(new DateTimeConverter()); + AddInternal(new DateTimeOffsetConverter()); + AddInternal(new BinaryConverter()); + AddInternal(new DecimalConverter()); + AddInternal(new DoubleConverter()); + AddInternal(new GuidConverter()); + AddInternal(new Int16Converter()); + AddInternal(new Int32Converter()); + AddInternal(new Int64Converter()); + AddInternal(new SingleConverter()); + AddInternal(new StringConverter()); + AddInternal(new TimeSpanConverter()); + AddInternal(new UInt16Converter()); + AddInternal(new UInt32Converter()); + AddInternal(new UInt64Converter()); + AddInternal(new UriConverter()); + + // Hash sets + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + + // JSON + + AddInternal(new JsonObjectConverter()); + AddInternal(new JsonArrayConverter()); + } + + internal static Dictionary Instances => converters; + + internal static IJsonConverter Get(Type type) + { + var details = TypeDetails.Get(type); + + if (details.JsonConverter == null) + { + throw new ConversionException($"No converter found for '{type.Name}'."); + } + + return details.JsonConverter; + } + + internal static bool TryGet(Type type, out IJsonConverter converter) + { + var typeDetails = TypeDetails.Get(type); + + converter = typeDetails.JsonConverter; + + return converter != null; + } + + private static void AddInternal(JsonConverter converter) + => converters.Add(typeof(T), converter); + + private static void AddInternal(IJsonConverter converter) + => converters.Add(typeof(T), converter); + + internal static void Add(JsonConverter converter) + { + if (converter == null) + { + throw new ArgumentNullException(nameof(converter)); + } + + AddInternal(converter); + + var type = TypeDetails.Get(); + + type.JsonConverter = converter; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Conversions/StringLikeConverter.cs b/src/Peering/generated/runtime/Conversions/StringLikeConverter.cs new file mode 100644 index 000000000000..55d18eb5c363 --- /dev/null +++ b/src/Peering/generated/runtime/Conversions/StringLikeConverter.cs @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class StringLikeConverter : IJsonConverter + { + private readonly Type type; + private readonly MethodInfo parseMethod; + + internal StringLikeConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + this.parseMethod = StringLikeHelper.GetParseMethod(type); + } + + public object FromJson(JsonNode node) => + parseMethod.Invoke(null, new[] { node.ToString() }); + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + } + + internal static class StringLikeHelper + { + private static readonly Type[] parseMethodParamaterTypes = new[] { typeof(string) }; + + internal static bool IsStringLike(Type type) + { + return GetParseMethod(type) != null; + } + + internal static MethodInfo GetParseMethod(Type type) + { + MethodInfo method = type.GetMethod("Parse", parseMethodParamaterTypes); + + if (method?.IsPublic != true) return null; + + return method; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Customizations/IJsonSerializable.cs b/src/Peering/generated/runtime/Customizations/IJsonSerializable.cs new file mode 100644 index 000000000000..2457f4ca5eb4 --- /dev/null +++ b/src/Peering/generated/runtime/Customizations/IJsonSerializable.cs @@ -0,0 +1,263 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json; +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + public interface IJsonSerializable + { + JsonNode ToJson(JsonObject container = null, SerializationMode serializationMode = SerializationMode.None); + } + internal static class JsonSerializable + { + /// + /// Serializes an enumerable and returns a JsonNode. + /// + /// an IEnumerable collection of items + /// A JsonNode that contains the collection of items serialized. + private static JsonNode ToJsonValue(System.Collections.IEnumerable enumerable) + { + if (enumerable != null) + { + // is it a byte array of some kind? + if (enumerable is System.Collections.Generic.IEnumerable byteEnumerable) + { + return new XBinary(System.Linq.Enumerable.ToArray(byteEnumerable)); + } + + var hasValues = false; + // just create an array of value nodes. + var result = new XNodeArray(); + foreach (var each in enumerable) + { + // we had at least one value. + hasValues = true; + + // try to serialize it. + var node = ToJsonValue(each); + if (null != node) + { + result.Add(node); + } + } + + // if we were able to add values, (or it was just empty), return it. + if (result.Count > 0 || !hasValues) + { + return result; + } + } + + // we couldn't serialize the values. Sorry. + return null; + } + + /// + /// Serializes a valuetype to a JsonNode. + /// + /// a ValueType (ie, a primitive, enum or struct) to be serialized + /// a JsonNode with the serialized value + private static JsonNode ToJsonValue(ValueType vValue) + { + // numeric type + if (vValue is SByte || vValue is Int16 || vValue is Int32 || vValue is Int64 || vValue is Byte || vValue is UInt16 || vValue is UInt32 || vValue is UInt64 || vValue is decimal || vValue is float || vValue is double) + { + return new JsonNumber(vValue.ToString()); + } + + // boolean type + if (vValue is bool bValue) + { + return new JsonBoolean(bValue); + } + + // dates + if (vValue is DateTime dtValue) + { + return new JsonDate(dtValue); + } + + // DictionaryEntity struct type + if (vValue is System.Collections.DictionaryEntry deValue) + { + return new JsonObject { { deValue.Key.ToString(), ToJsonValue(deValue.Value) } }; + } + + // sorry, no idea. + return null; + } + /// + /// Attempts to serialize an object by using ToJson() or ToJsonString() if they exist. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + private static JsonNode TryToJsonValue(dynamic oValue) + { + object jsonValue = null; + dynamic v = oValue; + try + { + jsonValue = v.ToJson().ToString(); + } + catch + { + // no harm... + try + { + jsonValue = v.ToJsonString().ToString(); + } + catch + { + // no worries here either. + } + } + + // if we got something out, let's use it. + if (null != jsonValue) + { + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + return new JsonNumber(jsonValue.ToString()); + } + + return null; + } + + /// + /// Serialize an object by using a variety of methods. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + internal static JsonNode ToJsonValue(object value) + { + // things that implement our interface are preferred. + if (value is Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IJsonSerializable jsonSerializable) + { + return jsonSerializable.ToJson(); + } + + // strings are easy. + if (value is string || value is char) + { + return new JsonString(value.ToString()); + } + + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + if (value is System.ValueType vValue) + { + return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); + } + + // dictionaries are objects that should be able to serialize + if (value is System.Collections.Generic.IDictionary dictionary) + { + return Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.JsonSerializable.ToJson(dictionary, null); + } + + // hashtables are converted to dictionaries for serialization + if (value is System.Collections.Hashtable hashtable) + { + var dict = new System.Collections.Generic.Dictionary(); + DictionaryExtensions.HashTableToDictionary(hashtable, dict); + return Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.JsonSerializable.ToJson(dict, null); + } + + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + if (value is System.Collections.IEnumerable enumerableValue) + { + // some kind of enumerable value + return ToJsonValue(enumerableValue) ?? TryToJsonValue(value) ?? new JsonString(value.ToString()); + } + + // at this point, we're going to fallback to a string literal here, since we really have no idea what it is. + return new JsonString(value.ToString()); + } + + internal static JsonObject ToJson(System.Collections.Generic.Dictionary dictionary, JsonObject container) => ToJson((System.Collections.Generic.IDictionary)dictionary, container); + + /// + /// Serializes a dictionary into a JsonObject container. + /// + /// The dictionary to serailize + /// the container to serialize the dictionary into + /// the container + internal static JsonObject ToJson(System.Collections.Generic.IDictionary dictionary, JsonObject container) + { + container = container ?? new JsonObject(); + if (dictionary != null && dictionary.Count > 0) + { + foreach (var key in dictionary) + { + // currently, we don't serialize null values. + if (null != key.Value) + { + container.Add(key.Key, ToJsonValue(key.Value)); + continue; + } + } + } + return container; + } + + internal static Func> DeserializeDictionary(Func> dictionaryFactory) + { + return (node) => FromJson(node, dictionaryFactory(), (object)(DeserializeDictionary(dictionaryFactory)) as Func); + } + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.Dictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) => FromJson(json, (System.Collections.Generic.IDictionary)container, objectFactory, excludes); + + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.IDictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) + { + if (null == json) + { + return container; + } + + foreach (var key in json.Keys) + { + if (true == excludes?.Contains(key)) + { + continue; + } + + var value = json[key]; + try + { + switch (value.Type) + { + case JsonType.Null: + // skip null values. + continue; + + case JsonType.Array: + case JsonType.Boolean: + case JsonType.Date: + case JsonType.Binary: + case JsonType.Number: + case JsonType.String: + container.Add(key, (V)value.ToValue()); + break; + case JsonType.Object: + if (objectFactory != null) + { + var v = objectFactory(value as JsonObject); + if (null != v) + { + container.Add(key, v); + } + } + break; + } + } + catch + { + } + } + return container; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Customizations/JsonArray.cs b/src/Peering/generated/runtime/Customizations/JsonArray.cs new file mode 100644 index 000000000000..ad3ae365286e --- /dev/null +++ b/src/Peering/generated/runtime/Customizations/JsonArray.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public partial class JsonArray + { + internal override object ToValue() => Count == 0 ? new object[0] : System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Select(this, each => each.ToValue())); + } + + +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Customizations/JsonBoolean.cs b/src/Peering/generated/runtime/Customizations/JsonBoolean.cs new file mode 100644 index 000000000000..75ecbbf65aee --- /dev/null +++ b/src/Peering/generated/runtime/Customizations/JsonBoolean.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal partial class JsonBoolean + { + internal static JsonBoolean Create(bool? value) => value is bool b ? new JsonBoolean(b) : null; + internal bool ToBoolean() => Value; + + internal override object ToValue() => Value; + } + + +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Customizations/JsonNode.cs b/src/Peering/generated/runtime/Customizations/JsonNode.cs new file mode 100644 index 000000000000..e79c104f38f3 --- /dev/null +++ b/src/Peering/generated/runtime/Customizations/JsonNode.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonNode + { + /// + /// Returns the content of this node as the underlying value. + /// Will default to the string representation if not overridden in child classes. + /// + /// an object with the underlying value of the node. + internal virtual object ToValue() { + return this.ToString(); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Customizations/JsonNumber.cs b/src/Peering/generated/runtime/Customizations/JsonNumber.cs new file mode 100644 index 000000000000..91ee37847311 --- /dev/null +++ b/src/Peering/generated/runtime/Customizations/JsonNumber.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + using System; + + public partial class JsonNumber + { + internal static readonly DateTime EpochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static long ToUnixTime(DateTime dateTime) + { + return (long)dateTime.Subtract(EpochDate).TotalSeconds; + } + private static DateTime FromUnixTime(long totalSeconds) + { + return EpochDate.AddSeconds(totalSeconds); + } + internal byte ToByte() => this; + internal int ToInt() => this; + internal long ToLong() => this; + internal short ToShort() => this; + internal UInt16 ToUInt16() => this; + internal UInt32 ToUInt32() => this; + internal UInt64 ToUInt64() => this; + internal decimal ToDecimal() => this; + internal double ToDouble() => this; + internal float ToFloat() => this; + + internal static JsonNumber Create(int? value) => value is int n ? new JsonNumber(n) : null; + internal static JsonNumber Create(long? value) => value is long n ? new JsonNumber(n) : null; + internal static JsonNumber Create(float? value) => value is float n ? new JsonNumber(n) : null; + internal static JsonNumber Create(double? value) => value is double n ? new JsonNumber(n) : null; + internal static JsonNumber Create(decimal? value) => value is decimal n ? new JsonNumber(n) : null; + internal static JsonNumber Create(DateTime? value) => value is DateTime date ? new JsonNumber(ToUnixTime(date)) : null; + + public static implicit operator DateTime(JsonNumber number) => FromUnixTime(number); + internal DateTime ToDateTime() => this; + + internal JsonNumber(decimal value) + { + this.value = value.ToString(); + } + internal override object ToValue() + { + if (IsInteger) + { + if (int.TryParse(this.value, out int iValue)) + { + return iValue; + } + if (long.TryParse(this.value, out long lValue)) + { + return lValue; + } + } + else + { + if (float.TryParse(this.value, out float fValue)) + { + return fValue; + } + if (double.TryParse(this.value, out double dValue)) + { + return dValue; + } + if (decimal.TryParse(this.value, out decimal dcValue)) + { + return dcValue; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Customizations/JsonObject.cs b/src/Peering/generated/runtime/Customizations/JsonObject.cs new file mode 100644 index 000000000000..049d3ea3c6ec --- /dev/null +++ b/src/Peering/generated/runtime/Customizations/JsonObject.cs @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonObject + { + internal override object ToValue() => Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.JsonSerializable.FromJson(this, new System.Collections.Generic.Dictionary(), (obj) => obj.ToValue()); + + internal void SafeAdd(string name, Func valueFn) + { + if (valueFn != null) + { + var value = valueFn(); + if (null != value) + { + items.Add(name, value); + } + } + } + + internal void SafeAdd(string name, JsonNode value) + { + if (null != value) + { + items.Add(name, value); + } + } + + internal T NullableProperty(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; + } + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + //throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal JsonObject Property(string propertyName) + { + return PropertyT(propertyName); + } + + internal T PropertyT(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; // we're going to assume that the consumer knows what to do if null is explicity returned? + } + + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + // throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal int NumberProperty(string propertyName, ref int output) => output = this.PropertyT(propertyName)?.ToInt() ?? output; + internal float NumberProperty(string propertyName, ref float output) => output = this.PropertyT(propertyName)?.ToFloat() ?? output; + internal byte NumberProperty(string propertyName, ref byte output) => output = this.PropertyT(propertyName)?.ToByte() ?? output; + internal long NumberProperty(string propertyName, ref long output) => output = this.PropertyT(propertyName)?.ToLong() ?? output; + internal double NumberProperty(string propertyName, ref double output) => output = this.PropertyT(propertyName)?.ToDouble() ?? output; + internal decimal NumberProperty(string propertyName, ref decimal output) => output = this.PropertyT(propertyName)?.ToDecimal() ?? output; + internal short NumberProperty(string propertyName, ref short output) => output = this.PropertyT(propertyName)?.ToShort() ?? output; + internal DateTime NumberProperty(string propertyName, ref DateTime output) => output = this.PropertyT(propertyName)?.ToDateTime() ?? output; + + internal int? NumberProperty(string propertyName, ref int? output) => output = this.NullableProperty(propertyName)?.ToInt() ?? null; + internal float? NumberProperty(string propertyName, ref float? output) => output = this.NullableProperty(propertyName)?.ToFloat() ?? null; + internal byte? NumberProperty(string propertyName, ref byte? output) => output = this.NullableProperty(propertyName)?.ToByte() ?? null; + internal long? NumberProperty(string propertyName, ref long? output) => output = this.NullableProperty(propertyName)?.ToLong() ?? null; + internal double? NumberProperty(string propertyName, ref double? output) => output = this.NullableProperty(propertyName)?.ToDouble() ?? null; + internal decimal? NumberProperty(string propertyName, ref decimal? output) => output = this.NullableProperty(propertyName)?.ToDecimal() ?? null; + internal short? NumberProperty(string propertyName, ref short? output) => output = this.NullableProperty(propertyName)?.ToShort() ?? null; + + internal DateTime? NumberProperty(string propertyName, ref DateTime? output) => output = this.NullableProperty(propertyName)?.ToDateTime() ?? null; + + + internal string StringProperty(string propertyName) => this.PropertyT(propertyName)?.ToString(); + internal string StringProperty(string propertyName, ref string output) => output = this.PropertyT(propertyName)?.ToString() ?? output; + internal char StringProperty(string propertyName, ref char output) => output = this.PropertyT(propertyName)?.ToChar() ?? output; + internal char? StringProperty(string propertyName, ref char? output) => output = this.PropertyT(propertyName)?.ToChar() ?? null; + + internal DateTime StringProperty(string propertyName, ref DateTime output) => DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out output) ? output : output; + internal DateTime? StringProperty(string propertyName, ref DateTime? output) => output = DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out var o) ? o : output; + + + internal bool BooleanProperty(string propertyName, ref bool output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? output; + internal bool? BooleanProperty(string propertyName, ref bool? output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? null; + + internal T[] ArrayProperty(string propertyName, ref T[] output, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + } + return output; + } + internal T[] ArrayProperty(string propertyName, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + var output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + return output; + } + return new T[0]; + } + internal void IterateArrayProperty(string propertyName, Action deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + for (var i = 0; i < array.Count; i++) + { + deserializer(array[i]); + } + } + } + + internal Dictionary DictionaryProperty(string propertyName, ref Dictionary output, Func deserializer) + { + var dictionary = this.PropertyT(propertyName); + if (output == null) + { + output = new Dictionary(); + } + else + { + output.Clear(); + } + if (dictionary != null) + { + foreach (var key in dictionary.Keys) + { + output[key] = deserializer(dictionary[key]); + } + } + return output; + } + + internal static JsonObject Create(IDictionary source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new JsonObject(); + + foreach (var key in source.Keys) + { + result.SafeAdd(key, selector(source[key])); + } + return result; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Customizations/JsonString.cs b/src/Peering/generated/runtime/Customizations/JsonString.cs new file mode 100644 index 000000000000..af1e6f28351b --- /dev/null +++ b/src/Peering/generated/runtime/Customizations/JsonString.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + using System; + using System.Globalization; + using System.Linq; + + public partial class JsonString + { + internal static string DateFormat = "yyyy-MM-dd"; + internal static string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; + internal static string DateTimeRfc1123Format = "R"; + + internal static JsonString Create(string value) => value == null ? null : new JsonString(value); + internal static JsonString Create(char? value) => value is char c ? new JsonString(c.ToString()) : null; + + internal static JsonString CreateDate(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTime(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTimeRfc1123(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeRfc1123Format, CultureInfo.CurrentCulture)) : null; + + internal char ToChar() => this.Value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char(JsonString value) => value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char? (JsonString value) => value?.ToString()?.FirstOrDefault(); + + public static implicit operator DateTime(JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime); + public static implicit operator DateTime? (JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime?); + + } + + +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Customizations/XNodeArray.cs b/src/Peering/generated/runtime/Customizations/XNodeArray.cs new file mode 100644 index 000000000000..9e0411898c6b --- /dev/null +++ b/src/Peering/generated/runtime/Customizations/XNodeArray.cs @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + using System; + using System.Linq; + + public partial class XNodeArray + { + internal static XNodeArray Create(T[] source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new XNodeArray(); + foreach (var item in source.Select(selector)) + { + result.SafeAdd(item); + } + return result; + } + internal void SafeAdd(JsonNode item) + { + if (item != null) + { + items.Add(item); + } + } + internal void SafeAdd(Func itemFn) + { + if (itemFn != null) + { + var item = itemFn(); + if (item != null) + { + items.Add(item); + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Debugging.cs b/src/Peering/generated/runtime/Debugging.cs new file mode 100644 index 000000000000..b7cdc58b717e --- /dev/null +++ b/src/Peering/generated/runtime/Debugging.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + internal static class AttachDebugger + { + internal static void Break() + { + while (!System.Diagnostics.Debugger.IsAttached) + { + System.Console.Error.WriteLine($"Waiting for debugger to attach to process {System.Diagnostics.Process.GetCurrentProcess().Id}"); + for (int i = 0; i < 50; i++) + { + if (System.Diagnostics.Debugger.IsAttached) + { + break; + } + System.Threading.Thread.Sleep(100); + System.Console.Error.Write("."); + } + System.Console.Error.WriteLine(); + } + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/src/Peering/generated/runtime/DictionaryExtensions.cs b/src/Peering/generated/runtime/DictionaryExtensions.cs new file mode 100644 index 000000000000..0cfa32d7981b --- /dev/null +++ b/src/Peering/generated/runtime/DictionaryExtensions.cs @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + internal static class DictionaryExtensions + { + internal static void HashTableToDictionary(System.Collections.Hashtable hashtable, System.Collections.Generic.IDictionary dictionary) + { + if (null == hashtable) + { + return; + } + foreach (var each in hashtable.Keys) + { + var key = each.ToString(); + var value = hashtable[key]; + if (null != value) + { + try + { + dictionary[key] = (V)value; + } + catch + { + // Values getting dropped; not compatible with target dictionary. Not sure what to do here. + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/EventData.cs b/src/Peering/generated/runtime/EventData.cs new file mode 100644 index 000000000000..6edcf5adf076 --- /dev/null +++ b/src/Peering/generated/runtime/EventData.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + + using System; + using System.Threading; + + ///Represents the data in signaled event. + public partial class EventData + { + /// + /// The type of the event being signaled + /// + public string Id; + + /// + /// The user-ready message from the event. + /// + public string Message; + + /// + /// When the event is about a parameter, this is the parameter name. + /// Used in Validation Events + /// + public string Parameter; + + /// + /// This represents a numeric value associated with the event. + /// Use for progress-style events + /// + public double Value; + + /// + /// Any extended data for an event should be serialized and stored here. + /// + public string ExtendedData; + + /// + /// If the event triggers after the request message has been created, this will contain the Request Message (which in HTTP calls would be HttpRequestMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.RequestMessgae is HttpRequestMessage httpRequest) + /// { + /// httpRequest.Headers.Add("x-request-flavor", "vanilla"); + /// } + /// + /// + public object RequestMessage; + + /// + /// If the event triggers after the response is back, this will contain the Response Message (which in HTTP calls would be HttpResponseMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.ResponseMessage is HttpResponseMessage httpResponse){ + /// var flavor = httpResponse.Headers.GetValue("x-request-flavor"); + /// } + /// + /// + public object ResponseMessage; + + /// + /// Cancellation method for this event. + /// + /// If the event consumer wishes to cancel the request that initiated this event, call Cancel() + /// + /// + /// The original initiator of the request must provide the implementation of this. + /// + public System.Action Cancel; + } + +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/EventDataExtensions.cs b/src/Peering/generated/runtime/EventDataExtensions.cs new file mode 100644 index 000000000000..fa06f1d1a0c2 --- /dev/null +++ b/src/Peering/generated/runtime/EventDataExtensions.cs @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using System; + + /// + /// PowerShell-specific data on top of the llc# EventData + /// + /// + /// In PowerShell, we add on the EventDataConverter to support sending events between modules. + /// Obviously, this code would need to be duplcated on both modules. + /// This is preferable to sharing a common library, as versioning makes that problematic. + /// + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] + public partial class EventData : EventArgs + { + } + + /// + /// A PowerShell PSTypeConverter to adapt an EventData object that has been passed. + /// Usually used between modules. + /// + public class EventDataConverter : System.Management.Automation.PSTypeConverter + { + public override bool CanConvertTo(object sourceValue, Type destinationType) => false; + public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => null; + public override bool CanConvertFrom(dynamic sourceValue, Type destinationType) => destinationType == typeof(EventData) && CanConvertFrom(sourceValue); + public override object ConvertFrom(dynamic sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Verifies that a given object has the required members to convert it to the target type (EventData) + /// + /// Uses a dynamic type so that it is able to use the simplest code without excessive checking. + /// + /// The instance to verify + /// True, if the object has all the required parameters. + public static bool CanConvertFrom(dynamic sourceValue) + { + try + { + // check if this has *required* parameters... + sourceValue?.Id?.GetType(); + sourceValue?.Message?.GetType(); + sourceValue?.Cancel?.GetType(); + + // remaining parameters are not *required*, + // and if they have values, it will copy them at conversion time. + } + catch + { + // if anything throws an exception (because it's null, or doesn't have that member) + return false; + } + return true; + } + + /// + /// Returns result of the delegate as the expected type, or default(T) + /// + /// This isolates any exceptions from the consumer. + /// + /// A delegate that returns a value + /// The desired output type + /// The value from the function if the type is correct + private static T To(Func srcValue) + { + try { return srcValue(); } + catch { return default(T); } + } + + /// + /// Converts an incoming object to the expected type by treating the incoming object as a dynamic, and coping the expected values. + /// + /// the incoming object + /// EventData + public static EventData ConvertFrom(dynamic sourceValue) + { + return new EventData + { + Id = To(() => sourceValue.Id), + Message = To(() => sourceValue.Message), + Parameter = To(() => sourceValue.Parameter), + Value = To(() => sourceValue.Value), + RequestMessage = To(() => sourceValue.RequestMessage), + ResponseMessage = To(() => sourceValue.ResponseMessage), + Cancel = To(() => sourceValue.Cancel) + }; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/EventListener.cs b/src/Peering/generated/runtime/EventListener.cs new file mode 100644 index 000000000000..9225e6d4ddac --- /dev/null +++ b/src/Peering/generated/runtime/EventListener.cs @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + public interface IValidates + { + Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IEventListener listener); + } + + /// + /// The IEventListener Interface defines the communication mechanism for Signaling events during a remote call. + /// + /// + /// The interface is designed to be as minimal as possible, allow for quick peeking of the event type (id) + /// and the cancellation status and provides a delegate for retrieving the event details themselves. + /// + public interface IEventListener + { + Task Signal(string id, CancellationToken token, GetEventData createMessage); + CancellationToken Token { get; } + System.Action Cancel { get; } + } + + internal static partial class Extensions + { + public static Task Signal(this IEventListener instance, string id, CancellationToken token, Func createMessage) => instance.Signal(id, token, createMessage); + public static Task Signal(this IEventListener instance, string id, CancellationToken token) => instance.Signal(id, token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, EventData message) => instance.Signal(id, token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, Func createMessage) => instance.Signal(id, instance.Token, createMessage); + public static Task Signal(this IEventListener instance, string id) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, EventData message) => instance.Signal(id, instance.Token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, System.Uri uri) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = uri.ToString(), Cancel = instance.Cancel }); + + public static async Task AssertNotNull(this IEventListener instance, string parameterName, object value) + { + if (value == null) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' should not be null", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMinimumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length < length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is less than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMaximumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length > length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is greater than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + + public static async Task AssertRegEx(this IEventListener instance, string parameterName, string value, string regularExpression) + { + if (value != null && !System.Text.RegularExpressions.Regex.Match(value, regularExpression).Success) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' does not validate against pattern /{regularExpression}/", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertEnum(this IEventListener instance, string parameterName, string value, params string[] values) + { + if (!values.Any(each => each.Equals(value))) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' is not one of ({values.Aggregate((c, e) => $"'{e}',{c}")}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertObjectIsValid(this IEventListener instance, string parameterName, object inst) + { + await (inst as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.IValidates)?.Validate(instance); + } + + public static async Task AssertIsLessThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) >= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) <= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsLessThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) > 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) < 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, Int64? value, Int64 multiple) + { + if (null != value && value % multiple != 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, double? value, double multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, decimal? value, decimal multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + } + + /// + /// An Implementation of the IEventListener that supports subscribing to events and dispatching them + /// (used for manually using the lowlevel interface) + /// + public class EventListener : CancellationTokenSource, IEnumerable>, IEventListener + { + private Dictionary calls = new Dictionary(); + public IEnumerator> GetEnumerator() => calls.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => calls.GetEnumerator(); + public EventListener() + { + } + + public new Action Cancel => base.Cancel; + private Event tracer; + + public EventListener(params (string name, Event callback)[] initializer) + { + foreach (var each in initializer) + { + Add(each.name, each.callback); + } + } + + public void Add(string name, SynchEvent callback) + { + Add(name, (message) => { callback(message); return Task.CompletedTask; }); + } + + public void Add(string name, Event callback) + { + if (callback != null) + { + if (string.IsNullOrEmpty(name)) + { + if (calls.ContainsKey(name)) + { + tracer += callback; + } + else + { + tracer = callback; + } + } + else + { + if (calls.ContainsKey(name)) + { + calls[name ?? System.String.Empty] += callback; + } + else + { + calls[name ?? System.String.Empty] = callback; + } + } + } + } + + + public async Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + using (NoSynchronizationContext) + { + if (!string.IsNullOrEmpty(id) && (calls.TryGetValue(id, out Event listener) || tracer != null)) + { + var message = createMessage(); + message.Id = id; + + await listener?.Invoke(message); + await tracer?.Invoke(message); + + if (token.IsCancellationRequested) + { + throw new OperationCanceledException($"Canceled by event {id} ", this.Token); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Events.cs b/src/Peering/generated/runtime/Events.cs new file mode 100644 index 000000000000..cf2fd3bf2a90 --- /dev/null +++ b/src/Peering/generated/runtime/Events.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + public static partial class Events + { + public const string Log = nameof(Log); + public const string Validation = nameof(Validation); + public const string ValidationWarning = nameof(ValidationWarning); + public const string AfterValidation = nameof(AfterValidation); + public const string RequestCreated = nameof(RequestCreated); + public const string ResponseCreated = nameof(ResponseCreated); + public const string URLCreated = nameof(URLCreated); + public const string Finally = nameof(Finally); + public const string HeaderParametersAdded = nameof(HeaderParametersAdded); + public const string BodyContentSet = nameof(BodyContentSet); + public const string BeforeCall = nameof(BeforeCall); + public const string BeforeResponseDispatch = nameof(BeforeResponseDispatch); + public const string FollowingNextLink = nameof(FollowingNextLink); + public const string DelayBeforePolling = nameof(DelayBeforePolling); + public const string Polling = nameof(Polling); + + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/EventsExtensions.cs b/src/Peering/generated/runtime/EventsExtensions.cs new file mode 100644 index 000000000000..b15bdc0f0434 --- /dev/null +++ b/src/Peering/generated/runtime/EventsExtensions.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + public static partial class Events + { + public const string CmdletProcessRecordStart = nameof(CmdletProcessRecordStart); + public const string CmdletProcessRecordAsyncStart = nameof(CmdletProcessRecordAsyncStart); + public const string CmdletException = nameof(CmdletException); + public const string CmdletGetPipeline = nameof(CmdletGetPipeline); + public const string CmdletBeforeAPICall = nameof(CmdletBeforeAPICall); + public const string CmdletBeginProcessing = nameof(CmdletBeginProcessing); + public const string CmdletEndProcessing = nameof(CmdletEndProcessing); + public const string CmdletProcessRecordEnd = nameof(CmdletProcessRecordEnd); + public const string CmdletProcessRecordAsyncEnd = nameof(CmdletProcessRecordAsyncEnd); + public const string CmdletAfterAPICall = nameof(CmdletAfterAPICall); + + public const string Verbose = nameof(Verbose); + public const string Debug = nameof(Debug); + public const string Information = nameof(Information); + public const string Error = nameof(Error); + public const string Warning = nameof(Warning); + } + +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Extensions.cs b/src/Peering/generated/runtime/Extensions.cs new file mode 100644 index 000000000000..2c1fdbe5fd49 --- /dev/null +++ b/src/Peering/generated/runtime/Extensions.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using System.Linq; + using System; + + internal static partial class Extensions + { + public static T[] SubArray(this T[] array, int offset, int length) + { + return new ArraySegment(array, offset, length) + .ToArray(); + } + + public static T ReadHeaders(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class + { + (instance as IHeaderSerializable)?.ReadHeaders(headers); + return instance; + } + + internal static bool If(T input, out T output) + { + if (null == input) + { + output = default(T); + return false; + } + output = input; + return true; + } + + internal static void AddIf(T value, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(value); + } + } + + internal static void AddIf(T value, string serializedName, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(serializedName, value); + } + } + + /// + /// Returns the first header value as a string from an HttpReponseMessage. + /// + /// the HttpResponseMessage to fetch a header from + /// the header name + /// the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching + internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => string.Equals(headerName, each.Key, System.StringComparison.OrdinalIgnoreCase)).Value?.FirstOrDefault() ?? string.Empty; + + /// + /// Sets the Synchronization Context to null, and returns an IDisposable that when disposed, + /// will restore the synchonization context to the original value. + /// + /// This is used a less-invasive means to ensure that code in the library that doesn't + /// need to be continued in the original context doesn't have to have ConfigureAwait(false) + /// on every single await + /// + /// If the SynchronizationContext is null when this is used, the resulting IDisposable + /// will not do anything (this prevents excessive re-setting of the SynchronizationContext) + /// + /// Usage: + /// + /// using(NoSynchronizationContext) { + /// await SomeAsyncOperation(); + /// await SomeOtherOperation(); + /// } + /// + /// + /// + /// An IDisposable that will return the SynchronizationContext to original state + internal static System.IDisposable NoSynchronizationContext => System.Threading.SynchronizationContext.Current == null ? Dummy : new NoSyncContext(); + + /// + /// An instance of the Dummy IDispoable. + /// + /// + internal static System.IDisposable Dummy = new DummyDisposable(); + + /// + /// An IDisposable that does absolutely nothing. + /// + internal class DummyDisposable : System.IDisposable + { + public void Dispose() + { + } + } + /// + /// An IDisposable that saves the SynchronizationContext,sets it to null and + /// restores it to the original upon Dispose(). + /// + /// NOTE: This is designed to be less invasive than using .ConfigureAwait(false) + /// on every single await in library code (ie, places where we know we don't need + /// to continue in the same context as we went async) + /// + internal class NoSyncContext : System.IDisposable + { + private System.Threading.SynchronizationContext original = System.Threading.SynchronizationContext.Current; + internal NoSyncContext() + { + System.Threading.SynchronizationContext.SetSynchronizationContext(null); + } + public void Dispose() => System.Threading.SynchronizationContext.SetSynchronizationContext(original); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs b/src/Peering/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs new file mode 100644 index 000000000000..66bcbe963358 --- /dev/null +++ b/src/Peering/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal static class StringBuilderExtensions + { + /// + /// Extracts the buffered value and resets the buffer + /// + internal static string Extract(this StringBuilder builder) + { + var text = builder.ToString(); + + builder.Clear(); + + return text; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Helpers/Extensions/TypeExtensions.cs b/src/Peering/generated/runtime/Helpers/Extensions/TypeExtensions.cs new file mode 100644 index 000000000000..d7e88796ffcd --- /dev/null +++ b/src/Peering/generated/runtime/Helpers/Extensions/TypeExtensions.cs @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal static class TypeExtensions + { + internal static bool IsNullable(this Type type) => + type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)); + + internal static Type GetOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition() == openGenericInterfaceType) + { + return candidateType; + } + + // Check if it references it's own converter.... + + foreach (Type interfaceType in candidateType.GetInterfaces()) + { + if (interfaceType.IsGenericType + && interfaceType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return interfaceType; + } + } + + return null; + } + + // Author: Sebastian Good + // http://stackoverflow.com/questions/503263/how-to-determine-if-a-type-implements-a-specific-generic-interface-type + internal static bool ImplementsOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + if (candidateType.Equals(openGenericInterfaceType)) + { + return true; + } + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return true; + } + + foreach (Type i in candidateType.GetInterfaces()) + { + if (i.IsGenericType && i.ImplementsOpenGenericInterface(openGenericInterfaceType)) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Helpers/Seperator.cs b/src/Peering/generated/runtime/Helpers/Seperator.cs new file mode 100644 index 000000000000..4514952300b5 --- /dev/null +++ b/src/Peering/generated/runtime/Helpers/Seperator.cs @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal static class Seperator + { + internal static readonly char[] Dash = { '-' }; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Helpers/TypeDetails.cs b/src/Peering/generated/runtime/Helpers/TypeDetails.cs new file mode 100644 index 000000000000..dda2f59d2d96 --- /dev/null +++ b/src/Peering/generated/runtime/Helpers/TypeDetails.cs @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + + + + internal class TypeDetails + { + private readonly Type info; + + internal TypeDetails(Type info) + { + this.info = info ?? throw new ArgumentNullException(nameof(info)); + } + + internal Type NonNullType { get; set; } + + internal object DefaultValue { get; set; } + + internal bool IsNullable { get; set; } + + internal bool IsList { get; set; } + + internal bool IsStringLike { get; set; } + + internal bool IsEnum => info.IsEnum; + + internal bool IsArray => info.IsArray; + + internal bool IsValueType => info.IsValueType; + + internal Type ElementType { get; set; } + + internal IJsonConverter JsonConverter { get; set; } + + #region Creation + + private static readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + + internal static TypeDetails Get() => Get(typeof(T)); + + internal static TypeDetails Get(Type type) => cache.GetOrAdd(type, Create); + + private static TypeDetails Create(Type type) + { + var isGenericList = !type.IsPrimitive && type.ImplementsOpenGenericInterface(typeof(IList<>)); + var isList = !type.IsPrimitive && (isGenericList || typeof(IList).IsAssignableFrom(type)); + + var isNullable = type.IsNullable(); + + Type elementType; + + if (type.IsArray) + { + elementType = type.GetElementType(); + } + else if (isGenericList) + { + var iList = type.GetOpenGenericInterface(typeof(IList<>)); + + elementType = iList.GetGenericArguments()[0]; + } + else + { + elementType = null; + } + + var nonNullType = isNullable ? type.GetGenericArguments()[0] : type; + + var isStringLike = false; + + IJsonConverter converter; + + var jsonConverterAttribute = type.GetCustomAttribute(); + + if (jsonConverterAttribute != null) + { + converter = jsonConverterAttribute.Converter; + } + else if (nonNullType.IsEnum) + { + converter = new EnumConverter(nonNullType); + } + else if (JsonConverterFactory.Instances.TryGetValue(nonNullType, out converter)) + { + } + else if (StringLikeHelper.IsStringLike(nonNullType)) + { + isStringLike = true; + + converter = new StringLikeConverter(nonNullType); + } + + return new TypeDetails(nonNullType) { + NonNullType = nonNullType, + DefaultValue = type.IsValueType ? Activator.CreateInstance(type) : null, + IsNullable = isNullable, + IsList = isList, + IsStringLike = isStringLike, + ElementType = elementType, + JsonConverter = converter + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Helpers/XHelper.cs b/src/Peering/generated/runtime/Helpers/XHelper.cs new file mode 100644 index 000000000000..5b6641381964 --- /dev/null +++ b/src/Peering/generated/runtime/Helpers/XHelper.cs @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal static class XHelper + { + internal static JsonNode Create(JsonType type, TypeCode code, object value) + { + switch (type) + { + case JsonType.Binary : return new XBinary((byte[])value); + case JsonType.Boolean : return new JsonBoolean((bool)value); + case JsonType.Number : return new JsonNumber(value.ToString()); + case JsonType.String : return new JsonString((string)value); + } + + throw new Exception($"JsonType '{type}' does not have a fast conversion"); + } + + internal static bool TryGetElementType(TypeCode code, out JsonType type) + { + switch (code) + { + case TypeCode.Boolean : type = JsonType.Boolean; return true; + case TypeCode.Byte : type = JsonType.Number; return true; + case TypeCode.DateTime : type = JsonType.Date; return true; + case TypeCode.Decimal : type = JsonType.Number; return true; + case TypeCode.Double : type = JsonType.Number; return true; + case TypeCode.Empty : type = JsonType.Null; return true; + case TypeCode.Int16 : type = JsonType.Number; return true; + case TypeCode.Int32 : type = JsonType.Number; return true; + case TypeCode.Int64 : type = JsonType.Number; return true; + case TypeCode.SByte : type = JsonType.Number; return true; + case TypeCode.Single : type = JsonType.Number; return true; + case TypeCode.String : type = JsonType.String; return true; + case TypeCode.UInt16 : type = JsonType.Number; return true; + case TypeCode.UInt32 : type = JsonType.Number; return true; + case TypeCode.UInt64 : type = JsonType.Number; return true; + } + + type = default; + + return false; + } + + internal static JsonType GetElementType(TypeCode code) + { + switch (code) + { + case TypeCode.Boolean : return JsonType.Boolean; + case TypeCode.Byte : return JsonType.Number; + case TypeCode.DateTime : return JsonType.Date; + case TypeCode.Decimal : return JsonType.Number; + case TypeCode.Double : return JsonType.Number; + case TypeCode.Empty : return JsonType.Null; + case TypeCode.Int16 : return JsonType.Number; + case TypeCode.Int32 : return JsonType.Number; + case TypeCode.Int64 : return JsonType.Number; + case TypeCode.SByte : return JsonType.Number; + case TypeCode.Single : return JsonType.Number; + case TypeCode.String : return JsonType.String; + case TypeCode.UInt16 : return JsonType.Number; + case TypeCode.UInt32 : return JsonType.Number; + case TypeCode.UInt64 : return JsonType.Number; + default : return JsonType.Object; + } + + throw new Exception($"TypeCode '{code}' does not have a fast converter"); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/HttpPipeline.cs b/src/Peering/generated/runtime/HttpPipeline.cs new file mode 100644 index 000000000000..8fcf0d04ad70 --- /dev/null +++ b/src/Peering/generated/runtime/HttpPipeline.cs @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + using GetEventData = System.Func; + using NextDelegate = System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + + using SignalDelegate = System.Func, System.Threading.Tasks.Task>; + using GetParameterDelegate = System.Func, string, object>; + using SendAsyncStepDelegate = System.Func, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + using PipelineChangeDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>; + using ModuleLoadPipelineDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = System.Action, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + +/* + public class DelegateBasedEventListener : IEventListener + { + private EventListenerDelegate _listener; + public DelegateBasedEventListener(EventListenerDelegate listener) + { + _listener = listener; + } + public CancellationToken Token => CancellationToken.None; + public System.Action Cancel => () => { }; + + + public Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + return _listener(id, token, () => createMessage()); + } + } +*/ + /// + /// This is a necessary extension to the SendAsyncFactory to support the 'generic' delegate format. + /// + public partial class SendAsyncFactory + { + /// + /// This translates a generic-defined delegate for a listener into one that fits our ISendAsync pattern. + /// (Provided to support out-of-module delegation for Azure Cmdlets) + /// + /// The Pipeline Step as a delegate + public SendAsyncFactory(SendAsyncStepDelegate step) => this.implementation = (request, listener, next) => + step( + request, + listener.Token, + listener.Cancel, + (id, token, getEventData) => listener.Signal(id, token, () => { + var data = EventDataConverter.ConvertFrom( getEventData() ) as EventData; + data.Id = id; + data.Cancel = listener.Cancel; + data.RequestMessage = request; + return data; + }), + (req, token, cancel, listenerDelegate) => next.SendAsync(req, listener)); + } + + public partial class HttpPipeline : ISendAsync + { + public HttpPipeline Append(SendAsyncStepDelegate item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStepDelegate item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + } +} diff --git a/src/Peering/generated/runtime/HttpPipelineMocking.ps1 b/src/Peering/generated/runtime/HttpPipelineMocking.ps1 new file mode 100644 index 000000000000..199e5306d17e --- /dev/null +++ b/src/Peering/generated/runtime/HttpPipelineMocking.ps1 @@ -0,0 +1,110 @@ +$ErrorActionPreference = "Stop" + +# get the recording path +if (-not $TestRecordingFile) { + $TestRecordingFile = Join-Path $PSScriptRoot 'recording.json' +} + +# create the Http Pipeline Recorder +$Mock = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PipelineMock $TestRecordingFile + +# set the recorder to the appropriate mode (default to 'live') +Write-Host -ForegroundColor Green "Running '$TestMode' mode..." +switch ($TestMode) { + 'record' { + Write-Host -ForegroundColor Green "Recording to $TestRecordingFile" + $Mock.SetRecord() + $null = erase -ea 0 $TestRecordingFile + } + 'playback' { + if (-not (Test-Path $TestRecordingFile)) { + Write-Host -fore:yellow "Recording file '$TestRecordingFile' is not present. Tests expecting recorded responses will fail" + } else { + Write-Host -ForegroundColor Green "Using recording $TestRecordingFile" + } + $Mock.SetPlayback() + $Mock.ForceResponseHeaders["Retry-After"] = "0"; + } + default: { + $Mock.SetLive() + } +} + +# overrides for Pester Describe/Context/It + +function Describe( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushDescription($Name) + try { + return pester\Describe -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopDescription() + } +} + +function Context( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushContext($Name) + try { + return pester\Context -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopContext() + } +} + +function It { + [CmdletBinding(DefaultParameterSetName = 'Normal')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Name, + + [Parameter(Position = 1)] + [ScriptBlock] $Test = { }, + + [System.Collections.IDictionary[]] $TestCases, + + [Parameter(ParameterSetName = 'Pending')] + [Switch] $Pending, + + [Parameter(ParameterSetName = 'Skip')] + [Alias('Ignore')] + [Switch] $Skip + ) + $Mock.PushScenario($Name) + + try { + if ($skip) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Skip + } + if ($pending) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Pending + } + return pester\It -Name $Name -Test $Test -TestCases $TestCases + } + finally { + $null = $Mock.PopScenario() + } +} + +# set the HttpPipelineAppend for all the cmdlets +$PSDefaultParameterValues["*:HttpPipelinePrepend"] = $Mock diff --git a/src/Peering/generated/runtime/IAssociativeArray.cs b/src/Peering/generated/runtime/IAssociativeArray.cs new file mode 100644 index 000000000000..da07b8bf2373 --- /dev/null +++ b/src/Peering/generated/runtime/IAssociativeArray.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +#define DICT_PROPERTIES +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + /// A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter + public interface IAssociativeArray + { +#if DICT_PROPERTIES + System.Collections.Generic.IEnumerable Keys { get; } + System.Collections.Generic.IEnumerable Values { get; } + int Count { get; } +#endif + System.Collections.Generic.IDictionary AdditionalProperties { get; } + T this[string index] { get; set; } + void Add(string key, T value); + bool ContainsKey(string key); + bool Remove(string key); + bool TryGetValue(string key, out T value); + void Clear(); + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/IHeaderSerializable.cs b/src/Peering/generated/runtime/IHeaderSerializable.cs new file mode 100644 index 000000000000..301b4cdc173a --- /dev/null +++ b/src/Peering/generated/runtime/IHeaderSerializable.cs @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + public interface IHeaderSerializable + { + void ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers); + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/ISendAsync.cs b/src/Peering/generated/runtime/ISendAsync.cs new file mode 100644 index 000000000000..ee67a96f89cb --- /dev/null +++ b/src/Peering/generated/runtime/ISendAsync.cs @@ -0,0 +1,300 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + /// + /// The interface for sending an HTTP request across the wire. + /// + public interface ISendAsync + { + Task SendAsync(HttpRequestMessage request, IEventListener callback); + } + + public class SendAsyncTerminalFactory : ISendAsyncTerminalFactory, ISendAsync + { + SendAsync implementation; + + public SendAsyncTerminalFactory(SendAsync implementation) => this.implementation = implementation; + public SendAsyncTerminalFactory(ISendAsync implementation) => this.implementation = implementation.SendAsync; + public ISendAsync Create() => this; + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback); + } + + public partial class SendAsyncFactory : ISendAsyncFactory + { + public class Sender : ISendAsync + { + internal ISendAsync next; + internal SendAsyncStep implementation; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback, next); + } + SendAsyncStep implementation; + + public SendAsyncFactory(SendAsyncStep implementation) => this.implementation = implementation; + public ISendAsync Create(ISendAsync next) => new Sender { next = next, implementation = implementation }; + + } + + public class HttpClientFactory : ISendAsyncTerminalFactory, ISendAsync + { + HttpClient client; + public HttpClientFactory() : this(new HttpClient()) + { + } + public HttpClientFactory(HttpClient client) => this.client = client; + public ISendAsync Create() => this; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, callback.Token); + } + + public interface ISendAsyncFactory + { + ISendAsync Create(ISendAsync next); + } + + public interface ISendAsyncTerminalFactory + { + ISendAsync Create(); + } + + public partial class HttpPipeline : ISendAsync + { + private ISendAsync pipeline; + private ISendAsyncTerminalFactory terminal; + private List steps = new List(); + + public HttpPipeline() : this(new HttpClientFactory()) + { + } + + public HttpPipeline(ISendAsyncTerminalFactory terminalStep) + { + if (terminalStep == null) + { + throw new System.ArgumentNullException(nameof(terminalStep), "Terminal Step Factory in HttpPipeline may not be null"); + } + TerminalFactory = terminalStep; + } + + /// + /// Returns an HttpPipeline with the current state of this pipeline. + /// + public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + + public ISendAsyncTerminalFactory TerminalFactory + { + get => terminal; + set + { + if (value == null) + { + throw new System.ArgumentNullException("TerminalFactory in HttpPipeline may not be null"); + } + terminal = value; + } + } + + public ISendAsync Pipeline + { + get + { + // if the pipeline has been created and not invalidated, return it. + if (this.pipeline != null) + { + return this.pipeline; + } + + // create the pipeline from scratch. + var next = terminal.Create(); + foreach (var factory in steps) + { + // skip factories that return null. + next = factory.Create(next) ?? next; + } + return this.pipeline = next; + } + } + + public int Count => steps.Count; + + public HttpPipeline Prepend(ISendAsyncFactory item) + { + if (item != null) + { + steps.Add(item); + pipeline = null; + } + return this; + } + + public HttpPipeline Append(SendAsyncStep item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStep item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Append(ISendAsyncFactory item) + { + if (item != null) + { + steps.Insert(0, item); + pipeline = null; + } + return this; + } + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(item); + } + } + return this; + } + + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(item); + } + } + return this; + } + + // you can use this as the ISendAsync Implementation + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => Pipeline.SendAsync(request, callback); + } + + internal static partial class Extensions + { + internal static HttpRequestMessage CloneAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.Clone(requestUri, method); + } + } + + internal static Task CloneWithContentAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.CloneWithContent(requestUri, method); + } + } + + /// + /// Clones an HttpRequestMessage (without the content) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = new HttpRequestMessage + { + Method = method ?? original.Method, + RequestUri = requestUri ?? original.RequestUri, + Version = original.Version, + }; + + foreach (KeyValuePair prop in original.Properties) + { + clone.Properties.Add(prop); + } + + foreach (KeyValuePair> header in original.Headers) + { + /* + **temporarily skip cloning telemetry related headers** + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + */ + if (!"x-ms-unique-id".Equals(header.Key) && !"x-ms-client-request-id".Equals(header.Key) && !"CommandName".Equals(header.Key) && !"FullCommandName".Equals(header.Key) && !"ParameterSetName".Equals(header.Key) && !"User-Agent".Equals(header.Key)) + { + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + } + + return clone; + } + + /// + /// Clones an HttpRequestMessage (including the content stream and content headers) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = original.Clone(requestUri, method); + var stream = new System.IO.MemoryStream(); + if (original.Content != null) + { + await original.Content.CopyToAsync(stream).ConfigureAwait(false); + stream.Position = 0; + clone.Content = new StreamContent(stream); + if (original.Content.Headers != null) + { + foreach (var h in original.Content.Headers) + { + clone.Content.Headers.Add(h.Key, h.Value); + } + } + } + return clone; + } + } +} diff --git a/src/Peering/generated/runtime/InfoAttribute.cs b/src/Peering/generated/runtime/InfoAttribute.cs new file mode 100644 index 000000000000..91e7003f9bbf --- /dev/null +++ b/src/Peering/generated/runtime/InfoAttribute.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)] + public class InfoAttribute : Attribute + { + public bool Required { get; set; } = false; + public bool ReadOnly { get; set; } = false; + public Type[] PossibleTypes { get; set; } = new Type[0]; + public string Description { get; set; } = ""; + public string SerializedName { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class CompleterInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class DefaultInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Iso/IsoDate.cs b/src/Peering/generated/runtime/Iso/IsoDate.cs new file mode 100644 index 000000000000..04a39ffa5778 --- /dev/null +++ b/src/Peering/generated/runtime/Iso/IsoDate.cs @@ -0,0 +1,214 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal struct IsoDate + { + internal int Year { get; set; } // 0-3000 + + internal int Month { get; set; } // 1-12 + + internal int Day { get; set; } // 1-31 + + internal int Hour { get; set; } // 0-24 + + internal int Minute { get; set; } // 0-60 (60 is a special case) + + internal int Second { get; set; } // 0-60 (60 is used for leap seconds) + + internal double Millisecond { get; set; } // 0-999.9... + + internal TimeSpan Offset { get; set; } + + internal DateTimeKind Kind { get; set; } + + internal TimeSpan TimeOfDay => new TimeSpan(Hour, Minute, Second); + + internal DateTime ToDateTime() + { + if (Kind == DateTimeKind.Utc || Offset == TimeSpan.Zero) + { + return new DateTime(Year, Month, Day, Hour, Minute, Second, (int)Millisecond, DateTimeKind.Utc); + } + + return ToDateTimeOffset().DateTime; + } + + internal DateTimeOffset ToDateTimeOffset() + { + return new DateTimeOffset( + Year, + Month, + Day, + Hour, + Minute, + Second, + (int)Millisecond, + Offset + ); + } + + internal DateTime ToUtcDateTime() + { + return ToDateTimeOffset().UtcDateTime; + } + + public override string ToString() + { + var sb = new StringBuilder(); + + // yyyy-MM-dd + sb.Append($"{Year}-{Month:00}-{Day:00}"); + + if (TimeOfDay > new TimeSpan(0)) + { + sb.Append($"T{Hour:00}:{Minute:00}"); + + if (TimeOfDay.Seconds > 0) + { + sb.Append($":{Second:00}"); + } + } + + if (Offset.Ticks == 0) + { + sb.Append('Z'); // UTC + } + else + { + if (Offset.Ticks >= 0) + { + sb.Append('+'); + } + + sb.Append($"{Offset.Hours:00}:{Offset.Minutes:00}"); + } + + return sb.ToString(); + } + + internal static IsoDate FromDateTimeOffset(DateTimeOffset date) + { + return new IsoDate { + Year = date.Year, + Month = date.Month, + Day = date.Day, + Hour = date.Hour, + Minute = date.Minute, + Second = date.Second, + Offset = date.Offset, + Kind = date.Offset == TimeSpan.Zero ? DateTimeKind.Utc : DateTimeKind.Unspecified + }; + } + + private static readonly char[] timeSeperators = { ':', '.' }; + + internal static IsoDate Parse(string text) + { + var tzIndex = -1; + var timeIndex = text.IndexOf('T'); + + var builder = new IsoDate { Day = 1, Month = 1 }; + + // TODO: strip the time zone offset off the end + string dateTime = text; + string timeZone = null; + + if (dateTime.IndexOf('Z') > -1) + { + tzIndex = dateTime.LastIndexOf('Z'); + + builder.Kind = DateTimeKind.Utc; + } + else if (dateTime.LastIndexOf('+') > 10) + { + tzIndex = dateTime.LastIndexOf('+'); + } + else if (dateTime.LastIndexOf('-') > 10) + { + tzIndex = dateTime.LastIndexOf('-'); + } + + if (tzIndex > -1) + { + timeZone = dateTime.Substring(tzIndex); + dateTime = dateTime.Substring(0, tzIndex); + } + + string date = (timeIndex == -1) ? dateTime : dateTime.Substring(0, timeIndex); + + var dateParts = date.Split(Seperator.Dash); // '-' + + for (int i = 0; i < dateParts.Length; i++) + { + var part = dateParts[i]; + + switch (i) + { + case 0: builder.Year = int.Parse(part); break; + case 1: builder.Month = int.Parse(part); break; + case 2: builder.Day = int.Parse(part); break; + } + } + + if (timeIndex > -1) + { + string[] timeParts = dateTime.Substring(timeIndex + 1).Split(timeSeperators); + + for (int i = 0; i < timeParts.Length; i++) + { + var part = timeParts[i]; + + switch (i) + { + case 0: builder.Hour = int.Parse(part); break; + case 1: builder.Minute = int.Parse(part); break; + case 2: builder.Second = int.Parse(part); break; + case 3: builder.Millisecond = double.Parse("0." + part) * 1000; break; + } + } + } + + if (timeZone != null && timeZone != "Z") + { + var hours = int.Parse(timeZone.Substring(1, 2)); + var minutes = int.Parse(timeZone.Substring(4, 2)); + + if (timeZone[0] == '-') + { + hours = -hours; + minutes = -minutes; + } + + builder.Offset = new TimeSpan(hours, minutes, 0); + } + + return builder; + } + } + + /* + YYYY # eg 1997 + YYYY-MM # eg 1997-07 + YYYY-MM-DD # eg 1997-07-16 + YYYY-MM-DDThh:mmTZD # eg 1997-07-16T19:20+01:00 + YYYY-MM-DDThh:mm:ssTZD # eg 1997-07-16T19:20:30+01:00 + YYYY-MM-DDThh:mm:ss.sTZD # eg 1997-07-16T19:20:30.45+01:00 + + where: + + YYYY = four-digit year + MM = two-digit month (01=January, etc.) + DD = two-digit day of month (01 through 31) + hh = two digits of hour (00 through 23) (am/pm NOT allowed) + mm = two digits of minute (00 through 59) + ss = two digits of second (00 through 59) + s = one or more digits representing a decimal fraction of a second + TZD = time zone designator (Z or +hh:mm or -hh:mm) + */ +} diff --git a/src/Peering/generated/runtime/JsonType.cs b/src/Peering/generated/runtime/JsonType.cs new file mode 100644 index 000000000000..9f9f391d0c53 --- /dev/null +++ b/src/Peering/generated/runtime/JsonType.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal enum JsonType + { + Null = 0, + Object = 1, + Array = 2, + Binary = 3, + Boolean = 4, + Date = 5, + Number = 6, + String = 7 + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/MessageAttribute.cs b/src/Peering/generated/runtime/MessageAttribute.cs new file mode 100644 index 000000000000..b53c69204539 --- /dev/null +++ b/src/Peering/generated/runtime/MessageAttribute.cs @@ -0,0 +1,360 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using System.Text; + + [AttributeUsage(AttributeTargets.All)] + public class GenericBreakingChangeAttribute : Attribute + { + private string _message; + //A dexcription of what the change is about, non mandatory + public string ChangeDescription { get; set; } = null; + + //The version the change is effective from, non mandatory + public string DeprecateByVersion { get; } + public bool DeprecateByVersionSet { get; } = false; + + //The date on which the change comes in effect + public DateTime ChangeInEfectByDate { get; } + public bool ChangeInEfectByDateSet { get; } = false; + + //Old way of calling the cmdlet + public string OldWay { get; set; } + //New way fo calling the cmdlet + public string NewWay { get; set; } + + public GenericBreakingChangeAttribute(string message) + { + _message = message; + } + + public GenericBreakingChangeAttribute(string message, string deprecateByVersion) + { + _message = message; + this.DeprecateByVersion = deprecateByVersion; + this.DeprecateByVersionSet = true; + } + + public GenericBreakingChangeAttribute(string message, string deprecateByVersion, string changeInEfectByDate) + { + _message = message; + this.DeprecateByVersion = deprecateByVersion; + this.DeprecateByVersionSet = true; + + if (DateTime.TryParse(changeInEfectByDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.ChangeInEfectByDate = result; + this.ChangeInEfectByDateSet = true; + } + } + + public DateTime getInEffectByDate() + { + return this.ChangeInEfectByDate.Date; + } + + + /** + * This function prints out the breaking change message for the attribute on the cmdline + * */ + public void PrintCustomAttributeInfo(Action writeOutput) + { + + if (!GetAttributeSpecificMessage().StartsWith(Environment.NewLine)) + { + writeOutput(Environment.NewLine); + } + writeOutput(string.Format(Resources.BreakingChangesAttributesDeclarationMessage, GetAttributeSpecificMessage())); + + + if (!string.IsNullOrWhiteSpace(ChangeDescription)) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesChangeDescriptionMessage, this.ChangeDescription)); + } + + if (ChangeInEfectByDateSet) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByDateMessage, this.ChangeInEfectByDate.ToString("d"))); + } + + if (DeprecateByVersionSet) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); + } + + if (OldWay != null && NewWay != null) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesUsageChangeMessageConsole, OldWay, NewWay)); + } + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + + protected virtual string GetAttributeSpecificMessage() + { + return _message; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class CmdletBreakingChangeAttribute : GenericBreakingChangeAttribute + { + + public string ReplacementCmdletName { get; set; } + + public CmdletBreakingChangeAttribute() : + base(string.Empty) + { + } + + public CmdletBreakingChangeAttribute(string deprecateByVersione) : + base(string.Empty, deprecateByVersione) + { + } + + public CmdletBreakingChangeAttribute(string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByVersion, changeInEfectByDate) + { + } + + protected override string GetAttributeSpecificMessage() + { + if (string.IsNullOrWhiteSpace(ReplacementCmdletName)) + { + return Resources.BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement; + } + else + { + return string.Format(Resources.BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement, ReplacementCmdletName); + } + } + } + + [AttributeUsage(AttributeTargets.All)] + public class ParameterSetBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string[] ChangedParameterSet { set; get; } + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet) : + base(string.Empty) + { + ChangedParameterSet = changedParameterSet; + } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByVersione) : + base(string.Empty, deprecateByVersione) + { + ChangedParameterSet = changedParameterSet; + } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByVersion, changeInEfectByDate) + { + ChangedParameterSet = changedParameterSet; + } + + protected override string GetAttributeSpecificMessage() + { + + return Resources.BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement; + + } + + public bool IsApplicableToInvocation(InvocationInfo invocation, string parameterSetName) + { + if (ChangedParameterSet != null) + return ChangedParameterSet.Contains(parameterSetName); + return false; + } + + } + + [AttributeUsage(AttributeTargets.All)] + public class PreviewMessageAttribute : Attribute + { + public string _message; + + public PreviewMessageAttribute() + { + this._message = Resources.PreviewCmdletMessage; + } + + public PreviewMessageAttribute(string message) + { + this._message = message; + } + + public void PrintCustomAttributeInfo(System.Management.Automation.PSCmdlet psCmdlet) + { + psCmdlet.WriteWarning(this._message); + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class ParameterBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string NameOfParameterChanging { get; } + + public string ReplaceMentCmdletParameterName { get; set; } = null; + + public bool IsBecomingMandatory { get; set; } = false; + + public String OldParamaterType { get; set; } + + public String NewParameterType { get; set; } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging) : + base(string.Empty) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByVersion) : + base(string.Empty, deprecateByVersion) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByVersion, changeInEfectByDate) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + if (!string.IsNullOrWhiteSpace(ReplaceMentCmdletParameterName)) + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplacedMandatory, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplaced, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + } + else + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterMandatoryNow, NameOfParameterChanging)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterChanging, NameOfParameterChanging)); + } + } + + //See if the type of the param is changing + if (OldParamaterType != null && !string.IsNullOrWhiteSpace(NewParameterType)) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterTypeChange, OldParamaterType, NewParameterType)); + } + return message.ToString(); + } + + /// + /// See if the bound parameters contain the current parameter, if they do + /// then the attribbute is applicable + /// If the invocationInfo is null we return true + /// + /// + /// bool + public override bool IsApplicableToInvocation(InvocationInfo invocationInfo) + { + bool? applicable = invocationInfo == null ? true : invocationInfo.BoundParameters?.Keys?.Contains(this.NameOfParameterChanging); + return applicable.HasValue ? applicable.Value : false; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class OutputBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string DeprecatedCmdLetOutputType { get; } + + //This is still a String instead of a Type as this + //might be undefined at the time of adding the attribute + public string ReplacementCmdletOutputType { get; set; } + + public string[] DeprecatedOutputProperties { get; set; } + + public string[] NewOutputProperties { get; set; } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType) : + base(string.Empty) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByVersion) : + base(string.Empty, deprecateByVersion) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByVersion, changeInEfectByDate) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + + //check for the deprecation scenario + if (string.IsNullOrWhiteSpace(ReplacementCmdletOutputType) && NewOutputProperties == null && DeprecatedOutputProperties == null && string.IsNullOrWhiteSpace(ChangeDescription)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputTypeDeprecated, DeprecatedCmdLetOutputType)); + } + else + { + if (!string.IsNullOrWhiteSpace(ReplacementCmdletOutputType)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange1, DeprecatedCmdLetOutputType, ReplacementCmdletOutputType)); + } + else + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange2, DeprecatedCmdLetOutputType)); + } + + if (DeprecatedOutputProperties != null && DeprecatedOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesRemoved); + foreach (string property in DeprecatedOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + + if (NewOutputProperties != null && NewOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesAdded); + foreach (string property in NewOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + } + return message.ToString(); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/MessageAttributeHelper.cs b/src/Peering/generated/runtime/MessageAttributeHelper.cs new file mode 100644 index 000000000000..7b0f9b8f5ed7 --- /dev/null +++ b/src/Peering/generated/runtime/MessageAttributeHelper.cs @@ -0,0 +1,161 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// 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. +// ---------------------------------------------------------------------------------- +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.Peering.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Reflection; + using System.Text; + using System.Threading.Tasks; + public class MessageAttributeHelper + { + public const string BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK = "https://aka.ms/azps-changewarnings"; + public const string SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME = "SuppressAzurePowerShellBreakingChangeWarnings"; + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And reads all the deprecation attributes attached to it + * Prints a message on the cmdline For each of the attribute found + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + * */ + public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { + bool supressWarningOrError = false; + + try + { + supressWarningOrError = bool.Parse(System.Environment.GetEnvironmentVariable(SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME)); + } + catch (Exception) + { + //no action + } + + if (supressWarningOrError) + { + //Do not process the attributes at runtime... The env variable to override the warning messages is set + return; + } + + List attributes = new List(GetAllBreakingChangeAttributesInType(commandInfo, invocationInfo, parameterSet)); + StringBuilder sb = new StringBuilder(); + Action appendBreakingChangeInfo = (string s) => sb.Append(s); + + if (attributes != null && attributes.Count > 0) + { + appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); + + foreach (GenericBreakingChangeAttribute attribute in attributes) + { + attribute.PrintCustomAttributeInfo(appendBreakingChangeInfo); + } + + appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); + + psCmdlet.WriteWarning(sb.ToString()); + } + + List previewAttributes = new List(GetAllPreviewAttributesInType(commandInfo, invocationInfo)); + + if (previewAttributes != null && previewAttributes.Count > 0) + { + foreach (PreviewMessageAttribute attribute in previewAttributes) + { + attribute.PrintCustomAttributeInfo(psCmdlet); + } + } + } + + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And returns all the deprecation attributes attached to it + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + **/ + private static IEnumerable GetAllBreakingChangeAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet) + { + List attributeList = new List(); + + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.GetType() == typeof(ParameterSetBreakingChangeAttribute) ? ((ParameterSetBreakingChangeAttribute)e).IsApplicableToInvocation(invocationInfo, parameterSet) : e.IsApplicableToInvocation(invocationInfo)); + } + private static IEnumerable GetAllPreviewAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + List attributeList = new List(); + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.IsApplicableToInvocation(invocationInfo)); + } + } +} diff --git a/src/Peering/generated/runtime/Method.cs b/src/Peering/generated/runtime/Method.cs new file mode 100644 index 000000000000..5b61d1fdd766 --- /dev/null +++ b/src/Peering/generated/runtime/Method.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + internal static class Method + { + internal static System.Net.Http.HttpMethod Get = System.Net.Http.HttpMethod.Get; + internal static System.Net.Http.HttpMethod Put = System.Net.Http.HttpMethod.Put; + internal static System.Net.Http.HttpMethod Head = System.Net.Http.HttpMethod.Head; + internal static System.Net.Http.HttpMethod Post = System.Net.Http.HttpMethod.Post; + internal static System.Net.Http.HttpMethod Delete = System.Net.Http.HttpMethod.Delete; + internal static System.Net.Http.HttpMethod Options = System.Net.Http.HttpMethod.Options; + internal static System.Net.Http.HttpMethod Trace = System.Net.Http.HttpMethod.Trace; + internal static System.Net.Http.HttpMethod Patch = new System.Net.Http.HttpMethod("PATCH"); + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Models/JsonMember.cs b/src/Peering/generated/runtime/Models/JsonMember.cs new file mode 100644 index 000000000000..8a0a20a0d399 --- /dev/null +++ b/src/Peering/generated/runtime/Models/JsonMember.cs @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; +using System.Runtime.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + + + internal sealed class JsonMember + { + private readonly TypeDetails type; + + private readonly Func getter; + private readonly Action setter; + + internal JsonMember(PropertyInfo property, int defaultOrder) + { + getter = property.GetValue; + setter = property.SetValue; + + var dataMember = property.GetCustomAttribute(); + + Name = dataMember?.Name ?? property.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(property.PropertyType); + + CanRead = property.CanRead; + } + + internal JsonMember(FieldInfo field, int defaultOrder) + { + getter = field.GetValue; + setter = field.SetValue; + + var dataMember = field.GetCustomAttribute(); + + Name = dataMember?.Name ?? field.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(field.FieldType); + + CanRead = true; + } + + internal string Name { get; } + + internal int Order { get; } + + internal TypeDetails TypeDetails => type; + + internal Type Type => type.NonNullType; + + internal bool IsList => type.IsList; + + // Arrays, Sets, ... + internal Type ElementType => type.ElementType; + + internal IJsonConverter Converter => type.JsonConverter; + + internal bool EmitDefaultValue { get; } + + internal bool IsStringLike => type.IsStringLike; + + internal object DefaultValue => type.DefaultValue; + + internal bool CanRead { get; } + + #region Helpers + + internal object GetValue(object instance) => getter(instance); + + internal void SetValue(object instance, object value) => setter(instance, value); + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Models/JsonModel.cs b/src/Peering/generated/runtime/Models/JsonModel.cs new file mode 100644 index 000000000000..f84cc17c2756 --- /dev/null +++ b/src/Peering/generated/runtime/Models/JsonModel.cs @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal class JsonModel + { + private Dictionary map; + private readonly object _sync = new object(); + + private JsonModel(Type type, List members) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + Members = members ?? throw new ArgumentNullException(nameof(members)); + } + + internal string Name => Type.Name; + + internal Type Type { get; } + + internal List Members { get; } + + internal JsonMember this[string name] + { + get + { + if (map == null) + { + lock (_sync) + { + if (map == null) + { + map = new Dictionary(); + + foreach (JsonMember m in Members) + { + map[m.Name.ToLower()] = m; + } + } + } + } + + + map.TryGetValue(name.ToLower(), out JsonMember member); + + return member; + } + } + + internal static JsonModel FromType(Type type) + { + var members = new List(); + + int i = 0; + + // BindingFlags.Instance | BindingFlags.Public + + foreach (var member in type.GetFields()) + { + if (member.IsStatic) continue; + + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + foreach (var member in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + members.Sort((a, b) => a.Order.CompareTo(b.Order)); // inline sort + + return new JsonModel(type, members); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Models/JsonModelCache.cs b/src/Peering/generated/runtime/Models/JsonModelCache.cs new file mode 100644 index 000000000000..c75173d1addf --- /dev/null +++ b/src/Peering/generated/runtime/Models/JsonModelCache.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Runtime.CompilerServices; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal static class JsonModelCache + { + private static readonly ConditionalWeakTable cache + = new ConditionalWeakTable(); + + internal static JsonModel Get(Type type) => cache.GetValue(type, Create); + + private static JsonModel Create(Type type) => JsonModel.FromType(type); + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/Collections/JsonArray.cs b/src/Peering/generated/runtime/Nodes/Collections/JsonArray.cs new file mode 100644 index 000000000000..8f18b6d7fc1e --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/Collections/JsonArray.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public abstract partial class JsonArray : JsonNode, IEnumerable + { + internal override JsonType Type => JsonType.Array; + + internal abstract JsonType? ElementType { get; } + + public abstract int Count { get; } + + internal virtual bool IsSet => false; + + internal bool IsEmpty => Count == 0; + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region Static Helpers + + internal static JsonArray Create(short[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(int[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(long[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(decimal[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(float[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(string[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(XBinary[] values) + => new XImmutableArray(values); + + #endregion + + internal static new JsonArray Parse(string text) + => (JsonArray)JsonNode.Parse(text); + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/Collections/XImmutableArray.cs b/src/Peering/generated/runtime/Nodes/Collections/XImmutableArray.cs new file mode 100644 index 000000000000..cb93c53b6db1 --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/Collections/XImmutableArray.cs @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal sealed class XImmutableArray : JsonArray, IEnumerable + { + private readonly T[] values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XImmutableArray(T[] values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Length; + + public bool IsReadOnly => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + #region Static Constructor + + internal XImmutableArray Create(T[] items) + { + return new XImmutableArray(items); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/Collections/XList.cs b/src/Peering/generated/runtime/Nodes/Collections/XList.cs new file mode 100644 index 000000000000..9331b1a8c4a0 --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/Collections/XList.cs @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal sealed class XList : JsonArray, IEnumerable + { + private readonly IList values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XList(IList values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Count; + + public bool IsReadOnly => values.IsReadOnly; + + #region IList + + public void Add(T value) + { + values.Add(value); + } + + public bool Contains(T value) => values.Contains(value); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/Collections/XNodeArray.cs b/src/Peering/generated/runtime/Nodes/Collections/XNodeArray.cs new file mode 100644 index 000000000000..70efd843d6bc --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed partial class XNodeArray : JsonArray, ICollection + { + private readonly List items; + + internal XNodeArray() + { + items = new List(); + } + + internal XNodeArray(params JsonNode[] values) + { + items = new List(values); + } + + public override JsonNode this[int index] => items[index]; + + internal override JsonType? ElementType => null; + + public bool IsReadOnly => false; + + public override int Count => items.Count; + + #region ICollection Members + + public void Add(JsonNode item) + { + items.Add(item); + } + + void ICollection.Clear() + { + items.Clear(); + } + + public bool Contains(JsonNode item) => items.Contains(item); + + void ICollection.CopyTo(JsonNode[] array, int arrayIndex) + { + items.CopyTo(array, arrayIndex); + } + + public bool Remove(JsonNode item) + { + return items.Remove(item); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/Collections/XSet.cs b/src/Peering/generated/runtime/Nodes/Collections/XSet.cs new file mode 100644 index 000000000000..7490b5370183 --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/Collections/XSet.cs @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal sealed class XSet : JsonArray, IEnumerable + { + private readonly HashSet values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XSet(IEnumerable values) + : this(new HashSet(values)) + { } + + internal XSet(HashSet values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + internal override JsonType Type => JsonType.Array; + + internal override JsonType? ElementType => elementType; + + public bool IsReadOnly => true; + + public override int Count => values.Count; + + internal override bool IsSet => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + internal HashSet AsHashSet() => values; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/JsonBoolean.cs b/src/Peering/generated/runtime/Nodes/JsonBoolean.cs new file mode 100644 index 000000000000..0be71abff6ac --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/JsonBoolean.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal sealed partial class JsonBoolean : JsonNode + { + internal static readonly JsonBoolean True = new JsonBoolean(true); + internal static readonly JsonBoolean False = new JsonBoolean(false); + + internal JsonBoolean(bool value) + { + Value = value; + } + + internal bool Value { get; } + + internal override JsonType Type => JsonType.Boolean; + + internal static new JsonBoolean Parse(string text) + { + switch (text) + { + case "false": return False; + case "true": return True; + + default: throw new ArgumentException($"Expected true or false. Was {text}."); + } + } + + #region Implicit Casts + + public static implicit operator bool(JsonBoolean data) => data.Value; + + public static implicit operator JsonBoolean(bool data) => new JsonBoolean(data); + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/JsonDate.cs b/src/Peering/generated/runtime/Nodes/JsonDate.cs new file mode 100644 index 000000000000..acc2b9ef0e99 --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/JsonDate.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + + + internal sealed partial class JsonDate : JsonNode, IEquatable, IComparable + { + internal static bool AssumeUtcWhenKindIsUnspecified = true; + + private readonly DateTimeOffset value; + + internal JsonDate(DateTime value) + { + if (value.Kind == DateTimeKind.Unspecified && AssumeUtcWhenKindIsUnspecified) + { + value = DateTime.SpecifyKind(value, DateTimeKind.Utc); + } + + this.value = value; + } + + internal JsonDate(DateTimeOffset value) + { + this.value = value; + } + + internal override JsonType Type => JsonType.Date; + + #region Helpers + + internal DateTimeOffset ToDateTimeOffset() + { + return value; + } + + internal DateTime ToDateTime() + { + if (value.Offset == TimeSpan.Zero) + { + return value.UtcDateTime; + } + + return value.DateTime; + } + + internal DateTime ToUtcDateTime() => value.UtcDateTime; + + internal int ToUnixTimeSeconds() + { + return (int)value.ToUnixTimeSeconds(); + } + + internal long ToUnixTimeMilliseconds() + { + return (int)value.ToUnixTimeMilliseconds(); + } + + internal string ToIsoString() + { + return IsoDate.FromDateTimeOffset(value).ToString(); + } + + #endregion + + public override string ToString() + { + return ToIsoString(); + } + + internal static new JsonDate Parse(string text) + { + if (text == null) throw new ArgumentNullException(nameof(text)); + + // TODO support: unixtimeseconds.partialseconds + + if (text.Length > 4 && _IsNumber(text)) // UnixTime + { + var date = DateTimeOffset.FromUnixTimeSeconds(long.Parse(text)); + + return new JsonDate(date); + } + else if (text.Length <= 4 || text[4] == '-') // ISO: 2012- + { + return new JsonDate(IsoDate.Parse(text).ToDateTimeOffset()); + } + else + { + // NOT ISO ENCODED + // "Thu, 5 Apr 2012 16:59:01 +0200", + return new JsonDate(DateTimeOffset.Parse(text)); + } + } + + private static bool _IsNumber(string text) + { + foreach (var c in text) + { + if (!char.IsDigit(c)) return false; + } + + return true; + } + + internal static JsonDate FromUnixTime(int seconds) + { + return new JsonDate(DateTimeOffset.FromUnixTimeSeconds(seconds)); + } + + internal static JsonDate FromUnixTime(double seconds) + { + var milliseconds = (long)(seconds * 1000d); + + return new JsonDate(DateTimeOffset.FromUnixTimeMilliseconds(milliseconds)); + } + + #region Implicit Casts + + public static implicit operator DateTimeOffset(JsonDate value) + => value.ToDateTimeOffset(); + + public static implicit operator DateTime(JsonDate value) + => value.ToDateTime(); + + // From Date + public static implicit operator JsonDate(DateTimeOffset value) + { + return new JsonDate(value); + } + + public static implicit operator JsonDate(DateTime value) + { + return new JsonDate(value); + } + + // From String + public static implicit operator JsonDate(string value) + { + return Parse(value); + } + + #endregion + + #region Equality + + public override bool Equals(object obj) + { + return obj is JsonDate date && date.value == this.value; + } + + public bool Equals(JsonDate other) + { + return this.value == other.value; + } + + public override int GetHashCode() => value.GetHashCode(); + + #endregion + + #region IComparable Members + + int IComparable.CompareTo(JsonDate other) + { + return value.CompareTo(other.value); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/JsonNode.cs b/src/Peering/generated/runtime/Nodes/JsonNode.cs new file mode 100644 index 000000000000..c916aed70d7c --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/JsonNode.cs @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + + + public abstract partial class JsonNode + { + internal abstract JsonType Type { get; } + + public virtual JsonNode this[int index] => throw new NotImplementedException(); + + public virtual JsonNode this[string name] + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #region Type Helpers + + internal bool IsArray => Type == JsonType.Array; + + internal bool IsDate => Type == JsonType.Date; + + internal bool IsObject => Type == JsonType.Object; + + internal bool IsNumber => Type == JsonType.Number; + + internal bool IsNull => Type == JsonType.Null; + + #endregion + + internal void WriteTo(TextWriter textWriter, bool pretty = true) + { + var writer = new JsonWriter(textWriter, pretty); + + writer.WriteNode(this); + } + + internal T As() + where T : new() + => new JsonSerializer().Deseralize((JsonObject)this); + + internal T[] ToArrayOf() + { + return (T[])new JsonSerializer().DeserializeArray(typeof(T[]), (JsonArray)this); + } + + #region ToString Overrides + + public override string ToString() => ToString(pretty: true); + + internal string ToString(bool pretty) + { + var sb = new StringBuilder(); + + using (var writer = new StringWriter(sb)) + { + WriteTo(writer, pretty); + + return sb.ToString(); + } + } + + #endregion + + #region Static Constructors + + internal static JsonNode Parse(string text) + { + return Parse(new SourceReader(new StringReader(text))); + } + + internal static JsonNode Parse(TextReader textReader) + => Parse(new SourceReader(textReader)); + + private static JsonNode Parse(SourceReader sourceReader) + { + using (var parser = new JsonParser(sourceReader)) + { + return parser.ReadNode(); + } + } + + internal static JsonNode FromObject(object instance) + => new JsonSerializer().Serialize(instance); + + #endregion + + #region Implict Casts + + public static implicit operator string(JsonNode node) => node.ToString(); + + #endregion + + #region Explict Casts + + public static explicit operator DateTime(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date: + return ((JsonDate)node).ToDateTime(); + + case JsonType.String: + return JsonDate.Parse(node.ToString()).ToDateTime(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime; + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)).UtcDateTime; + } + } + + throw new ConversionException(node, typeof(DateTime)); + } + + public static explicit operator DateTimeOffset(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date : return ((JsonDate)node).ToDateTimeOffset(); + case JsonType.String : return JsonDate.Parse(node.ToString()).ToDateTimeOffset(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num); + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)); + } + + } + + throw new ConversionException(node, typeof(DateTimeOffset)); + } + + public static explicit operator float(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return float.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(float)); + } + + public static explicit operator double(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return double.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(double)); + } + + public static explicit operator decimal(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return decimal.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(decimal)); + } + + public static explicit operator Guid(JsonNode node) + => new Guid(node.ToString()); + + public static explicit operator short(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return short.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(short)); + } + + public static explicit operator int(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return int.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(int)); + } + + public static explicit operator long(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return long.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(long)); + } + + public static explicit operator bool(JsonNode node) + => ((JsonBoolean)node).Value; + + public static explicit operator ushort(JsonNode node) + => (JsonNumber)node; + + public static explicit operator uint(JsonNode node) + => (JsonNumber)node; + + public static explicit operator ulong(JsonNode node) + => (JsonNumber)node; + + public static explicit operator TimeSpan(JsonNode node) + => TimeSpan.Parse(node.ToString()); + + public static explicit operator Uri(JsonNode node) + { + if (node.Type == JsonType.String) + { + return new Uri(node.ToString()); + } + + throw new ConversionException(node, typeof(Uri)); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/JsonNumber.cs b/src/Peering/generated/runtime/Nodes/JsonNumber.cs new file mode 100644 index 000000000000..f269ca7d0de0 --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/JsonNumber.cs @@ -0,0 +1,109 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed partial class JsonNumber : JsonNode + { + private readonly string value; + private readonly bool overflows = false; + + internal JsonNumber(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal JsonNumber(int value) + { + this.value = value.ToString(); + } + + internal JsonNumber(long value) + { + this.value = value.ToString(); + + if (value > 9007199254740991) + { + overflows = true; + } + } + + internal JsonNumber(float value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal JsonNumber(double value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal override JsonType Type => JsonType.Number; + + internal string Value => value; + + #region Helpers + + internal bool Overflows => overflows; + + internal bool IsInteger => !value.Contains("."); + + internal bool IsFloat => value.Contains("."); + + #endregion + + #region Casting + + public static implicit operator byte(JsonNumber number) + => byte.Parse(number.Value); + + public static implicit operator short(JsonNumber number) + => short.Parse(number.Value); + + public static implicit operator int(JsonNumber number) + => int.Parse(number.Value); + + public static implicit operator long(JsonNumber number) + => long.Parse(number.value); + + public static implicit operator UInt16(JsonNumber number) + => ushort.Parse(number.Value); + + public static implicit operator UInt32(JsonNumber number) + => uint.Parse(number.Value); + + public static implicit operator UInt64(JsonNumber number) + => ulong.Parse(number.Value); + + public static implicit operator decimal(JsonNumber number) + => decimal.Parse(number.Value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator Double(JsonNumber number) + => double.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator float(JsonNumber number) + => float.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator JsonNumber(short data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(int data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(long data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(Single data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(double data) + => new JsonNumber(data.ToString()); + + #endregion + + public override string ToString() => value; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/JsonObject.cs b/src/Peering/generated/runtime/Nodes/JsonObject.cs new file mode 100644 index 000000000000..d7fb84b55564 --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/JsonObject.cs @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public partial class JsonObject : JsonNode, IDictionary + { + private readonly Dictionary items; + + internal JsonObject() + { + items = new Dictionary(); + } + + internal JsonObject(IEnumerable> properties) + { + if (properties == null) throw new ArgumentNullException(nameof(properties)); + + items = new Dictionary(); + + foreach (var field in properties) + { + items.Add(field.Key, field.Value); + } + } + + #region IDictionary Constructors + + internal JsonObject(IDictionary dic) + { + items = new Dictionary(dic.Count); + + foreach (var pair in dic) + { + Add(pair.Key, pair.Value); + } + } + + #endregion + + internal override JsonType Type => JsonType.Object; + + #region Add Overloads + + public void Add(string name, JsonNode value) => + items.Add(name, value); + + public void Add(string name, byte[] value) => + items.Add(name, new XBinary(value)); + + public void Add(string name, DateTime value) => + items.Add(name, new JsonDate(value)); + + public void Add(string name, int value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, long value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, float value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, double value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, string value) => + items.Add(name, new JsonString(value)); + + public void Add(string name, bool value) => + items.Add(name, new JsonBoolean(value)); + + public void Add(string name, Uri url) => + items.Add(name, new JsonString(url.AbsoluteUri)); + + public void Add(string name, string[] values) => + items.Add(name, new XImmutableArray(values)); + + public void Add(string name, int[] values) => + items.Add(name, new XImmutableArray(values)); + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + items.Add(item.Key, item.Value); + } + + void ICollection>.Clear() + { + items.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) => + throw new NotImplementedException(); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => + throw new NotImplementedException(); + + + int ICollection>.Count => items.Count; + + bool ICollection>.IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) => + throw new NotImplementedException(); + + #endregion + + #region IDictionary Members + + public bool ContainsKey(string key) => items.ContainsKey(key); + + public ICollection Keys => items.Keys; + + public bool Remove(string key) => items.Remove(key); + + public bool TryGetValue(string key, out JsonNode value) => + items.TryGetValue(key, out value); + + public ICollection Values => items.Values; + + public override JsonNode this[string key] + { + get => items[key]; + set => items[key] = value; + } + + #endregion + + #region IEnumerable + + IEnumerator> IEnumerable>.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + + #region Helpers + + internal static new JsonObject FromObject(object instance) => + (JsonObject)new JsonSerializer().Serialize(instance); + + #endregion + + #region Static Constructors + + internal static JsonObject FromStream(Stream stream) + { + using (var tr = new StreamReader(stream)) + { + return (JsonObject)Parse(tr); + } + } + + internal static new JsonObject Parse(string text) + { + return (JsonObject)JsonNode.Parse(text); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/JsonString.cs b/src/Peering/generated/runtime/Nodes/JsonString.cs new file mode 100644 index 000000000000..cb5c975b9169 --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/JsonString.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed partial class JsonString : JsonNode, IEquatable + { + private readonly string value; + + internal JsonString(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal override JsonType Type => JsonType.String; + + internal string Value => value; + + internal int Length => value.Length; + + #region #region Implicit Casts + + public static implicit operator string(JsonString data) => data.Value; + + public static implicit operator JsonString(string value) => new JsonString(value); + + #endregion + + public override int GetHashCode() => value.GetHashCode(); + + public override string ToString() => value; + + #region IEquatable + + bool IEquatable.Equals(JsonString other) => this.Value == other.Value; + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/XBinary.cs b/src/Peering/generated/runtime/Nodes/XBinary.cs new file mode 100644 index 000000000000..45cc19d1a185 --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/XBinary.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal sealed class XBinary : JsonNode + { + private readonly byte[] _value; + private readonly string _base64; + + internal XBinary(byte[] value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal XBinary(string base64EncodedString) + { + _base64 = base64EncodedString ?? throw new ArgumentNullException(nameof(base64EncodedString)); + } + + internal override JsonType Type => JsonType.Binary; + + internal byte[] Value => _value ?? Convert.FromBase64String(_base64); + + #region #region Implicit Casts + + public static implicit operator byte[] (XBinary data) => data.Value; + + public static implicit operator XBinary(byte[] data) => new XBinary(data); + + #endregion + + public override int GetHashCode() => Value.GetHashCode(); + + public override string ToString() => _base64 ?? Convert.ToBase64String(_value); + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Nodes/XNull.cs b/src/Peering/generated/runtime/Nodes/XNull.cs new file mode 100644 index 000000000000..159afa187d9f --- /dev/null +++ b/src/Peering/generated/runtime/Nodes/XNull.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal sealed class XNull : JsonNode + { + internal static readonly XNull Instance = new XNull(); + + private XNull() { } + + internal override JsonType Type => JsonType.Null; + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Parser/Exceptions/ParseException.cs b/src/Peering/generated/runtime/Parser/Exceptions/ParseException.cs new file mode 100644 index 000000000000..ca9909a50700 --- /dev/null +++ b/src/Peering/generated/runtime/Parser/Exceptions/ParseException.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal class ParserException : Exception + { + internal ParserException(string message) + : base(message) + { } + + internal ParserException(string message, SourceLocation location) + : base(message) + { + + Location = location; + } + + internal SourceLocation Location { get; } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Parser/JsonParser.cs b/src/Peering/generated/runtime/Parser/JsonParser.cs new file mode 100644 index 000000000000..58e845937f14 --- /dev/null +++ b/src/Peering/generated/runtime/Parser/JsonParser.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public class JsonParser : IDisposable + { + private readonly TokenReader reader; + + internal JsonParser(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonParser(SourceReader sourceReader) + { + if (sourceReader == null) + throw new ArgumentNullException(nameof(sourceReader)); + + this.reader = new TokenReader(new JsonTokenizer(sourceReader)); + + this.reader.Next(); // Start with the first token + } + + internal IEnumerable ReadNodes() + { + JsonNode node; + + while ((node = ReadNode()) != null) yield return node; + } + + internal JsonNode ReadNode() + { + if (reader.Current.Kind == TokenKind.Eof || reader.Current.IsTerminator) + { + return null; + } + + switch (reader.Current.Kind) + { + case TokenKind.LeftBrace : return ReadObject(); // { + case TokenKind.LeftBracket : return ReadArray(); // [ + + default: throw new ParserException($"Expected '{{' or '['. Was {reader.Current}."); + } + } + + private JsonNode ReadFieldValue() + { + // Boolean, Date, Null, Number, String, Uri + if (reader.Current.IsLiteral) + { + return ReadLiteral(); + } + else + { + switch (reader.Current.Kind) + { + case TokenKind.LeftBracket: return ReadArray(); + case TokenKind.LeftBrace : return ReadObject(); + + default: throw new ParserException($"Unexpected token reading field value. Was {reader.Current}."); + } + } + } + + private JsonNode ReadLiteral() + { + var literal = reader.Current; + + reader.Next(); // Read the literal token + + switch (literal.Kind) + { + case TokenKind.Boolean : return JsonBoolean.Parse(literal.Value); + case TokenKind.Null : return XNull.Instance; + case TokenKind.Number : return new JsonNumber(literal.Value); + case TokenKind.String : return new JsonString(literal.Value); + + default: throw new ParserException($"Unexpected token reading literal. Was {literal}."); + } + } + + internal JsonObject ReadObject() + { + reader.Ensure(TokenKind.LeftBrace, "object"); + + reader.Next(); // Read '{' (Object start) + + var jsonObject = new JsonObject(); + + // Read the object's fields until we reach the end of the object ('}') + while (reader.Current.Kind != TokenKind.RightBrace) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read ',' (Seperator) + } + + // Ensure we have a field name + reader.Ensure(TokenKind.String, "Expected field name"); + + var field = ReadField(); + + jsonObject.Add(field.Key, field.Value); + } + + reader.Next(); // Read '}' (Object end) + + return jsonObject; + } + + + // TODO: Use ValueTuple in C#7 + private KeyValuePair ReadField() + { + var fieldName = reader.Current.Value; + + reader.Next(); // Read the field name + + reader.Ensure(TokenKind.Colon, "field"); + + reader.Next(); // Read ':' (Field value indicator) + + return new KeyValuePair(fieldName, ReadFieldValue()); + } + + + internal JsonArray ReadArray() + { + reader.Ensure(TokenKind.LeftBracket, "array"); + + var array = new XNodeArray(); + + reader.Next(); // Read the '[' (Array start) + + // Read the array's items + while (reader.Current.Kind != TokenKind.RightBracket) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read the ',' (Seperator) + } + + if (reader.Current.IsLiteral) + { + array.Add(ReadLiteral()); // Boolean, Date, Number, Null, String, Uri + } + else if (reader.Current.Kind == TokenKind.LeftBracket) + { + array.Add(ReadArray()); // Array + } + else if (reader.Current.Kind == TokenKind.LeftBrace) + { + array.Add(ReadObject()); // Object + } + else + { + throw new ParserException($"Expected comma, literal, or object. Was {reader.Current}."); + } + } + + reader.Next(); // Read the ']' (Array end) + + return array; + } + + #region IDisposable + + public void Dispose() + { + reader.Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Parser/JsonToken.cs b/src/Peering/generated/runtime/Parser/JsonToken.cs new file mode 100644 index 000000000000..d6f4e0d0e83f --- /dev/null +++ b/src/Peering/generated/runtime/Parser/JsonToken.cs @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal enum TokenKind + { + LeftBrace, // { Object start + RightBrace, // } Object end + + LeftBracket, // [ Array start + RightBracket, // ] Array end + + Comma, // , Comma + Colon, // : Value indicator + Dot, // . Access field indicator + Terminator, // \0 Stream terminator + + Boolean = 31, // true or false + Null = 33, // null + Number = 34, // i.e. -1.93, -1, 0, 1, 1.1 + String = 35, // i.e. "text" + + Eof = 50 + } + + internal /* readonly */ struct JsonToken + { + internal static readonly JsonToken BraceOpen = new JsonToken(TokenKind.LeftBrace, "{"); + internal static readonly JsonToken BraceClose = new JsonToken(TokenKind.RightBrace, "}"); + + internal static readonly JsonToken BracketOpen = new JsonToken(TokenKind.LeftBracket, "["); + internal static readonly JsonToken BracketClose = new JsonToken(TokenKind.RightBracket, "]"); + + internal static readonly JsonToken Colon = new JsonToken(TokenKind.Colon, ":"); + internal static readonly JsonToken Comma = new JsonToken(TokenKind.Comma, ","); + internal static readonly JsonToken Terminator = new JsonToken(TokenKind.Terminator, "\0"); + + internal static readonly JsonToken True = new JsonToken(TokenKind.Boolean, "true"); + internal static readonly JsonToken False = new JsonToken(TokenKind.Boolean, "false"); + internal static readonly JsonToken Null = new JsonToken(TokenKind.Null, "null"); + + internal static readonly JsonToken Eof = new JsonToken(TokenKind.Eof, null); + + internal JsonToken(TokenKind kind, string value) + { + Kind = kind; + Value = value; + } + + internal readonly TokenKind Kind; + + internal readonly string Value; + + public override string ToString() => Kind + ": " + Value; + + #region Helpers + + internal bool IsLiteral => (byte)Kind > 30 && (byte)Kind < 40; + + internal bool IsTerminator => Kind == TokenKind.Terminator; + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Parser/JsonTokenizer.cs b/src/Peering/generated/runtime/Parser/JsonTokenizer.cs new file mode 100644 index 000000000000..e0a81516c6c2 --- /dev/null +++ b/src/Peering/generated/runtime/Parser/JsonTokenizer.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + using System.IO; + + + public class JsonTokenizer : IDisposable + { + private readonly StringBuilder sb = new StringBuilder(); + + private readonly SourceReader reader; + + internal JsonTokenizer(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonTokenizer(SourceReader reader) + { + this.reader = reader; + + reader.Next(); // Start with the first char + } + + internal JsonToken ReadNext() + { + reader.SkipWhitespace(); + + if (reader.IsEof) return JsonToken.Eof; + + switch (reader.Current) + { + case '"': return ReadQuotedString(); + + // Symbols + case '[' : reader.Next(); return JsonToken.BracketOpen; // Array start + case ']' : reader.Next(); return JsonToken.BracketClose; // Array end + case ',' : reader.Next(); return JsonToken.Comma; // Value seperator + case ':' : reader.Next(); return JsonToken.Colon; // Field value indicator + case '{' : reader.Next(); return JsonToken.BraceOpen; // Object start + case '}' : reader.Next(); return JsonToken.BraceClose; // Object end + case '\0' : reader.Next(); return JsonToken.Terminator; // Stream terminiator + + default: return ReadLiteral(); + } + } + + private JsonToken ReadQuotedString() + { + Expect('"', "quoted string indicator"); + + reader.Next(); // Read '"' (Starting quote) + + // Read until we reach an unescaped quote char + while (reader.Current != '"') + { + EnsureNotEof("quoted string"); + + if (reader.Current == '\\') + { + char escapedCharacter = reader.ReadEscapeCode(); + + sb.Append(escapedCharacter); + + continue; + } + + StoreCurrentCharacterAndReadNext(); + } + + reader.Next(); // Read '"' (Ending quote) + + return new JsonToken(TokenKind.String, value: sb.Extract()); + } + + private JsonToken ReadLiteral() + { + if (char.IsDigit(reader.Current) || + reader.Current == '-' || + reader.Current == '+') + { + return ReadNumber(); + } + + return ReadIdentifer(); + } + + private JsonToken ReadNumber() + { + // Read until we hit a non-numeric character + // -6.247737e-06 + // E + + while (char.IsDigit(reader.Current) + || reader.Current == '.' + || reader.Current == 'e' + || reader.Current == 'E' + || reader.Current == '-' + || reader.Current == '+') + { + StoreCurrentCharacterAndReadNext(); + } + + return new JsonToken(TokenKind.Number, value: sb.Extract()); + } + + int count = 0; + + private JsonToken ReadIdentifer() + { + count++; + + if (!char.IsLetter(reader.Current)) + { + throw new ParserException( + message : $"Expected literal (number, boolean, or null). Was '{reader.Current}'.", + location : reader.Location + ); + } + + // Read letters, numbers, and underscores '_' + while (char.IsLetterOrDigit(reader.Current) || reader.Current == '_') + { + StoreCurrentCharacterAndReadNext(); + } + + string text = sb.Extract(); + + switch (text) + { + case "true": return JsonToken.True; + case "false": return JsonToken.False; + case "null": return JsonToken.Null; + + default: return new JsonToken(TokenKind.String, text); + } + } + + private void Expect(char character, string description) + { + if (reader.Current != character) + { + throw new ParserException( + message: $"Expected {description} ('{character}'). Was '{reader.Current}'.", + location: reader.Location + ); + } + } + + private void EnsureNotEof(string tokenType) + { + if (reader.IsEof) + { + throw new ParserException( + message: $"Unexpected EOF while reading {tokenType}.", + location: reader.Location + ); + } + } + + private void StoreCurrentCharacterAndReadNext() + { + sb.Append(reader.Current); + + reader.Next(); + } + + public void Dispose() + { + reader.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Parser/Location.cs b/src/Peering/generated/runtime/Parser/Location.cs new file mode 100644 index 000000000000..74c11b3cf830 --- /dev/null +++ b/src/Peering/generated/runtime/Parser/Location.cs @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal struct SourceLocation + { + private int line; + private int column; + private int position; + + internal SourceLocation(int line = 0, int column = 0, int position = 0) + { + this.line = line; + this.column = column; + this.position = position; + } + + internal int Line => line; + + internal int Column => column; + + internal int Position => position; + + internal void Advance() + { + this.column++; + this.position++; + } + + internal void MarkNewLine() + { + this.line++; + this.column = 0; + } + + internal SourceLocation Clone() + { + return new SourceLocation(line, column, position); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Parser/Readers/SourceReader.cs b/src/Peering/generated/runtime/Parser/Readers/SourceReader.cs new file mode 100644 index 000000000000..21e6ac0dc06f --- /dev/null +++ b/src/Peering/generated/runtime/Parser/Readers/SourceReader.cs @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Globalization; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public sealed class SourceReader : IDisposable + { + private readonly TextReader source; + + private char current; + + private readonly SourceLocation location = new SourceLocation(); + + private bool isEof = false; + + internal SourceReader(TextReader textReader) + { + this.source = textReader ?? throw new ArgumentNullException(nameof(textReader)); + } + + /// + /// Advances to the next character + /// + internal void Next() + { + // Advance to the new line when we see a new line '\n'. + // A new line may be prefixed by a carriage return '\r'. + + if (current == '\n') + { + location.MarkNewLine(); + } + + int charCode = source.Read(); // -1 for end + + if (charCode >= 0) + { + current = (char)charCode; + } + else + { + // If we've already marked this as the EOF, throw an exception + if (isEof) + { + throw new EndOfStreamException("Cannot advance past end of stream."); + } + + isEof = true; + + current = '\0'; + } + + location.Advance(); + } + + internal void SkipWhitespace() + { + while (char.IsWhiteSpace(current)) + { + Next(); + } + } + + internal char ReadEscapeCode() + { + Next(); + + char escapedChar = current; + + Next(); // Consume escaped character + + switch (escapedChar) + { + // Special escape codes + case '"': return '"'; // " (Quotation mark) U+0022 + case '/': return '/'; // / (Solidus) U+002F + case '\\': return '\\'; // \ (Reverse solidus) U+005C + + // Control Characters + case '0': return '\0'; // Nul (0) U+0000 + case 'a': return '\a'; // Alert (7) + case 'b': return '\b'; // Backspace (8) U+0008 + case 'f': return '\f'; // Form feed (12) U+000C + case 'n': return '\n'; // Line feed (10) U+000A + case 'r': return '\r'; // Carriage return (13) U+000D + case 't': return '\t'; // Horizontal tab (9) U+0009 + case 'v': return '\v'; // Vertical tab + + // Unicode escape sequence + case 'u': return ReadUnicodeEscapeSequence(); // U+XXXX + + default: throw new Exception($"Unrecognized escape sequence '\\{escapedChar}'"); + } + } + + private readonly char[] hexCode = new char[4]; + + private char ReadUnicodeEscapeSequence() + { + hexCode[0] = current; Next(); + hexCode[1] = current; Next(); + hexCode[2] = current; Next(); + hexCode[3] = current; Next(); + + return Convert.ToChar(int.Parse( + s : new string(hexCode), + style : NumberStyles.HexNumber, + provider: NumberFormatInfo.InvariantInfo + )); + } + + internal char Current => current; + + internal bool IsEof => isEof; + + internal char Peek() => (char)source.Peek(); + + internal SourceLocation Location => location; + + public void Dispose() + { + source.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Parser/TokenReader.cs b/src/Peering/generated/runtime/Parser/TokenReader.cs new file mode 100644 index 000000000000..7b415f56afd2 --- /dev/null +++ b/src/Peering/generated/runtime/Parser/TokenReader.cs @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + public class TokenReader : IDisposable + { + private readonly JsonTokenizer tokenizer; + private JsonToken current; + + internal TokenReader(JsonTokenizer tokenizer) + { + this.tokenizer = tokenizer ?? throw new ArgumentNullException(nameof(tokenizer)); + } + + internal void Next() + { + current = tokenizer.ReadNext(); + } + + internal JsonToken Current => current; + + internal void Ensure(TokenKind kind, string readerName) + { + if (current.Kind != kind) + { + throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}."); + } + } + + public void Dispose() + { + tokenizer.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/PipelineMocking.cs b/src/Peering/generated/runtime/PipelineMocking.cs new file mode 100644 index 000000000000..d2c71ac55cb9 --- /dev/null +++ b/src/Peering/generated/runtime/PipelineMocking.cs @@ -0,0 +1,262 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using System.Threading.Tasks; + using System.Collections.Generic; + using System.Net.Http; + using System.Linq; + using System.Net; + using Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json; + + public enum MockMode + { + Live, + Record, + Playback, + + } + + public class PipelineMock + { + + private System.Collections.Generic.Stack scenario = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack context = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack description = new System.Collections.Generic.Stack(); + + private readonly string recordingPath; + private int counter = 0; + + public static implicit operator Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep(PipelineMock instance) => instance.SendAsync; + + public MockMode Mode { get; set; } = MockMode.Live; + public PipelineMock(string recordingPath) + { + this.recordingPath = recordingPath; + } + + public void PushContext(string text) => context.Push(text); + + public void PushDescription(string text) => description.Push(text); + + + public void PushScenario(string it) + { + // reset counter too + counter = 0; + + scenario.Push(it); + } + + public void PopContext() => context.Pop(); + + public void PopDescription() => description.Pop(); + + public void PopScenario() => scenario.Pop(); + + public void SetRecord() => Mode = MockMode.Record; + + public void SetPlayback() => Mode = MockMode.Playback; + + public void SetLive() => Mode = MockMode.Live; + + public string Scenario => (scenario.Count > 0 ? scenario.Peek() : "[NoScenario]"); + public string Description => (description.Count > 0 ? description.Peek() : "[NoDescription]"); + public string Context => (context.Count > 0 ? context.Peek() : "[NoContext]"); + + /// + /// Headers that we substitute out blank values for in the recordings + /// Add additional headers as necessary + /// + public static HashSet Blacklist = new HashSet(System.StringComparer.CurrentCultureIgnoreCase) { + "Authorization", + }; + + public Dictionary ForceResponseHeaders = new Dictionary(); + + internal static XImmutableArray Removed = new XImmutableArray(new string[] { "[Filtered]" }); + + internal static IEnumerable> FilterHeaders(IEnumerable>> headers) => headers.Select(header => new KeyValuePair(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray(header.Value.ToArray()))); + + internal static JsonNode SerializeContent(HttpContent content, ref bool isBase64) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result, ref isBase64); + + internal static JsonNode SerializeContent(byte[] content, ref bool isBase64) + { + if (null == content || content.Length == 0) + { + return XNull.Instance; + } + var first = content[0]; + var last = content[content.Length - 1]; + + // plaintext for JSON/SGML/XML/HTML/STRINGS/ARRAYS + if ((first == '{' && last == '}') || (first == '<' && last == '>') || (first == '[' && last == ']') || (first == '"' && last == '"')) + { + return new JsonString(System.Text.Encoding.UTF8.GetString(content)); + } + + // base64 for everyone else + return new JsonString(System.Convert.ToBase64String(content)); + } + + internal static byte[] DeserializeContent(string content, bool isBase64) + { + if (string.IsNullOrWhiteSpace(content)) + { + return new byte[0]; + } + + if (isBase64) + { + try + { + return System.Convert.FromBase64String(content); + } + catch + { + // hmm. didn't work, return it as a string I guess. + } + } + return System.Text.Encoding.UTF8.GetBytes(content); + } + + public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response) + { + var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject(); + bool isBase64Request = false; + bool isBase64Response = false; + messages[rqKey] = new JsonObject { + { "Request",new JsonObject { + { "Method", request.Method.Method }, + { "RequestUri", request.RequestUri }, + { "Content", SerializeContent( request.Content, ref isBase64Request) }, + { "isContentBase64", isBase64Request }, + { "Headers", new JsonObject(FilterHeaders(request.Headers)) }, + { "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))} + } }, + {"Response", new JsonObject { + { "StatusCode", (int)response.StatusCode}, + { "Headers", new JsonObject(FilterHeaders(response.Headers))}, + { "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))}, + { "Content", SerializeContent(response.Content, ref isBase64Response) }, + { "isContentBase64", isBase64Response }, + }} + }; + System.IO.File.WriteAllText(this.recordingPath, messages.ToString()); + } + + private JsonObject Load() + { + if (System.IO.File.Exists(this.recordingPath)) + { + try + { + return JsonObject.FromStream(System.IO.File.OpenRead(this.recordingPath)); + } + catch + { + throw new System.Exception($"Invalid recording file: '{recordingPath}'"); + } + } + + throw new System.ArgumentException($"Missing recording file: '{recordingPath}'", nameof(recordingPath)); + } + + public HttpResponseMessage LoadMessage(string rqKey) + { + var responses = Load(); + var message = responses.Property(rqKey); + + if (null == message) + { + throw new System.ArgumentException($"Missing Request '{rqKey}' in recording file", nameof(rqKey)); + } + + var sc = 0; + var reqMessage = message.Property("Request"); + var respMessage = message.Property("Response"); + + // --------------------------- deserialize response ---------------------------------------------------------------- + bool isBase64Response = false; + respMessage.BooleanProperty("isContentBase64", ref isBase64Response); + var response = new HttpResponseMessage + { + StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"), isBase64Response)) + }; + + foreach (var each in respMessage.Property("Headers")) + { + response.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + foreach (var frh in ForceResponseHeaders) + { + response.Headers.Remove(frh.Key); + response.Headers.TryAddWithoutValidation(frh.Key, frh.Value); + } + + foreach (var each in respMessage.Property("ContentHeaders")) + { + response.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + // --------------------------- deserialize request ---------------------------------------------------------------- + bool isBase64Request = false; + reqMessage.BooleanProperty("isContentBase64", ref isBase64Request); + response.RequestMessage = new HttpRequestMessage + { + Method = new HttpMethod(reqMessage.StringProperty("Method")), + RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"), isBase64Request)) + }; + + foreach (var each in reqMessage.Property("Headers")) + { + response.RequestMessage.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + foreach (var each in reqMessage.Property("ContentHeaders")) + { + response.RequestMessage.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + return response; + } + + public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + counter++; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + + switch (Mode) + { + case MockMode.Record: + //Add following code since the request.Content will be released after sendAsync + var requestClone = request; + if (requestClone.Content != null) + { + requestClone = await request.CloneWithContent(request.RequestUri, request.Method); + } + // make the call + var response = await next.SendAsync(request, callback); + + // save the message to the recording file + SaveMessage(rqkey, requestClone, response); + + // return the response. + return response; + + case MockMode.Playback: + // load and return the response. + return LoadMessage(rqkey); + + default: + // pass-thru, do nothing + return await next.SendAsync(request, callback); + } + } + } +} diff --git a/src/Peering/generated/runtime/Properties/Resources.Designer.cs b/src/Peering/generated/runtime/Properties/Resources.Designer.cs new file mode 100644 index 000000000000..b5a454c0d779 --- /dev/null +++ b/src/Peering/generated/runtime/Properties/Resources.Designer.cs @@ -0,0 +1,5633 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.generated.runtime.Properties +{ + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.PowerShell.Cmdlets.Peering.generated.runtime.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to The remote server returned an error: (401) Unauthorized.. + /// + public static string AccessDeniedExceptionMessage + { + get + { + return ResourceManager.GetString("AccessDeniedExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account id doesn't match one in subscription.. + /// + public static string AccountIdDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("AccountIdDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account needs to be specified. + /// + public static string AccountNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("AccountNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account "{0}" has been added.. + /// + public static string AddAccountAdded + { + get + { + return ResourceManager.GetString("AddAccountAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To switch to a different subscription, please use Select-AzureSubscription.. + /// + public static string AddAccountChangeSubscription + { + get + { + return ResourceManager.GetString("AddAccountChangeSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential".. + /// + public static string AddAccountNonInteractiveGuestOrFpo + { + get + { + return ResourceManager.GetString("AddAccountNonInteractiveGuestOrFpo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription "{0}" is selected as the default subscription.. + /// + public static string AddAccountShowDefaultSubscription + { + get + { + return ResourceManager.GetString("AddAccountShowDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To view all the subscriptions, please use Get-AzureSubscription.. + /// + public static string AddAccountViewSubscriptions + { + get + { + return ResourceManager.GetString("AddAccountViewSubscriptions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is created successfully.. + /// + public static string AddOnCreatedMessage + { + get + { + return ResourceManager.GetString("AddOnCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on name {0} is already used.. + /// + public static string AddOnNameAlreadyUsed + { + get + { + return ResourceManager.GetString("AddOnNameAlreadyUsed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} not found.. + /// + public static string AddOnNotFound + { + get + { + return ResourceManager.GetString("AddOnNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on {0} is removed successfully.. + /// + public static string AddOnRemovedMessage + { + get + { + return ResourceManager.GetString("AddOnRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is updated successfully.. + /// + public static string AddOnUpdatedMessage + { + get + { + return ResourceManager.GetString("AddOnUpdatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}.. + /// + public static string AddRoleMessageCreate + { + get + { + return ResourceManager.GetString("AddRoleMessageCreate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’.. + /// + public static string AddRoleMessageCreateNode + { + get + { + return ResourceManager.GetString("AddRoleMessageCreateNode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure".. + /// + public static string AddRoleMessageCreatePHP + { + get + { + return ResourceManager.GetString("AddRoleMessageCreatePHP", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator. + /// + public static string AddRoleMessageInsufficientPermissions + { + get + { + return ResourceManager.GetString("AddRoleMessageInsufficientPermissions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A role name '{0}' already exists. + /// + public static string AddRoleMessageRoleExists + { + get + { + return ResourceManager.GetString("AddRoleMessageRoleExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} already has an endpoint with name {1}. + /// + public static string AddTrafficManagerEndpointFailed + { + get + { + return ResourceManager.GetString("AddTrafficManagerEndpointFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. + ///Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable [rest of string was truncated]";. + /// + public static string ARMDataCollectionMessage + { + get + { + return ResourceManager.GetString("ARMDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Authenticating for account {0} with single tenant {1}.. + /// + public static string AuthenticatingForSingleTenant + { + get + { + return ResourceManager.GetString("AuthenticatingForSingleTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Windows Azure Powershell\. + /// + public static string AzureDirectory + { + get + { + return ResourceManager.GetString("AzureDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://manage.windowsazure.com. + /// + public static string AzurePortalUrl + { + get + { + return ResourceManager.GetString("AzurePortalUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PORTAL_URL. + /// + public static string AzurePortalUrlEnv + { + get + { + return ResourceManager.GetString("AzurePortalUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Selected profile must not be null.. + /// + public static string AzureProfileMustNotBeNull + { + get + { + return ResourceManager.GetString("AzureProfileMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure SDK\{0}\. + /// + public static string AzureSdkDirectory + { + get + { + return ResourceManager.GetString("AzureSdkDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscArchiveAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscArchiveAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find configuration data file: {0}. + /// + public static string AzureVMDscCannotFindConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscCannotFindConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Create Archive. + /// + public static string AzureVMDscCreateArchiveAction + { + get + { + return ResourceManager.GetString("AzureVMDscCreateArchiveAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The configuration data must be a .psd1 file. + /// + public static string AzureVMDscInvalidConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscInvalidConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parsing configuration script: {0}. + /// + public static string AzureVMDscParsingConfiguration + { + get + { + return ResourceManager.GetString("AzureVMDscParsingConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscStorageBlobAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscStorageBlobAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upload '{0}'. + /// + public static string AzureVMDscUploadToBlobStorageAction + { + get + { + return ResourceManager.GetString("AzureVMDscUploadToBlobStorageAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Execution failed because a background thread could not prompt the user.. + /// + public static string BaseShouldMethodFailureReason + { + get + { + return ResourceManager.GetString("BaseShouldMethodFailureReason", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Base Uri was empty.. + /// + public static string BaseUriEmpty + { + get + { + return ResourceManager.GetString("BaseUriEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing without ParameterSet.. + /// + public static string BeginProcessingWithoutParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithoutParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing with ParameterSet '{1}'.. + /// + public static string BeginProcessingWithParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Blob with the name {0} already exists in the account.. + /// + public static string BlobAlreadyExistsInTheAccount + { + get + { + return ResourceManager.GetString("BlobAlreadyExistsInTheAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}.blob.core.windows.net/. + /// + public static string BlobEndpointUri + { + get + { + return ResourceManager.GetString("BlobEndpointUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_BLOBSTORAGE_TEMPLATE. + /// + public static string BlobEndpointUriEnv + { + get + { + return ResourceManager.GetString("BlobEndpointUriEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is changing.. + /// + public static string BreakingChangeAttributeParameterChanging + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterChanging", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is becoming mandatory.. + /// + public static string BreakingChangeAttributeParameterMandatoryNow + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterMandatoryNow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplaced + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplaced", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by mandatory parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplacedMandatory + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplacedMandatory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The type of the parameter is changing from '{0}' to '{1}'.. + /// + public static string BreakingChangeAttributeParameterTypeChange + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterTypeChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Change description : {0} + ///. + /// + public static string BreakingChangesAttributesChangeDescriptionMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesChangeDescriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet '{0}' is replacing this cmdlet.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type is changing from the existing type :'{0}' to the new type :'{1}'. + /// + public static string BreakingChangesAttributesCmdLetOutputChange1 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "The output type '{0}' is changing". + /// + public static string BreakingChangesAttributesCmdLetOutputChange2 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + ///- The following properties are being added to the output type : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesAdded + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + /// - The following properties in the output type are being deprecated : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesRemoved + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesRemoved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type '{0}' is being deprecated without a replacement.. + /// + public static string BreakingChangesAttributesCmdLetOutputTypeDeprecated + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputTypeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - {0} + /// + ///. + /// + public static string BreakingChangesAttributesDeclarationMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - Cmdlet : '{0}' + /// - {1} + ///. + /// + public static string BreakingChangesAttributesDeclarationMessageWithCmdletName + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessageWithCmdletName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NOTE : Go to {0} for steps to suppress (and other related information on) the breaking change messages.. + /// + public static string BreakingChangesAttributesFooterMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesFooterMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Breaking changes in the cmdlet '{0}' :. + /// + public static string BreakingChangesAttributesHeaderMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesHeaderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note : This change will take effect on '{0}' + ///. + /// + public static string BreakingChangesAttributesInEffectByDateMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByDateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from the version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ```powershell + ///# Old + ///{0} + /// + ///# New + ///{1} + ///``` + /// + ///. + /// + public static string BreakingChangesAttributesUsageChangeMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cmdlet invocation changes : + /// Old Way : {0} + /// New Way : {1}. + /// + public static string BreakingChangesAttributesUsageChangeMessageConsole + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessageConsole", resourceCulture); + } + } + + /// + /// The cmdlet is in experimental stage. The function may not be enabled in current subscription. + /// + public static string ExperimentalCmdletMessage + { + get + { + return ResourceManager.GetString("ExperimentalCmdletMessage", resourceCulture); + } + } + + + + /// + /// Looks up a localized string similar to CACHERUNTIMEURL. + /// + public static string CacheRuntimeUrl + { + get + { + return ResourceManager.GetString("CacheRuntimeUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cache. + /// + public static string CacheRuntimeValue + { + get + { + return ResourceManager.GetString("CacheRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CacheRuntimeVersion. + /// + public static string CacheRuntimeVersionKey + { + get + { + return ResourceManager.GetString("CacheRuntimeVersionKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}). + /// + public static string CacheVersionWarningText + { + get + { + return ResourceManager.GetString("CacheVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot change built-in environment {0}.. + /// + public static string CannotChangeBuiltinEnvironment + { + get + { + return ResourceManager.GetString("CannotChangeBuiltinEnvironment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find {0} with name {1}.. + /// + public static string CannotFind + { + get + { + return ResourceManager.GetString("CannotFind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment for service {0} with {1} slot doesn't exist. + /// + public static string CannotFindDeployment + { + get + { + return ResourceManager.GetString("CannotFindDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Can't find valid Microsoft Azure role in current directory {0}. + /// + public static string CannotFindRole + { + get + { + return ResourceManager.GetString("CannotFindRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist. + /// + public static string CannotFindServiceConfigurationFile + { + get + { + return ResourceManager.GetString("CannotFindServiceConfigurationFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders.. + /// + public static string CannotFindServiceRoot + { + get + { + return ResourceManager.GetString("CannotFindServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated.. + /// + public static string CannotUpdateUnknownSubscription + { + get + { + return ResourceManager.GetString("CannotUpdateUnknownSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ManagementCertificate. + /// + public static string CertificateElementName + { + get + { + return ResourceManager.GetString("CertificateElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to certificate.pfx. + /// + public static string CertificateFileName + { + get + { + return ResourceManager.GetString("CertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate imported into CurrentUser\My\{0}. + /// + public static string CertificateImportedMessage + { + get + { + return ResourceManager.GetString("CertificateImportedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No certificate was found in the certificate store with thumbprint {0}. + /// + public static string CertificateNotFoundInStore + { + get + { + return ResourceManager.GetString("CertificateNotFoundInStore", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your account does not have access to the private key for certificate {0}. + /// + public static string CertificatePrivateKeyAccessError + { + get + { + return ResourceManager.GetString("CertificatePrivateKeyAccessError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} {1} deployment for {2} service. + /// + public static string ChangeDeploymentStateWaitMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStateWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cloud service {0} is in {1} state.. + /// + public static string ChangeDeploymentStatusCompleteMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStatusCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing/Removing public environment '{0}' is not allowed.. + /// + public static string ChangePublicEnvironmentMessage + { + get + { + return ResourceManager.GetString("ChangePublicEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} is set to value {1}. + /// + public static string ChangeSettingsElementMessage + { + get + { + return ResourceManager.GetString("ChangeSettingsElementMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing public environment is not supported.. + /// + public static string ChangingDefaultEnvironmentNotSupported + { + get + { + return ResourceManager.GetString("ChangingDefaultEnvironmentNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose which publish settings file to use:. + /// + public static string ChoosePublishSettingsFile + { + get + { + return ResourceManager.GetString("ChoosePublishSettingsFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel. + /// + public static string ClientDiagnosticLevelName + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string ClientDiagnosticLevelValue + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cloud_package.cspkg. + /// + public static string CloudPackageFileName + { + get + { + return ResourceManager.GetString("CloudPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Cloud.cscfg. + /// + public static string CloudServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("CloudServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-ons for {0}. + /// + public static string CloudServiceDescription + { + get + { + return ResourceManager.GetString("CloudServiceDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive.. + /// + public static string CommunicationCouldNotBeEstablished + { + get + { + return ResourceManager.GetString("CommunicationCouldNotBeEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete. + /// + public static string CompleteMessage + { + get + { + return ResourceManager.GetString("CompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OperationID : '{0}'. + /// + public static string ComputeCloudExceptionOperationIdMessage + { + get + { + return ResourceManager.GetString("ComputeCloudExceptionOperationIdMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to config.json. + /// + public static string ConfigurationFileName + { + get + { + return ResourceManager.GetString("ConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VirtualMachine creation failed.. + /// + public static string CreateFailedErrorMessage + { + get + { + return ResourceManager.GetString("CreateFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead.. + /// + public static string CreateWebsiteFailed + { + get + { + return ResourceManager.GetString("CreateWebsiteFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core. + /// + public static string DataCacheClientsType + { + get + { + return ResourceManager.GetString("DataCacheClientsType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //blobcontainer[@datacenter='{0}']. + /// + public static string DatacenterBlobQuery + { + get + { + return ResourceManager.GetString("DatacenterBlobQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure PowerShell Data Collection Confirmation. + /// + public static string DataCollectionActivity + { + get + { + return ResourceManager.GetString("DataCollectionActivity", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose not to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmNo + { + get + { + return ResourceManager.GetString("DataCollectionConfirmNo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This confirmation message will be dismissed in '{0}' second(s).... + /// + public static string DataCollectionConfirmTime + { + get + { + return ResourceManager.GetString("DataCollectionConfirmTime", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmYes + { + get + { + return ResourceManager.GetString("DataCollectionConfirmYes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The setting profile has been saved to the following path '{0}'.. + /// + public static string DataCollectionSaveFileInformation + { + get + { + return ResourceManager.GetString("DataCollectionSaveFileInformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription. + /// + public static string DefaultAndCurrentSubscription + { + get + { + return ResourceManager.GetString("DefaultAndCurrentSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to none. + /// + public static string DefaultFileVersion + { + get + { + return ResourceManager.GetString("DefaultFileVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There are no hostnames which could be used for validation.. + /// + public static string DefaultHostnamesValidation + { + get + { + return ResourceManager.GetString("DefaultHostnamesValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 8080. + /// + public static string DefaultPort + { + get + { + return ResourceManager.GetString("DefaultPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string DefaultRoleCachingInMB + { + get + { + return ResourceManager.GetString("DefaultRoleCachingInMB", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auto. + /// + public static string DefaultUpgradeMode + { + get + { + return ResourceManager.GetString("DefaultUpgradeMode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 80. + /// + public static string DefaultWebPort + { + get + { + return ResourceManager.GetString("DefaultWebPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Delete. + /// + public static string Delete + { + get + { + return ResourceManager.GetString("Delete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for service {1} is already in {2} state. + /// + public static string DeploymentAlreadyInState + { + get + { + return ResourceManager.GetString("DeploymentAlreadyInState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment in {0} slot for service {1} is removed. + /// + public static string DeploymentRemovedMessage + { + get + { + return ResourceManager.GetString("DeploymentRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel. + /// + public static string DiagnosticLevelName + { + get + { + return ResourceManager.GetString("DiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string DiagnosticLevelValue + { + get + { + return ResourceManager.GetString("DiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The key to add already exists in the dictionary.. + /// + public static string DictionaryAddAlreadyContainsKey + { + get + { + return ResourceManager.GetString("DictionaryAddAlreadyContainsKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The array index cannot be less than zero.. + /// + public static string DictionaryCopyToArrayIndexLessThanZero + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayIndexLessThanZero", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The supplied array does not have enough room to contain the copied elements.. + /// + public static string DictionaryCopyToArrayTooShort + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayTooShort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided dns {0} doesn't exist. + /// + public static string DnsDoesNotExist + { + get + { + return ResourceManager.GetString("DnsDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure Certificate. + /// + public static string EnableRemoteDesktop_FriendlyCertificateName + { + get + { + return ResourceManager.GetString("EnableRemoteDesktop_FriendlyCertificateName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Endpoint can't be retrieved for storage account. + /// + public static string EndPointNotFoundForBlobStorage + { + get + { + return ResourceManager.GetString("EndPointNotFoundForBlobStorage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} end processing.. + /// + public static string EndProcessingLog + { + get + { + return ResourceManager.GetString("EndProcessingLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet.. + /// + public static string EnvironmentDoesNotSupportActiveDirectory + { + get + { + return ResourceManager.GetString("EnvironmentDoesNotSupportActiveDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment '{0}' already exists.. + /// + public static string EnvironmentExists + { + get + { + return ResourceManager.GetString("EnvironmentExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name doesn't match one in subscription.. + /// + public static string EnvironmentNameDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("EnvironmentNameDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name needs to be specified.. + /// + public static string EnvironmentNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment needs to be specified.. + /// + public static string EnvironmentNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment name '{0}' is not found.. + /// + public static string EnvironmentNotFound + { + get + { + return ResourceManager.GetString("EnvironmentNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to environments.xml. + /// + public static string EnvironmentsFileName + { + get + { + return ResourceManager.GetString("EnvironmentsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error creating VirtualMachine. + /// + public static string ErrorCreatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorCreatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to download available runtimes for location '{0}'. + /// + public static string ErrorRetrievingRuntimesForLocation + { + get + { + return ResourceManager.GetString("ErrorRetrievingRuntimesForLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error updating VirtualMachine. + /// + public static string ErrorUpdatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorUpdatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} failed. Error: {1}, ExceptionDetails: {2}. + /// + public static string FailedJobErrorMessage + { + get + { + return ResourceManager.GetString("FailedJobErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File path is not valid.. + /// + public static string FilePathIsNotValid + { + get + { + return ResourceManager.GetString("FilePathIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The HTTP request was forbidden with client authentication scheme 'Anonymous'.. + /// + public static string FirstPurchaseErrorMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell.. + /// + public static string FirstPurchaseMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation Status:. + /// + public static string GatewayOperationStatus + { + get + { + return ResourceManager.GetString("GatewayOperationStatus", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\General. + /// + public static string GeneralScaffolding + { + get + { + return ResourceManager.GetString("GeneralScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting all available Microsoft Azure Add-Ons, this may take few minutes.... + /// + public static string GetAllAddOnsWaitMessage + { + get + { + return ResourceManager.GetString("GetAllAddOnsWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Name{0}Primary Key{0}Seconday Key. + /// + public static string GetStorageKeysHeader + { + get + { + return ResourceManager.GetString("GetStorageKeysHeader", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Git not found. Please install git and place it in your command line path.. + /// + public static string GitNotFound + { + get + { + return ResourceManager.GetString("GitNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find publish settings. Please run Import-AzurePublishSettingsFile.. + /// + public static string GlobalSettingsManager_Load_PublishSettingsNotFound + { + get + { + return ResourceManager.GetString("GlobalSettingsManager_Load_PublishSettingsNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg end element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoEndWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoEndWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WadCfg start element in the config is not matching the end element.. + /// + public static string IaasDiagnosticsBadConfigNoMatchingWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoMatchingWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode.dll. + /// + public static string IISNodeDll + { + get + { + return ResourceManager.GetString("IISNodeDll", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeEngineKey + { + get + { + return ResourceManager.GetString("IISNodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode-dev\\release\\x64. + /// + public static string IISNodePath + { + get + { + return ResourceManager.GetString("IISNodePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeRuntimeValue + { + get + { + return ResourceManager.GetString("IISNodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}). + /// + public static string IISNodeVersionWarningText + { + get + { + return ResourceManager.GetString("IISNodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Illegal characters in path.. + /// + public static string IllegalPath + { + get + { + return ResourceManager.GetString("IllegalPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. + /// + public static string InternalServerErrorMessage + { + get + { + return ResourceManager.GetString("InternalServerErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot enable memcach protocol on a cache worker role {0}.. + /// + public static string InvalidCacheRoleName + { + get + { + return ResourceManager.GetString("InvalidCacheRoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings. + /// + public static string InvalidCertificate + { + get + { + return ResourceManager.GetString("InvalidCertificate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format.. + /// + public static string InvalidCertificateSingle + { + get + { + return ResourceManager.GetString("InvalidCertificateSingle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided configuration path is invalid or doesn't exist. + /// + public static string InvalidConfigPath + { + get + { + return ResourceManager.GetString("InvalidConfigPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2.. + /// + public static string InvalidCountryNameMessage + { + get + { + return ResourceManager.GetString("InvalidCountryNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription.. + /// + public static string InvalidDefaultSubscription + { + get + { + return ResourceManager.GetString("InvalidDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment with {0} does not exist. + /// + public static string InvalidDeployment + { + get + { + return ResourceManager.GetString("InvalidDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production".. + /// + public static string InvalidDeploymentSlot + { + get + { + return ResourceManager.GetString("InvalidDeploymentSlot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "{0}" is an invalid DNS name for {1}. + /// + public static string InvalidDnsName + { + get + { + return ResourceManager.GetString("InvalidDnsName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service endpoint.. + /// + public static string InvalidEndpoint + { + get + { + return ResourceManager.GetString("InvalidEndpoint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided file in {0} must be have {1} extension. + /// + public static string InvalidFileExtension + { + get + { + return ResourceManager.GetString("InvalidFileExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File {0} has invalid characters. + /// + public static string InvalidFileName + { + get + { + return ResourceManager.GetString("InvalidFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your git publishing credentials using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. On the left side open "Web Sites" + ///2. Click on any website + ///3. Choose "Setup Git Publishing" or "Reset deployment credentials" + ///4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username}. + /// + public static string InvalidGitCredentials + { + get + { + return ResourceManager.GetString("InvalidGitCredentials", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The value {0} provided is not a valid GUID. Please provide a valid GUID.. + /// + public static string InvalidGuid + { + get + { + return ResourceManager.GetString("InvalidGuid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified hostname does not exist. Please specify a valid hostname for the site.. + /// + public static string InvalidHostnameValidation + { + get + { + return ResourceManager.GetString("InvalidHostnameValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances must be greater than or equal 0 and less than or equal 20. + /// + public static string InvalidInstancesCount + { + get + { + return ResourceManager.GetString("InvalidInstancesCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file.. + /// + public static string InvalidJobFile + { + get + { + return ResourceManager.GetString("InvalidJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not download a valid runtime manifest, Please check your internet connection and try again.. + /// + public static string InvalidManifestError + { + get + { + return ResourceManager.GetString("InvalidManifestError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The account {0} was not found. Please specify a valid account name.. + /// + public static string InvalidMediaServicesAccount + { + get + { + return ResourceManager.GetString("InvalidMediaServicesAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided name "{0}" does not match the service bus namespace naming rules.. + /// + public static string InvalidNamespaceName + { + get + { + return ResourceManager.GetString("InvalidNamespaceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path must specify a valid path to an Azure profile.. + /// + public static string InvalidNewProfilePath + { + get + { + return ResourceManager.GetString("InvalidNewProfilePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Value cannot be null. Parameter name: '{0}'. + /// + public static string InvalidNullArgument + { + get + { + return ResourceManager.GetString("InvalidNullArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is invalid or empty. + /// + public static string InvalidOrEmptyArgumentMessage + { + get + { + return ResourceManager.GetString("InvalidOrEmptyArgumentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided package path is invalid or doesn't exist. + /// + public static string InvalidPackagePath + { + get + { + return ResourceManager.GetString("InvalidPackagePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' is an invalid parameter set name.. + /// + public static string InvalidParameterSetName + { + get + { + return ResourceManager.GetString("InvalidParameterSetName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} doesn't exist in {1} or you've not passed valid value for it. + /// + public static string InvalidPath + { + get + { + return ResourceManager.GetString("InvalidPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} has invalid characters. + /// + public static string InvalidPathName + { + get + { + return ResourceManager.GetString("InvalidPathName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token}. + /// + public static string InvalidProfileProperties + { + get + { + return ResourceManager.GetString("InvalidProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile. + /// + public static string InvalidPublishSettingsSchema + { + get + { + return ResourceManager.GetString("InvalidPublishSettingsSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name "{0}" has invalid characters. + /// + public static string InvalidRoleNameMessage + { + get + { + return ResourceManager.GetString("InvalidRoleNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid name for the service root folder is required. + /// + public static string InvalidRootNameMessage + { + get + { + return ResourceManager.GetString("InvalidRootNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is not a recognized runtime type. + /// + public static string InvalidRuntimeError + { + get + { + return ResourceManager.GetString("InvalidRuntimeError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid language is required. + /// + public static string InvalidScaffoldingLanguageArg + { + get + { + return ResourceManager.GetString("InvalidScaffoldingLanguageArg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscription is currently selected. Use Select-Subscription to activate a subscription.. + /// + public static string InvalidSelectedSubscription + { + get + { + return ResourceManager.GetString("InvalidSelectedSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations.. + /// + public static string InvalidServiceBusLocation + { + get + { + return ResourceManager.GetString("InvalidServiceBusLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide a service name or run this command from inside a service project directory.. + /// + public static string InvalidServiceName + { + get + { + return ResourceManager.GetString("InvalidServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must provide valid value for {0}. + /// + public static string InvalidServiceSettingElement + { + get + { + return ResourceManager.GetString("InvalidServiceSettingElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to settings.json is invalid or doesn't exist. + /// + public static string InvalidServiceSettingMessage + { + get + { + return ResourceManager.GetString("InvalidServiceSettingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data.. + /// + public static string InvalidSubscription + { + get + { + return ResourceManager.GetString("InvalidSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscription id {0} is not valid. + /// + public static string InvalidSubscriptionId + { + get + { + return ResourceManager.GetString("InvalidSubscriptionId", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Must specify a non-null subscription name.. + /// + public static string InvalidSubscriptionName + { + get + { + return ResourceManager.GetString("InvalidSubscriptionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet. + /// + public static string InvalidSubscriptionNameMessage + { + get + { + return ResourceManager.GetString("InvalidSubscriptionNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscriptions file {0} has invalid content.. + /// + public static string InvalidSubscriptionsDataSchema + { + get + { + return ResourceManager.GetString("InvalidSubscriptionsDataSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge.. + /// + public static string InvalidVMSize + { + get + { + return ResourceManager.GetString("InvalidVMSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The web job file must have *.zip extension. + /// + public static string InvalidWebJobFile + { + get + { + return ResourceManager.GetString("InvalidWebJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Singleton option works for continuous jobs only.. + /// + public static string InvalidWebJobSingleton + { + get + { + return ResourceManager.GetString("InvalidWebJobSingleton", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The website {0} was not found. Please specify a valid website name.. + /// + public static string InvalidWebsite + { + get + { + return ResourceManager.GetString("InvalidWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No job for id: {0} was found.. + /// + public static string JobNotFound + { + get + { + return ResourceManager.GetString("JobNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to engines. + /// + public static string JsonEnginesSectionName + { + get + { + return ResourceManager.GetString("JsonEnginesSectionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Scaffolding for this language is not yet supported. + /// + public static string LanguageScaffoldingIsNotSupported + { + get + { + return ResourceManager.GetString("LanguageScaffoldingIsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Link already established. + /// + public static string LinkAlreadyEstablished + { + get + { + return ResourceManager.GetString("LinkAlreadyEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to local_package.csx. + /// + public static string LocalPackageFileName + { + get + { + return ResourceManager.GetString("LocalPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Local.cscfg. + /// + public static string LocalServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("LocalServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for {0} deployment for {1} cloud service.... + /// + public static string LookingForDeploymentMessage + { + get + { + return ResourceManager.GetString("LookingForDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for cloud service {0}.... + /// + public static string LookingForServiceMessage + { + get + { + return ResourceManager.GetString("LookingForServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure Long-Running Job. + /// + public static string LROJobName + { + get + { + return ResourceManager.GetString("LROJobName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter.. + /// + public static string LROTaskExceptionMessage + { + get + { + return ResourceManager.GetString("LROTaskExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to managementCertificate.pem. + /// + public static string ManagementCertificateFileName + { + get + { + return ResourceManager.GetString("ManagementCertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ?whr={0}. + /// + public static string ManagementPortalRealmFormat + { + get + { + return ResourceManager.GetString("ManagementPortalRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //baseuri. + /// + public static string ManifestBaseUriQuery + { + get + { + return ResourceManager.GetString("ManifestBaseUriQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to uri. + /// + public static string ManifestBlobUriKey + { + get + { + return ResourceManager.GetString("ManifestBlobUriKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml. + /// + public static string ManifestUri + { + get + { + return ResourceManager.GetString("ManifestUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'.. + /// + public static string MissingCertificateInProfileProperties + { + get + { + return ResourceManager.GetString("MissingCertificateInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'.. + /// + public static string MissingPasswordInProfileProperties + { + get + { + return ResourceManager.GetString("MissingPasswordInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'SubscriptionId'.. + /// + public static string MissingSubscriptionInProfileProperties + { + get + { + return ResourceManager.GetString("MissingSubscriptionInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple Add-Ons found holding name {0}. + /// + public static string MultipleAddOnsFoundMessage + { + get + { + return ResourceManager.GetString("MultipleAddOnsFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername.. + /// + public static string MultiplePublishingUsernames + { + get + { + return ResourceManager.GetString("MultiplePublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The first publish settings file "{0}" is used. If you want to use another file specify the file name.. + /// + public static string MultiplePublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("MultiplePublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.NamedCaches. + /// + public static string NamedCacheSettingName + { + get + { + return ResourceManager.GetString("NamedCacheSettingName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]}. + /// + public static string NamedCacheSettingValue + { + get + { + return ResourceManager.GetString("NamedCacheSettingValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A publishing username is required. Please specify one using the argument PublishingUsername.. + /// + public static string NeedPublishingUsernames + { + get + { + return ResourceManager.GetString("NeedPublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to New Add-On Confirmation. + /// + public static string NewAddOnConformation + { + get + { + return ResourceManager.GetString("NewAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string NewMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names.. + /// + public static string NewNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("NewNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at {0} and (c) agree to sharing my contact information with {2}.. + /// + public static string NewNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service has been created at {0}. + /// + public static string NewServiceCreatedMessage + { + get + { + return ResourceManager.GetString("NewServiceCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No. + /// + public static string No + { + get + { + return ResourceManager.GetString("No", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription.. + /// + public static string NoCachedToken + { + get + { + return ResourceManager.GetString("NoCachedToken", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole.. + /// + public static string NoCacheWorkerRoles + { + get + { + return ResourceManager.GetString("NoCacheWorkerRoles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No clouds available. + /// + public static string NoCloudsAvailable + { + get + { + return ResourceManager.GetString("NoCloudsAvailable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "There is no current context, please log in using Connect-AzAccount.". + /// + public static string NoCurrentContextForDataCmdlet + { + get + { + return ResourceManager.GetString("NoCurrentContextForDataCmdlet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeDirectory + { + get + { + return ResourceManager.GetString("NodeDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeEngineKey + { + get + { + return ResourceManager.GetString("NodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node.exe. + /// + public static string NodeExe + { + get + { + return ResourceManager.GetString("NodeExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name>. + /// + public static string NoDefaultSubscriptionMessage + { + get + { + return ResourceManager.GetString("NoDefaultSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft SDKs\Azure\Nodejs\Nov2011. + /// + public static string NodeModulesPath + { + get + { + return ResourceManager.GetString("NodeModulesPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeProgramFilesFolderName + { + get + { + return ResourceManager.GetString("NodeProgramFilesFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeRuntimeValue + { + get + { + return ResourceManager.GetString("NodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\Node. + /// + public static string NodeScaffolding + { + get + { + return ResourceManager.GetString("NodeScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node. + /// + public static string NodeScaffoldingResources + { + get + { + return ResourceManager.GetString("NodeScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}). + /// + public static string NodeVersionWarningText + { + get + { + return ResourceManager.GetString("NodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No, I do not agree. + /// + public static string NoHint + { + get + { + return ResourceManager.GetString("NoHint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please connect to internet before executing this cmdlet. + /// + public static string NoInternetConnection + { + get + { + return ResourceManager.GetString("NoInternetConnection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <NONE>. + /// + public static string None + { + get + { + return ResourceManager.GetString("None", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No publish settings files with extension *.publishsettings are found in the directory "{0}".. + /// + public static string NoPublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("NoPublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no subscription associated with account {0}.. + /// + public static string NoSubscriptionAddedMessage + { + get + { + return ResourceManager.GetString("NoSubscriptionAddedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount?. + /// + public static string NoSubscriptionFoundForTenant + { + get + { + return ResourceManager.GetString("NoSubscriptionFoundForTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration.. + /// + public static string NotCacheWorkerRole + { + get + { + return ResourceManager.GetString("NotCacheWorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate can't be null.. + /// + public static string NullCertificateMessage + { + get + { + return ResourceManager.GetString("NullCertificateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} could not be null or empty. + /// + public static string NullObjectMessage + { + get + { + return ResourceManager.GetString("NullObjectMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add a null RoleSettings to {0}. + /// + public static string NullRoleSettingsMessage + { + get + { + return ResourceManager.GetString("NullRoleSettingsMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add new role to null service definition. + /// + public static string NullServiceDefinitionMessage + { + get + { + return ResourceManager.GetString("NullServiceDefinitionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The request offer '{0}' is not found.. + /// + public static string OfferNotFoundMessage + { + get + { + return ResourceManager.GetString("OfferNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation "{0}" failed on VM with ID: {1}. + /// + public static string OperationFailedErrorMessage + { + get + { + return ResourceManager.GetString("OperationFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The REST operation failed with message '{0}' and error code '{1}'. + /// + public static string OperationFailedMessage + { + get + { + return ResourceManager.GetString("OperationFailedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state.. + /// + public static string OperationTimedOutOrError + { + get + { + return ResourceManager.GetString("OperationTimedOutOrError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package. + /// + public static string Package + { + get + { + return ResourceManager.GetString("Package", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Package is created at service root path {0}.. + /// + public static string PackageCreated + { + get + { + return ResourceManager.GetString("PackageCreated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {{ + /// "author": "", + /// + /// "name": "{0}", + /// "version": "0.0.0", + /// "dependencies":{{}}, + /// "devDependencies":{{}}, + /// "optionalDependencies": {{}}, + /// "engines": {{ + /// "node": "*", + /// "iisnode": "*" + /// }} + /// + ///}} + ///. + /// + public static string PackageJsonDefaultFile + { + get + { + return ResourceManager.GetString("PackageJsonDefaultFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package.json. + /// + public static string PackageJsonFileName + { + get + { + return ResourceManager.GetString("PackageJsonFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} doesn't exist.. + /// + public static string PathDoesNotExist + { + get + { + return ResourceManager.GetString("PathDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path for {0} doesn't exist in {1}.. + /// + public static string PathDoesNotExistForElement + { + get + { + return ResourceManager.GetString("PathDoesNotExistForElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Peer Asn has to be provided.. + /// + public static string PeerAsnRequired + { + get + { + return ResourceManager.GetString("PeerAsnRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 5.4.0. + /// + public static string PHPDefaultRuntimeVersion + { + get + { + return ResourceManager.GetString("PHPDefaultRuntimeVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to php. + /// + public static string PhpRuntimeValue + { + get + { + return ResourceManager.GetString("PhpRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\PHP. + /// + public static string PHPScaffolding + { + get + { + return ResourceManager.GetString("PHPScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP. + /// + public static string PHPScaffoldingResources + { + get + { + return ResourceManager.GetString("PHPScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}). + /// + public static string PHPVersionWarningText + { + get + { + return ResourceManager.GetString("PHPVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your first web site using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. At the bottom of the page, click on New > Web Site > Quick Create + ///2. Type {0} in the URL field + ///3. Click on "Create Web Site" + ///4. Once the site has been created, click on the site name + ///5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create.. + /// + public static string PortalInstructions + { + get + { + return ResourceManager.GetString("PortalInstructions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git". + /// + public static string PortalInstructionsGit + { + get + { + return ResourceManager.GetString("PortalInstructionsGit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is in preview. The functionality may not be available in the selected subscription. + /// + public static string PreviewCmdletMessage + { + get + { + return ResourceManager.GetString("PreviewCmdletMessage", resourceCulture); + } + } + + + /// + /// Looks up a localized string similar to A value for the Primary Peer Subnet has to be provided.. + /// + public static string PrimaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("PrimaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Promotion code can be used only when updating to a new plan.. + /// + public static string PromotionCodeWithCurrentPlanMessage + { + get + { + return ResourceManager.GetString("PromotionCodeWithCurrentPlanMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service not published at user request.. + /// + public static string PublishAbortedAtUserRequest + { + get + { + return ResourceManager.GetString("PublishAbortedAtUserRequest", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete.. + /// + public static string PublishCompleteMessage + { + get + { + return ResourceManager.GetString("PublishCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Connecting.... + /// + public static string PublishConnectingMessage + { + get + { + return ResourceManager.GetString("PublishConnectingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Deployment ID: {0}.. + /// + public static string PublishCreatedDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishCreatedDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created hosted service '{0}'.. + /// + public static string PublishCreatedServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatedServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Website URL: {0}.. + /// + public static string PublishCreatedWebsiteMessage + { + get + { + return ResourceManager.GetString("PublishCreatedWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating.... + /// + public static string PublishCreatingServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatingServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Initializing.... + /// + public static string PublishInitializingMessage + { + get + { + return ResourceManager.GetString("PublishInitializingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to busy. + /// + public static string PublishInstanceStatusBusy + { + get + { + return ResourceManager.GetString("PublishInstanceStatusBusy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to creating the virtual machine. + /// + public static string PublishInstanceStatusCreating + { + get + { + return ResourceManager.GetString("PublishInstanceStatusCreating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Instance {0} of role {1} is {2}.. + /// + public static string PublishInstanceStatusMessage + { + get + { + return ResourceManager.GetString("PublishInstanceStatusMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ready. + /// + public static string PublishInstanceStatusReady + { + get + { + return ResourceManager.GetString("PublishInstanceStatusReady", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing deployment for {0} with Subscription ID: {1}.... + /// + public static string PublishPreparingDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishPreparingDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publishing {0} to Microsoft Azure. This may take several minutes.... + /// + public static string PublishServiceStartMessage + { + get + { + return ResourceManager.GetString("PublishServiceStartMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publish settings. + /// + public static string PublishSettings + { + get + { + return ResourceManager.GetString("PublishSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure. + /// + public static string PublishSettingsElementName + { + get + { + return ResourceManager.GetString("PublishSettingsElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to .PublishSettings. + /// + public static string PublishSettingsFileExtention + { + get + { + return ResourceManager.GetString("PublishSettingsFileExtention", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publishSettings.xml. + /// + public static string PublishSettingsFileName + { + get + { + return ResourceManager.GetString("PublishSettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to &whr={0}. + /// + public static string PublishSettingsFileRealmFormat + { + get + { + return ResourceManager.GetString("PublishSettingsFileRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publish settings imported. + /// + public static string PublishSettingsSetSuccessfully + { + get + { + return ResourceManager.GetString("PublishSettingsSetSuccessfully", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PUBLISHINGPROFILE_URL. + /// + public static string PublishSettingsUrlEnv + { + get + { + return ResourceManager.GetString("PublishSettingsUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting.... + /// + public static string PublishStartingMessage + { + get + { + return ResourceManager.GetString("PublishStartingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upgrading.... + /// + public static string PublishUpgradingMessage + { + get + { + return ResourceManager.GetString("PublishUpgradingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Uploading Package to storage service {0}.... + /// + public static string PublishUploadingPackageMessage + { + get + { + return ResourceManager.GetString("PublishUploadingPackageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Verifying storage account '{0}'.... + /// + public static string PublishVerifyingStorageMessage + { + get + { + return ResourceManager.GetString("PublishVerifyingStorageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionAdditionalContentPathNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionAdditionalContentPathNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration published to {0}. + /// + public static string PublishVMDscExtensionArchiveUploadedMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionArchiveUploadedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyFileVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyFileVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy the module '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyModuleVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyModuleVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1).. + /// + public static string PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleted '{0}'. + /// + public static string PublishVMDscExtensionDeletedFileMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeletedFileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot delete '{0}': {1}. + /// + public static string PublishVMDscExtensionDeleteErrorMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeleteErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionDirectoryNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDirectoryNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot get module for DscResource '{0}'. Possible solutions: + ///1) Specify -ModuleName for Import-DscResource in your configuration. + ///2) Unblock module that contains resource. + ///3) Move Import-DscResource inside Node block. + ///. + /// + public static string PublishVMDscExtensionGetDscResourceFailed + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionGetDscResourceFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to List of required modules: [{0}].. + /// + public static string PublishVMDscExtensionRequiredModulesVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredModulesVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version.. + /// + public static string PublishVMDscExtensionRequiredPsVersion + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredPsVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration script '{0}' contained parse errors: + ///{1}. + /// + public static string PublishVMDscExtensionStorageParserErrors + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionStorageParserErrors", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Temp folder '{0}' created.. + /// + public static string PublishVMDscExtensionTempFolderVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionTempFolderVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip).. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration file '{0}' not found.. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. + ///Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enab [rest of string was truncated]";. + /// + public static string RDFEDataCollectionMessage + { + get + { + return ResourceManager.GetString("RDFEDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Replace current deployment with '{0}' Id ?. + /// + public static string RedeployCommit + { + get + { + return ResourceManager.GetString("RedeployCommit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to regenerate key?. + /// + public static string RegenerateKeyWarning + { + get + { + return ResourceManager.GetString("RegenerateKeyWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Generate new key.. + /// + public static string RegenerateKeyWhatIfMessage + { + get + { + return ResourceManager.GetString("RegenerateKeyWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove account '{0}'?. + /// + public static string RemoveAccountConfirmation + { + get + { + return ResourceManager.GetString("RemoveAccountConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing account. + /// + public static string RemoveAccountMessage + { + get + { + return ResourceManager.GetString("RemoveAccountMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove Add-On Confirmation. + /// + public static string RemoveAddOnConformation + { + get + { + return ResourceManager.GetString("RemoveAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm.. + /// + public static string RemoveAddOnMessage + { + get + { + return ResourceManager.GetString("RemoveAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureBGPPeering Operation failed.. + /// + public static string RemoveAzureBGPPeeringFailed + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Bgp Peering. + /// + public static string RemoveAzureBGPPeeringMessage + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Bgp Peering with Service Key {0}.. + /// + public static string RemoveAzureBGPPeeringSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Bgp Peering with service key '{0}'?. + /// + public static string RemoveAzureBGPPeeringWarning + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit with service key '{0}'?. + /// + public static string RemoveAzureDedicatdCircuitWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatdCircuitWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuit Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuitLink Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitLinkFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circui Link. + /// + public static string RemoveAzureDedicatedCircuitLinkMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1}. + /// + public static string RemoveAzureDedicatedCircuitLinkSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'?. + /// + public static string RemoveAzureDedicatedCircuitLinkWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circuit. + /// + public static string RemoveAzureDedicatedCircuitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit with Service Key {0}.. + /// + public static string RemoveAzureDedicatedCircuitSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing cloud service {0}.... + /// + public static string RemoveAzureServiceWaitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureServiceWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription.. + /// + public static string RemoveDefaultSubscription + { + get + { + return ResourceManager.GetString("RemoveDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing {0} deployment for {1} service. + /// + public static string RemoveDeploymentWaitMessage + { + get + { + return ResourceManager.GetString("RemoveDeploymentWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'?. + /// + public static string RemoveEnvironmentConfirmation + { + get + { + return ResourceManager.GetString("RemoveEnvironmentConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing environment. + /// + public static string RemoveEnvironmentMessage + { + get + { + return ResourceManager.GetString("RemoveEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job collection. + /// + public static string RemoveJobCollectionMessage + { + get + { + return ResourceManager.GetString("RemoveJobCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job collection "{0}". + /// + public static string RemoveJobCollectionWarning + { + get + { + return ResourceManager.GetString("RemoveJobCollectionWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job. + /// + public static string RemoveJobMessage + { + get + { + return ResourceManager.GetString("RemoveJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job "{0}". + /// + public static string RemoveJobWarning + { + get + { + return ResourceManager.GetString("RemoveJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the account?. + /// + public static string RemoveMediaAccountWarning + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account removed.. + /// + public static string RemoveMediaAccountWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription.. + /// + public static string RemoveNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("RemoveNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing old package {0}.... + /// + public static string RemovePackage + { + get + { + return ResourceManager.GetString("RemovePackage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile?. + /// + public static string RemoveProfileConfirmation + { + get + { + return ResourceManager.GetString("RemoveProfileConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile. + /// + public static string RemoveProfileMessage + { + get + { + return ResourceManager.GetString("RemoveProfileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the namespace '{0}'?. + /// + public static string RemoveServiceBusNamespaceConfirmation + { + get + { + return ResourceManager.GetString("RemoveServiceBusNamespaceConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove cloud service?. + /// + public static string RemoveServiceWarning + { + get + { + return ResourceManager.GetString("RemoveServiceWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove cloud service and all it's deployments. + /// + public static string RemoveServiceWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveServiceWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove subscription '{0}'?. + /// + public static string RemoveSubscriptionConfirmation + { + get + { + return ResourceManager.GetString("RemoveSubscriptionConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing subscription. + /// + public static string RemoveSubscriptionMessage + { + get + { + return ResourceManager.GetString("RemoveSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The endpoint {0} cannot be removed from profile {1} because it's not in the profile.. + /// + public static string RemoveTrafficManagerEndpointMissing + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerEndpointMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureTrafficManagerProfile Operation failed.. + /// + public static string RemoveTrafficManagerProfileFailed + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Traffic Manager profile with name {0}.. + /// + public static string RemoveTrafficManagerProfileSucceeded + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Traffic Manager profile "{0}"?. + /// + public static string RemoveTrafficManagerProfileWarning + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the VM '{0}'?. + /// + public static string RemoveVMConfirmationMessage + { + get + { + return ResourceManager.GetString("RemoveVMConfirmationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting VM.. + /// + public static string RemoveVMMessage + { + get + { + return ResourceManager.GetString("RemoveVMMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing WebJob.... + /// + public static string RemoveWebJobMessage + { + get + { + return ResourceManager.GetString("RemoveWebJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove job '{0}'?. + /// + public static string RemoveWebJobWarning + { + get + { + return ResourceManager.GetString("RemoveWebJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing website. + /// + public static string RemoveWebsiteMessage + { + get + { + return ResourceManager.GetString("RemoveWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the website "{0}". + /// + public static string RemoveWebsiteWarning + { + get + { + return ResourceManager.GetString("RemoveWebsiteWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing public environment is not supported.. + /// + public static string RemovingDefaultEnvironmentsNotSupported + { + get + { + return ResourceManager.GetString("RemovingDefaultEnvironmentsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting namespace. + /// + public static string RemovingNamespaceMessage + { + get + { + return ResourceManager.GetString("RemovingNamespaceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Repository is not setup. You need to pass a valid site name.. + /// + public static string RepositoryNotSetup + { + get + { + return ResourceManager.GetString("RepositoryNotSetup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use.. + /// + public static string ReservedIPNameNoLongerInUseButStillBeingReserved + { + get + { + return ResourceManager.GetString("ReservedIPNameNoLongerInUseButStillBeingReserved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource with ID : {0} does not exist.. + /// + public static string ResourceNotFound + { + get + { + return ResourceManager.GetString("ResourceNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Restart. + /// + public static string Restart + { + get + { + return ResourceManager.GetString("Restart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resume. + /// + public static string Resume + { + get + { + return ResourceManager.GetString("Resume", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /role:{0};"{1}/{0}" . + /// + public static string RoleArgTemplate + { + get + { + return ResourceManager.GetString("RoleArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to bin. + /// + public static string RoleBinFolderName + { + get + { + return ResourceManager.GetString("RoleBinFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} is {1}. + /// + public static string RoleInstanceWaitMsg + { + get + { + return ResourceManager.GetString("RoleInstanceWaitMsg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 20. + /// + public static string RoleMaxInstances + { + get + { + return ResourceManager.GetString("RoleMaxInstances", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to role name. + /// + public static string RoleName + { + get + { + return ResourceManager.GetString("RoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name {0} doesn't exist. + /// + public static string RoleNotFoundMessage + { + get + { + return ResourceManager.GetString("RoleNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RoleSettings.xml. + /// + public static string RoleSettingsTemplateFileName + { + get + { + return ResourceManager.GetString("RoleSettingsTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role type {0} doesn't exist. + /// + public static string RoleTypeDoesNotExist + { + get + { + return ResourceManager.GetString("RoleTypeDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to public static Dictionary<string, Location> ReverseLocations { get; private set; }. + /// + public static string RuntimeDeploymentLocationError + { + get + { + return ResourceManager.GetString("RuntimeDeploymentLocationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing runtime deployment for service '{0}'. + /// + public static string RuntimeDeploymentStart + { + get + { + return ResourceManager.GetString("RuntimeDeploymentStart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version?. + /// + public static string RuntimeMismatchWarning + { + get + { + return ResourceManager.GetString("RuntimeMismatchWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEOVERRIDEURL. + /// + public static string RuntimeOverrideKey + { + get + { + return ResourceManager.GetString("RuntimeOverrideKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /runtimemanifest/runtimes/runtime. + /// + public static string RuntimeQuery + { + get + { + return ResourceManager.GetString("RuntimeQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEID. + /// + public static string RuntimeTypeKey + { + get + { + return ResourceManager.GetString("RuntimeTypeKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEURL. + /// + public static string RuntimeUrlKey + { + get + { + return ResourceManager.GetString("RuntimeUrlKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEVERSIONPRIMARYKEY. + /// + public static string RuntimeVersionPrimaryKey + { + get + { + return ResourceManager.GetString("RuntimeVersionPrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to scaffold.xml. + /// + public static string ScaffoldXml + { + get + { + return ResourceManager.GetString("ScaffoldXml", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation. + /// + public static string SchedulerInvalidLocation + { + get + { + return ResourceManager.GetString("SchedulerInvalidLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Secondary Peer Subnet has to be provided.. + /// + public static string SecondaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("SecondaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} already exists on disk in location {1}. + /// + public static string ServiceAlreadyExistsOnDisk + { + get + { + return ResourceManager.GetString("ServiceAlreadyExistsOnDisk", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No ServiceBus authorization rule with the given characteristics was found. + /// + public static string ServiceBusAuthorizationRuleNotFound + { + get + { + return ResourceManager.GetString("ServiceBusAuthorizationRuleNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service bus entity '{0}' is not found.. + /// + public static string ServiceBusEntityTypeNotFound + { + get + { + return ResourceManager.GetString("ServiceBusEntityTypeNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen due to an incorrect/missing namespace. + /// + public static string ServiceBusNamespaceMissingMessage + { + get + { + return ResourceManager.GetString("ServiceBusNamespaceMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service configuration. + /// + public static string ServiceConfiguration + { + get + { + return ResourceManager.GetString("ServiceConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service definition. + /// + public static string ServiceDefinition + { + get + { + return ResourceManager.GetString("ServiceDefinition", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceDefinition.csdef. + /// + public static string ServiceDefinitionFileName + { + get + { + return ResourceManager.GetString("ServiceDefinitionFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}Deploy. + /// + public static string ServiceDeploymentName + { + get + { + return ResourceManager.GetString("ServiceDeploymentName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified cloud service "{0}" does not exist.. + /// + public static string ServiceDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is in {2} state, please wait until it finish and update it's status. + /// + public static string ServiceIsInTransitionState + { + get + { + return ResourceManager.GetString("ServiceIsInTransitionState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}.". + /// + public static string ServiceManagementClientExceptionStringFormat + { + get + { + return ResourceManager.GetString("ServiceManagementClientExceptionStringFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service name. + /// + public static string ServiceName + { + get + { + return ResourceManager.GetString("ServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided service name {0} already exists, please pick another name. + /// + public static string ServiceNameExists + { + get + { + return ResourceManager.GetString("ServiceNameExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide name for the hosted service. + /// + public static string ServiceNameMissingMessage + { + get + { + return ResourceManager.GetString("ServiceNameMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service parent directory. + /// + public static string ServiceParentDirectory + { + get + { + return ResourceManager.GetString("ServiceParentDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} removed successfully. + /// + public static string ServiceRemovedMessage + { + get + { + return ResourceManager.GetString("ServiceRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service directory. + /// + public static string ServiceRoot + { + get + { + return ResourceManager.GetString("ServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service settings. + /// + public static string ServiceSettings + { + get + { + return ResourceManager.GetString("ServiceSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.. + /// + public static string ServiceSettings_ValidateStorageAccountName_InvalidName + { + get + { + return ResourceManager.GetString("ServiceSettings_ValidateStorageAccountName_InvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for cloud service {1} doesn't exist.. + /// + public static string ServiceSlotDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceSlotDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is {2}. + /// + public static string ServiceStatusChanged + { + get + { + return ResourceManager.GetString("ServiceStatusChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Set Add-On Confirmation. + /// + public static string SetAddOnConformation + { + get + { + return ResourceManager.GetString("SetAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} does not contain endpoint {1}. Adding it.. + /// + public static string SetInexistentTrafficManagerEndpointMessage + { + get + { + return ResourceManager.GetString("SetInexistentTrafficManagerEndpointMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string SetMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at <url> and (c) agree to sharing my contact information with {2}.. + /// + public static string SetNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances are set to {1}. + /// + public static string SetRoleInstancesMessage + { + get + { + return ResourceManager.GetString("SetRoleInstancesMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"Slot":"","Location":"","Subscription":"","StorageAccountName":""}. + /// + public static string SettingsFileEmptyContent + { + get + { + return ResourceManager.GetString("SettingsFileEmptyContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to deploymentSettings.json. + /// + public static string SettingsFileName + { + get + { + return ResourceManager.GetString("SettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Insufficient parameters passed to create a new endpoint.. + /// + public static string SetTrafficManagerEndpointNeedsParameters + { + get + { + return ResourceManager.GetString("SetTrafficManagerEndpointNeedsParameters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ambiguous operation: the profile name specified doesn't match the name of the profile object.. + /// + public static string SetTrafficManagerProfileAmbiguous + { + get + { + return ResourceManager.GetString("SetTrafficManagerProfileAmbiguous", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts.. + /// + public static string ShouldContinueFail + { + get + { + return ResourceManager.GetString("ShouldContinueFail", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Confirm. + /// + public static string ShouldProcessCaption + { + get + { + return ResourceManager.GetString("ShouldProcessCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailConfirm + { + get + { + return ResourceManager.GetString("ShouldProcessFailConfirm", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again.. + /// + public static string ShouldProcessFailImpact + { + get + { + return ResourceManager.GetString("ShouldProcessFailImpact", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailWhatIf + { + get + { + return ResourceManager.GetString("ShouldProcessFailWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Shutdown. + /// + public static string Shutdown + { + get + { + return ResourceManager.GetString("Shutdown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /sites:{0};{1};"{2}/{0}" . + /// + public static string SitesArgTemplate + { + get + { + return ResourceManager.GetString("SitesArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string StandardRetryDelayInMs + { + get + { + return ResourceManager.GetString("StandardRetryDelayInMs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Start. + /// + public static string Start + { + get + { + return ResourceManager.GetString("Start", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Started. + /// + public static string StartedEmulator + { + get + { + return ResourceManager.GetString("StartedEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting Emulator.... + /// + public static string StartingEmulator + { + get + { + return ResourceManager.GetString("StartingEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to start. + /// + public static string StartStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StartStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stop. + /// + public static string Stop + { + get + { + return ResourceManager.GetString("Stop", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopping emulator.... + /// + public static string StopEmulatorMessage + { + get + { + return ResourceManager.GetString("StopEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopped. + /// + public static string StoppedEmulatorMessage + { + get + { + return ResourceManager.GetString("StoppedEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to stop. + /// + public static string StopStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StopStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account Name:. + /// + public static string StorageAccountName + { + get + { + return ResourceManager.GetString("StorageAccountName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find storage account '{0}' please type the name of an existing storage account.. + /// + public static string StorageAccountNotFound + { + get + { + return ResourceManager.GetString("StorageAccountNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AzureStorageEmulator.exe. + /// + public static string StorageEmulatorExe + { + get + { + return ResourceManager.GetString("StorageEmulatorExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to InstallPath. + /// + public static string StorageEmulatorInstallPathRegistryKeyValue + { + get + { + return ResourceManager.GetString("StorageEmulatorInstallPathRegistryKeyValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SOFTWARE\Microsoft\Windows Azure Storage Emulator. + /// + public static string StorageEmulatorRegistryKey + { + get + { + return ResourceManager.GetString("StorageEmulatorRegistryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Primary Key:. + /// + public static string StoragePrimaryKey + { + get + { + return ResourceManager.GetString("StoragePrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Secondary Key:. + /// + public static string StorageSecondaryKey + { + get + { + return ResourceManager.GetString("StorageSecondaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} already exists.. + /// + public static string SubscriptionAlreadyExists + { + get + { + return ResourceManager.GetString("SubscriptionAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information.. + /// + public static string SubscriptionDataFileDeprecated + { + get + { + return ResourceManager.GetString("SubscriptionDataFileDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DefaultSubscriptionData.xml. + /// + public static string SubscriptionDataFileName + { + get + { + return ResourceManager.GetString("SubscriptionDataFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription data file {0} does not exist.. + /// + public static string SubscriptionDataFileNotFound + { + get + { + return ResourceManager.GetString("SubscriptionDataFileNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription id {0} doesn't exist.. + /// + public static string SubscriptionIdNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionIdNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription must not be null. + /// + public static string SubscriptionMustNotBeNull + { + get + { + return ResourceManager.GetString("SubscriptionMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription name needs to be specified.. + /// + public static string SubscriptionNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription name {0} doesn't exist.. + /// + public static string SubscriptionNameNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionNameNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription needs to be specified.. + /// + public static string SubscriptionNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Suspend. + /// + public static string Suspend + { + get + { + return ResourceManager.GetString("Suspend", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Swapping website production slot .... + /// + public static string SwappingWebsite + { + get + { + return ResourceManager.GetString("SwappingWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to swap the website '{0}' production slot with slot '{1}'?. + /// + public static string SwapWebsiteSlotWarning + { + get + { + return ResourceManager.GetString("SwapWebsiteSlotWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Switch-AzureMode cmdlet is deprecated and will be removed in a future release.. + /// + public static string SwitchAzureModeDeprecated + { + get + { + return ResourceManager.GetString("SwitchAzureModeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}'. + /// + public static string TraceBeginLROJob + { + get + { + return ResourceManager.GetString("TraceBeginLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}'. + /// + public static string TraceBlockLROThread + { + get + { + return ResourceManager.GetString("TraceBlockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Completing cmdlet execution in RunJob. + /// + public static string TraceEndLROJob + { + get + { + return ResourceManager.GetString("TraceEndLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}'. + /// + public static string TraceHandleLROStateChange + { + get + { + return ResourceManager.GetString("TraceHandleLROStateChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job due to stoppage or failure. + /// + public static string TraceHandlerCancelJob + { + get + { + return ResourceManager.GetString("TraceHandlerCancelJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job that was previously blocked.. + /// + public static string TraceHandlerUnblockJob + { + get + { + return ResourceManager.GetString("TraceHandlerUnblockJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Error in cmdlet execution. + /// + public static string TraceLROJobException + { + get + { + return ResourceManager.GetString("TraceLROJobException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Removing state changed event handler, exception '{0}'. + /// + public static string TraceRemoveLROEventHandler + { + get + { + return ResourceManager.GetString("TraceRemoveLROEventHandler", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: ShouldMethod '{0}' unblocked.. + /// + public static string TraceUnblockLROThread + { + get + { + return ResourceManager.GetString("TraceUnblockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}.. + /// + public static string UnableToDecodeBase64String + { + get + { + return ResourceManager.GetString("UnableToDecodeBase64String", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to update mismatching Json structured: {0} {1}.. + /// + public static string UnableToPatchJson + { + get + { + return ResourceManager.GetString("UnableToPatchJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provider {0} is unknown.. + /// + public static string UnknownProviderMessage + { + get + { + return ResourceManager.GetString("UnknownProviderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Update. + /// + public static string Update + { + get + { + return ResourceManager.GetString("Update", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updated settings for subscription '{0}'. Current subscription is '{1}'.. + /// + public static string UpdatedSettings + { + get + { + return ResourceManager.GetString("UpdatedSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name is not valid.. + /// + public static string UserNameIsNotValid + { + get + { + return ResourceManager.GetString("UserNameIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name needs to be specified.. + /// + public static string UserNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("UserNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the VLan Id has to be provided.. + /// + public static string VlanIdRequired + { + get + { + return ResourceManager.GetString("VlanIdRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please wait.... + /// + public static string WaitMessage + { + get + { + return ResourceManager.GetString("WaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The azure storage emulator is not installed, skip launching.... + /// + public static string WarningWhenStorageEmulatorIsMissing + { + get + { + return ResourceManager.GetString("WarningWhenStorageEmulatorIsMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Web.cloud.config. + /// + public static string WebCloudConfig + { + get + { + return ResourceManager.GetString("WebCloudConfig", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to web.config. + /// + public static string WebConfigTemplateFileName + { + get + { + return ResourceManager.GetString("WebConfigTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSDeploy. + /// + public static string WebDeployKeywordInWebSitePublishProfile + { + get + { + return ResourceManager.GetString("WebDeployKeywordInWebSitePublishProfile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot build the project successfully. Please see logs in {0}.. + /// + public static string WebProjectBuildFailTemplate + { + get + { + return ResourceManager.GetString("WebProjectBuildFailTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole. + /// + public static string WebRole + { + get + { + return ResourceManager.GetString("WebRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_web.cmd > log.txt. + /// + public static string WebRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WebRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole.xml. + /// + public static string WebRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WebRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Webspace.. + /// + public static string WebsiteAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Location.. + /// + public static string WebsiteAlreadyExistsReplacement + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExistsReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Site {0} already has repository created for it.. + /// + public static string WebsiteRepositoryAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteRepositoryAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Workspaces/WebsiteExtension/Website/{0}/dashboard/. + /// + public static string WebsiteSufixUrl + { + get + { + return ResourceManager.GetString("WebsiteSufixUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}/msdeploy.axd?site={1}. + /// + public static string WebSiteWebDeployUriTemplate + { + get + { + return ResourceManager.GetString("WebSiteWebDeployUriTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole. + /// + public static string WorkerRole + { + get + { + return ResourceManager.GetString("WorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_worker.cmd > log.txt. + /// + public static string WorkerRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WorkerRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole.xml. + /// + public static string WorkerRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WorkerRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to (x86). + /// + public static string x86InProgramFiles + { + get + { + return ResourceManager.GetString("x86InProgramFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes. + /// + public static string Yes + { + get + { + return ResourceManager.GetString("Yes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes, I agree. + /// + public static string YesHint + { + get + { + return ResourceManager.GetString("YesHint", resourceCulture); + } + } + } +} diff --git a/src/Peering/generated/runtime/Properties/Resources.resx b/src/Peering/generated/runtime/Properties/Resources.resx new file mode 100644 index 000000000000..598cd53e958a --- /dev/null +++ b/src/Peering/generated/runtime/Properties/Resources.resx @@ -0,0 +1,1741 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The remote server returned an error: (401) Unauthorized. + + + Account "{0}" has been added. + + + To switch to a different subscription, please use Select-AzureSubscription. + + + Subscription "{0}" is selected as the default subscription. + + + To view all the subscriptions, please use Get-AzureSubscription. + + + Add-On {0} is created successfully. + + + Add-on name {0} is already used. + + + Add-On {0} not found. + + + Add-on {0} is removed successfully. + + + Add-On {0} is updated successfully. + + + Role has been created at {0}\{1}. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure". + + + Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator + + + A role name '{0}' already exists + + + Windows Azure Powershell\ + + + https://manage.windowsazure.com + + + AZURE_PORTAL_URL + + + Azure SDK\{0}\ + + + Base Uri was empty. + WAPackIaaS + + + {0} begin processing without ParameterSet. + + + {0} begin processing with ParameterSet '{1}'. + + + Blob with the name {0} already exists in the account. + + + https://{0}.blob.core.windows.net/ + + + AZURE_BLOBSTORAGE_TEMPLATE + + + CACHERUNTIMEURL + + + cache + + + CacheRuntimeVersion + + + Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}) + + + Cannot find {0} with name {1}. + + + Deployment for service {0} with {1} slot doesn't exist + + + Can't find valid Microsoft Azure role in current directory {0} + + + service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist + + + Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders. + + + The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated. + + + ManagementCertificate + + + certificate.pfx + + + Certificate imported into CurrentUser\My\{0} + + + Your account does not have access to the private key for certificate {0} + + + {0} {1} deployment for {2} service + + + Cloud service {0} is in {1} state. + + + Changing/Removing public environment '{0}' is not allowed. + + + Service {0} is set to value {1} + + + Choose which publish settings file to use: + + + Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel + + + 1 + + + cloud_package.cspkg + + + ServiceConfiguration.Cloud.cscfg + + + Add-ons for {0} + + + Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive. + + + Complete + + + config.json + + + VirtualMachine creation failed. + WAPackIaaS + + + Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead. + + + Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core + + + //blobcontainer[@datacenter='{0}'] + + + Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription + + + none + + + There are no hostnames which could be used for validation. + + + 8080 + + + 1000 + + + Auto + + + 80 + + + Delete + WAPackIaaS + + + The {0} slot for service {1} is already in {2} state + + + The deployment in {0} slot for service {1} is removed + + + Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel + + + 1 + + + The key to add already exists in the dictionary. + + + The array index cannot be less than zero. + + + The supplied array does not have enough room to contain the copied elements. + + + The provided dns {0} doesn't exist + + + Microsoft Azure Certificate + + + Endpoint can't be retrieved for storage account + + + {0} end processing. + + + To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet. + + + The environment '{0}' already exists. + + + environments.xml + + + Error creating VirtualMachine + WAPackIaaS + + + Unable to download available runtimes for location '{0}' + + + Error updating VirtualMachine + WAPackIaaS + + + Job Id {0} failed. Error: {1}, ExceptionDetails: {2} + WAPackIaaS + + + The HTTP request was forbidden with client authentication scheme 'Anonymous'. + + + This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell. + + + Operation Status: + + + Resources\Scaffolding\General + + + Getting all available Microsoft Azure Add-Ons, this may take few minutes... + + + Name{0}Primary Key{0}Seconday Key + + + Git not found. Please install git and place it in your command line path. + + + Could not find publish settings. Please run Import-AzurePublishSettingsFile. + + + iisnode.dll + + + iisnode + + + iisnode-dev\\release\\x64 + + + iisnode + + + Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}) + + + Internal Server Error + + + Cannot enable memcach protocol on a cache worker role {0}. + + + Invalid certificate format. + + + The provided configuration path is invalid or doesn't exist + + + The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2. + + + Deployment with {0} does not exist + + + The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production". + + + Invalid service endpoint. + + + File {0} has invalid characters + + + You must create your git publishing credentials using the Microsoft Azure portal. +Please follow these steps in the portal: +1. On the left side open "Web Sites" +2. Click on any website +3. Choose "Setup Git Publishing" or "Reset deployment credentials" +4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username} + + + The value {0} provided is not a valid GUID. Please provide a valid GUID. + + + The specified hostname does not exist. Please specify a valid hostname for the site. + + + Role {0} instances must be greater than or equal 0 and less than or equal 20 + + + There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file. + + + Could not download a valid runtime manifest, Please check your internet connection and try again. + + + The account {0} was not found. Please specify a valid account name. + + + The provided name "{0}" does not match the service bus namespace naming rules. + + + Value cannot be null. Parameter name: '{0}' + + + The provided package path is invalid or doesn't exist + + + '{0}' is an invalid parameter set name. + + + {0} doesn't exist in {1} or you've not passed valid value for it + + + Path {0} has invalid characters + + + The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile + + + The provided role name "{0}" has invalid characters + + + A valid name for the service root folder is required + + + {0} is not a recognized runtime type + + + A valid language is required + + + No subscription is currently selected. Use Select-Subscription to activate a subscription. + + + The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations. + + + Please provide a service name or run this command from inside a service project directory. + + + You must provide valid value for {0} + + + settings.json is invalid or doesn't exist + + + The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data. + + + The provided subscription id {0} is not valid + + + A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet + + + The provided subscriptions file {0} has invalid content. + + + Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge. + + + The web job file must have *.zip extension + + + Singleton option works for continuous jobs only. + + + The website {0} was not found. Please specify a valid website name. + + + No job for id: {0} was found. + WAPackIaaS + + + engines + + + Scaffolding for this language is not yet supported + + + Link already established + + + local_package.csx + + + ServiceConfiguration.Local.cscfg + + + Looking for {0} deployment for {1} cloud service... + + + Looking for cloud service {0}... + + + managementCertificate.pem + + + ?whr={0} + + + //baseuri + + + uri + + + http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml + + + Multiple Add-Ons found holding name {0} + + + Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername. + + + The first publish settings file "{0}" is used. If you want to use another file specify the file name. + + + Microsoft.WindowsAzure.Plugins.Caching.NamedCaches + + + {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]} + + + A publishing username is required. Please specify one using the argument PublishingUsername. + + + New Add-On Confirmation + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names. + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at {0} and (c) agree to sharing my contact information with {2}. + + + Service has been created at {0} + + + No + + + There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription. + + + The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole. + + + No clouds available + WAPackIaaS + + + nodejs + + + node + + + node.exe + + + There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name> + + + Microsoft SDKs\Azure\Nodejs\Nov2011 + + + nodejs + + + node + + + Resources\Scaffolding\Node + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node + + + Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}) + + + No, I do not agree + + + No publish settings files with extension *.publishsettings are found in the directory "{0}". + + + '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration. + + + Certificate can't be null. + + + {0} could not be null or empty + + + Unable to add a null RoleSettings to {0} + + + Unable to add new role to null service definition + + + The request offer '{0}' is not found. + + + Operation "{0}" failed on VM with ID: {1} + WAPackIaaS + + + The REST operation failed with message '{0}' and error code '{1}' + + + Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state. + WAPackIaaS + + + package + + + Package is created at service root path {0}. + + + {{ + "author": "", + + "name": "{0}", + "version": "0.0.0", + "dependencies":{{}}, + "devDependencies":{{}}, + "optionalDependencies": {{}}, + "engines": {{ + "node": "*", + "iisnode": "*" + }} + +}} + + + + package.json + + + A value for the Peer Asn has to be provided. + + + 5.4.0 + + + php + + + Resources\Scaffolding\PHP + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP + + + Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}) + + + You must create your first web site using the Microsoft Azure portal. +Please follow these steps in the portal: +1. At the bottom of the page, click on New > Web Site > Quick Create +2. Type {0} in the URL field +3. Click on "Create Web Site" +4. Once the site has been created, click on the site name +5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create. + + + 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git" + + + A value for the Primary Peer Subnet has to be provided. + + + Promotion code can be used only when updating to a new plan. + + + Service not published at user request. + + + Complete. + + + Connecting... + + + Created Deployment ID: {0}. + + + Created hosted service '{0}'. + + + Created Website URL: {0}. + + + Creating... + + + Initializing... + + + busy + + + creating the virtual machine + + + Instance {0} of role {1} is {2}. + + + ready + + + Preparing deployment for {0} with Subscription ID: {1}... + + + Publishing {0} to Microsoft Azure. This may take several minutes... + + + publish settings + + + Azure + + + .PublishSettings + + + publishSettings.xml + + + Publish settings imported + + + AZURE_PUBLISHINGPROFILE_URL + + + Starting... + + + Upgrading... + + + Uploading Package to storage service {0}... + + + Verifying storage account '{0}'... + + + Replace current deployment with '{0}' Id ? + + + Are you sure you want to regenerate key? + + + Generate new key. + + + Are you sure you want to remove account '{0}'? + + + Removing account + + + Remove Add-On Confirmation + + + If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm. + + + Remove-AzureBGPPeering Operation failed. + + + Removing Bgp Peering + + + Successfully removed Azure Bgp Peering with Service Key {0}. + + + Are you sure you want to remove the Bgp Peering with service key '{0}'? + + + Are you sure you want to remove the Dedicated Circuit with service key '{0}'? + + + Remove-AzureDedicatedCircuit Operation failed. + + + Remove-AzureDedicatedCircuitLink Operation failed. + + + Removing Dedicated Circui Link + + + Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1} + + + Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'? + + + Removing Dedicated Circuit + + + Successfully removed Azure Dedicated Circuit with Service Key {0}. + + + Removing cloud service {0}... + + + Removing {0} deployment for {1} service + + + Removing job collection + + + Are you sure you want to remove the job collection "{0}" + + + Removing job + + + Are you sure you want to remove the job "{0}" + + + Are you sure you want to remove the account? + + + Account removed. + + + Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription. + + + Removing old package {0}... + + + Are you sure you want to delete the namespace '{0}'? + + + Are you sure you want to remove cloud service? + + + Remove cloud service and all it's deployments + + + Are you sure you want to remove subscription '{0}'? + + + Removing subscription + + + Are you sure you want to delete the VM '{0}'? + + + Deleting VM. + + + Removing WebJob... + + + Are you sure you want to remove job '{0}'? + + + Removing website + + + Are you sure you want to remove the website "{0}" + + + Deleting namespace + + + Repository is not setup. You need to pass a valid site name. + + + Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use. + + + Resource with ID : {0} does not exist. + WAPackIaaS + + + Restart + WAPackIaaS + + + Resume + WAPackIaaS + + + /role:{0};"{1}/{0}" + + + bin + + + Role {0} is {1} + + + 20 + + + role name + + + The provided role name {0} doesn't exist + + + RoleSettings.xml + + + Role type {0} doesn't exist + + + public static Dictionary<string, Location> ReverseLocations { get; private set; } + + + Preparing runtime deployment for service '{0}' + + + WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version? + + + RUNTIMEOVERRIDEURL + + + /runtimemanifest/runtimes/runtime + + + RUNTIMEID + + + RUNTIMEURL + + + RUNTIMEVERSIONPRIMARYKEY + + + scaffold.xml + + + Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation + + + A value for the Secondary Peer Subnet has to be provided. + + + Service {0} already exists on disk in location {1} + + + No ServiceBus authorization rule with the given characteristics was found + + + The service bus entity '{0}' is not found. + + + Internal Server Error. This could happen due to an incorrect/missing namespace + + + service configuration + + + service definition + + + ServiceDefinition.csdef + + + {0}Deploy + + + The specified cloud service "{0}" does not exist. + + + {0} slot for service {1} is in {2} state, please wait until it finish and update it's status + + + Begin Operation: {0} + + + Completed Operation: {0} + + + Begin Operation: {0} + + + Completed Operation: {0} + + + service name + + + Please provide name for the hosted service + + + service parent directory + + + Service {0} removed successfully + + + service directory + + + service settings + + + The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + + + The {0} slot for cloud service {1} doesn't exist. + + + {0} slot for service {1} is {2} + + + Set Add-On Confirmation + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at <url> and (c) agree to sharing my contact information with {2}. + + + Role {0} instances are set to {1} + + + {"Slot":"","Location":"","Subscription":"","StorageAccountName":""} + + + deploymentSettings.json + + + Confirm + + + Shutdown + WAPackIaaS + + + /sites:{0};{1};"{2}/{0}" + + + 1000 + + + Start + WAPackIaaS + + + Started + + + Starting Emulator... + + + start + + + Stop + WAPackIaaS + + + Stopping emulator... + + + Stopped + + + stop + + + Account Name: + + + Cannot find storage account '{0}' please type the name of an existing storage account. + + + AzureStorageEmulator.exe + + + InstallPath + + + SOFTWARE\Microsoft\Windows Azure Storage Emulator + + + Primary Key: + + + Secondary Key: + + + The subscription named {0} already exists. + + + DefaultSubscriptionData.xml + + + The subscription data file {0} does not exist. + + + Subscription must not be null + WAPackIaaS + + + Suspend + WAPackIaaS + + + Swapping website production slot ... + + + Are you sure you want to swap the website '{0}' production slot with slot '{1}'? + + + The provider {0} is unknown. + + + Update + WAPackIaaS + + + Updated settings for subscription '{0}'. Current subscription is '{1}'. + + + A value for the VLan Id has to be provided. + + + Please wait... + + + The azure storage emulator is not installed, skip launching... + + + Web.cloud.config + + + web.config + + + MSDeploy + + + Cannot build the project successfully. Please see logs in {0}. + + + WebRole + + + setup_web.cmd > log.txt + + + WebRole.xml + + + WebSite with given name {0} already exists in the specified Subscription and Webspace. + + + WebSite with given name {0} already exists in the specified Subscription and Location. + + + Site {0} already has repository created for it. + + + Workspaces/WebsiteExtension/Website/{0}/dashboard/ + + + https://{0}/msdeploy.axd?site={1} + + + WorkerRole + + + setup_worker.cmd > log.txt + + + WorkerRole.xml + + + Yes + + + Yes, I agree + + + Remove-AzureTrafficManagerProfile Operation failed. + + + Successfully removed Traffic Manager profile with name {0}. + + + Are you sure you want to remove the Traffic Manager profile "{0}"? + + + Profile {0} already has an endpoint with name {1} + + + Profile {0} does not contain endpoint {1}. Adding it. + + + The endpoint {0} cannot be removed from profile {1} because it's not in the profile. + + + Insufficient parameters passed to create a new endpoint. + + + Ambiguous operation: the profile name specified doesn't match the name of the profile object. + + + <NONE> + + + "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}." + {0} is the HTTP status code. {1} is the Service Management Error Code. {2} is the Service Management Error message. {3} is the operation tracking ID. + + + Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}. + {0} is the string that is not in a valid base 64 format. + + + Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential". + + + Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'? + + + Removing environment + + + There is no subscription associated with account {0}. + + + Account id doesn't match one in subscription. + + + Environment name doesn't match one in subscription. + + + Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile? + + + Removing the Azure profile + + + The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information. + + + Account needs to be specified + + + No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription. + + + Path must specify a valid path to an Azure profile. + + + Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token} + + + Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'. + + + Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'. + + + Property bag Hashtable must contain a 'SubscriptionId'. + + + Selected profile must not be null. + + + The Switch-AzureMode cmdlet is deprecated and will be removed in a future release. + + + OperationID : '{0}' + + + Cannot get module for DscResource '{0}'. Possible solutions: +1) Specify -ModuleName for Import-DscResource in your configuration. +2) Unblock module that contains resource. +3) Move Import-DscResource inside Node block. + + 0 = name of DscResource + + + Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version. + {0} = minimal required PS version, {1} = current PS version + + + Parsing configuration script: {0} + {0} is the path to a script file + + + Configuration script '{0}' contained parse errors: +{1} + 0 = path to the configuration script, 1 = parser errors + + + List of required modules: [{0}]. + {0} = list of modules + + + Temp folder '{0}' created. + {0} = temp folder path + + + Copy '{0}' to '{1}'. + {0} = source, {1} = destination + + + Copy the module '{0}' to '{1}'. + {0} = source, {1} = destination + + + File '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the path to a file + + + Configuration file '{0}' not found. + 0 = path to the configuration file + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip). + 0 = path to the configuration file + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1). + 0 = path to the configuration file + + + Create Archive + + + Upload '{0}' + {0} is the name of an storage blob + + + Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the name of an storage blob + + + Configuration published to {0} + {0} is an URI + + + Deleted '{0}' + {0} is the path of a file + + + Cannot delete '{0}': {1} + {0} is the path of a file, {1} is an error message + + + Cannot find the WadCfg end element in the config. + + + WadCfg start element in the config is not matching the end element. + + + Cannot find the WadCfg element in the config. + + + Cannot find configuration data file: {0} + + + The configuration data must be a .psd1 file + + + Cannot change built-in environment {0}. + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. +Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable data collection: PS > Enable-AzDataCollection. + + + Microsoft Azure PowerShell Data Collection Confirmation + + + You choose not to participate in Microsoft Azure PowerShell data collection. + + + This confirmation message will be dismissed in '{0}' second(s)... + + + You choose to participate in Microsoft Azure PowerShell data collection. + + + The setting profile has been saved to the following path '{0}'. + + + [Common.Authentication]: Authenticating for account {0} with single tenant {1}. + + + Changing public environment is not supported. + + + Environment name needs to be specified. + + + Environment needs to be specified. + + + The environment name '{0}' is not found. + + + File path is not valid. + + + Must specify a non-null subscription name. + + + The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription. + + + Removing public environment is not supported. + + + The subscription id {0} doesn't exist. + + + Subscription name needs to be specified. + + + The subscription name {0} doesn't exist. + + + Subscription needs to be specified. + + + User name is not valid. + + + User name needs to be specified. + + + "There is no current context, please log in using Connect-AzAccount." + + + No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount? + + + No certificate was found in the certificate store with thumbprint {0} + + + Illegal characters in path. + + + Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings + + + "{0}" is an invalid DNS name for {1} + + + The provided file in {0} must be have {1} extension + + + {0} is invalid or empty + + + Please connect to internet before executing this cmdlet + + + Path {0} doesn't exist. + + + Path for {0} doesn't exist in {1}. + + + &whr={0} + + + The provided service name {0} already exists, please pick another name + + + Unable to update mismatching Json structured: {0} {1}. + + + (x86) + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. +Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enable-AzureDataCollection. + + + Execution failed because a background thread could not prompt the user. + + + Azure Long-Running Job + + + The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter. + 0(string): exception message in background task + + + Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts. + + + Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter. + + + Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again. + + + Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter. + + + [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}' + 0(bool): whether cmdlet confirmation is required + + + [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}' + 0(string): method type + + + [AzureLongRunningJob]: Completing cmdlet execution in RunJob + + + [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}' + 0(string): last state, 1(string): new state, 2(string): state change reason + + + [AzureLongRunningJob]: Unblocking job due to stoppage or failure + + + [AzureLongRunningJob]: Unblocking job that was previously blocked. + + + [AzureLongRunningJob]: Error in cmdlet execution + + + [AzureLongRunningJob]: Removing state changed event handler, exception '{0}' + 0(string): exception message + + + [AzureLongRunningJob]: ShouldMethod '{0}' unblocked. + 0(string): methodType + + + +- The parameter : '{0}' is changing. + + + +- The parameter : '{0}' is becoming mandatory. + + + +- The parameter : '{0}' is being replaced by parameter : '{1}'. + + + +- The parameter : '{0}' is being replaced by mandatory parameter : '{1}'. + + + +- Change description : {0} + + + The cmdlet is being deprecated. There will be no replacement for it. + + + The cmdlet parameter set is being deprecated. There will be no replacement for it. + + + The cmdlet '{0}' is replacing this cmdlet. + + + +- The output type is changing from the existing type :'{0}' to the new type :'{1}' + + + +- The output type '{0}' is changing + + + +- The following properties are being added to the output type : + + + +- The following properties in the output type are being deprecated : + + + {0} + + + +- Cmdlet : '{0}' + - {1} + + + Upcoming breaking changes in the cmdlet '{0}' : + + + +- This change will take effect on '{0}' + + + +- The change is expected to take effect from the version : '{0}' + + + ```powershell +# Old +{0} + +# New +{1} +``` + + + + +Cmdlet invocation changes : + Old Way : {0} + New Way : {1} + + + +The output type '{0}' is being deprecated without a replacement. + + + +The type of the parameter is changing from '{0}' to '{1}'. + + + +Note : Go to {0} for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell. + + + This cmdlet is in preview. The functionality may not be available in the selected subscription. + + \ No newline at end of file diff --git a/src/Peering/generated/runtime/Response.cs b/src/Peering/generated/runtime/Response.cs new file mode 100644 index 000000000000..fc9298df6f7d --- /dev/null +++ b/src/Peering/generated/runtime/Response.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using System; + using System.Threading.Tasks; + public class Response : EventData + { + public Response() : base() + { + } + } + + public class Response : Response + { + private Func> _resultDelegate; + private Task _resultValue; + + public Response(T value) : base() => _resultValue = Task.FromResult(value); + public Response(Func value) : base() => _resultDelegate = () => Task.FromResult(value()); + public Response(Func> value) : base() => _resultDelegate = value; + public Task Result => _resultValue ?? (_resultValue = this._resultDelegate()); + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Serialization/JsonSerializer.cs b/src/Peering/generated/runtime/Serialization/JsonSerializer.cs new file mode 100644 index 000000000000..b614ab3a7c1b --- /dev/null +++ b/src/Peering/generated/runtime/Serialization/JsonSerializer.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal class JsonSerializer + { + private int depth = 0; + + private SerializationOptions options = new SerializationOptions(); + + #region Deserialization + + internal T Deseralize(JsonObject json) + where T : new() + { + var contract = JsonModelCache.Get(typeof(T)); + + return (T)DeserializeObject(contract, json); + } + + internal object DeserializeObject(JsonModel contract, JsonObject json) + { + var instance = Activator.CreateInstance(contract.Type); + + depth++; + + // Ensure we don't recurse forever + if (depth > 5) throw new Exception("Depth greater than 5"); + + foreach (var field in json) + { + var member = contract[field.Key]; + + if (member != null) + { + var value = DeserializeValue(member, field.Value); + + member.SetValue(instance, value); + } + } + + depth--; + + return instance; + } + + private object DeserializeValue(JsonMember member, JsonNode value) + { + if (value.Type == JsonType.Null) return null; + + var type = member.Type; + + if (member.IsStringLike && value.Type != JsonType.String) + { + // Take the long path... + return DeserializeObject(JsonModelCache.Get(type), (JsonObject)value); + } + else if (member.Converter != null) + { + return member.Converter.FromJson(value); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (member.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + private object DeserializeValue(Type type, JsonNode value) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + + if (value.Type == JsonType.Null) return null; + + var typeDetails = TypeDetails.Get(type); + + if (typeDetails.JsonConverter != null) + { + return typeDetails.JsonConverter.FromJson(value); + } + else if (typeDetails.IsEnum) + { + return Enum.Parse(type, value.ToString(), ignoreCase: true); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (typeDetails.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + internal Array DeserializeArray(Type type, JsonArray elements) + { + var elementType = type.GetElementType(); + + var elementTypeDetails = TypeDetails.Get(elementType); + + var array = Array.CreateInstance(elementType, elements.Count); + + int i = 0; + + if (elementTypeDetails.JsonConverter != null) + { + foreach (var value in elements) + { + array.SetValue(elementTypeDetails.JsonConverter.FromJson(value), i); + + i++; + } + } + else + { + foreach (var value in elements) + { + array.SetValue(DeserializeValue(elementType, value), i); + + i++; + } + } + + return array; + } + + internal IList DeserializeList(Type type, JsonArray jsonArray) + { + // TODO: Handle non-generic types + if (!type.IsGenericType) + throw new ArgumentException("Must be a generic type", nameof(type)); + + var elementType = type.GetGenericArguments()[0]; + + IList list; + + if (type.IsInterface) + { + // Create a concrete generic list + list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); + } + else + { + list = (IList)Activator.CreateInstance(type); + } + + foreach (var value in jsonArray) + { + list.Add(DeserializeValue(elementType, value)); + } + + return list; + } + + #endregion + + #region Serialization + + internal JsonNode Serialize(object instance) => + Serialize(instance, SerializationOptions.Default); + + internal JsonNode Serialize(object instance, string[] include) => + Serialize(instance, new SerializationOptions { Include = include }); + + internal JsonNode Serialize(object instance, SerializationOptions options) + { + this.options = options; + + if (instance == null) + { + return XNull.Instance; + } + + return ReadValue(instance.GetType(), instance); + } + + #region Readers + + internal JsonArray ReadArray(IEnumerable collection) + { + var array = new XNodeArray(); + + foreach (var item in collection) + { + array.Add(ReadValue(item.GetType(), item)); + } + + return array; + } + + internal IEnumerable> ReadProperties(object instance) + { + var contract = JsonModelCache.Get(instance.GetType()); + + foreach (var member in contract.Members) + { + string name = member.Name; + + if (options.PropertyNameTransformer != null) + { + name = options.PropertyNameTransformer.Invoke(name); + } + + // Skip the field if it's not included + if ((depth == 1 && !options.IsIncluded(name))) + { + continue; + } + + var value = member.GetValue(instance); + + if (!member.EmitDefaultValue && (value == null || (member.IsList && ((IList)value).Count == 0) || value.Equals(member.DefaultValue))) + { + continue; + } + else if (options.IgnoreNullValues && value == null) // Ignore null values + { + continue; + } + + // Transform the value if there is one + if (options.Transformations != null) + { + var transform = options.GetTransformation(name); + + if (transform != null) + { + value = transform.Transformer(value); + } + } + + yield return new KeyValuePair(name, ReadValue(member.TypeDetails, value)); + } + } + + private JsonObject ReadObject(object instance) + { + depth++; + + // TODO: Guard against a self referencing graph + if (depth > options.MaxDepth) + { + depth--; + + return new JsonObject(); + } + + var node = new JsonObject(ReadProperties(instance)); + + depth--; + + return node; + } + + private JsonNode ReadValue(Type type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + var member = TypeDetails.Get(type); + + return ReadValue(member, value); + } + + private JsonNode ReadValue(TypeDetails type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + if (type.JsonConverter != null) + { + return type.JsonConverter.ToJson(value); + } + else if (type.IsArray) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateArray((string[])value); + case TypeCode.UInt16: return CreateArray((ushort[])value); + case TypeCode.UInt32: return CreateArray((uint[])value); + case TypeCode.UInt64: return CreateArray((ulong[])value); + case TypeCode.Int16: return CreateArray((short[])value); + case TypeCode.Int32: return CreateArray((int[])value); + case TypeCode.Int64: return CreateArray((long[])value); + case TypeCode.Single: return CreateArray((float[])value); + case TypeCode.Double: return CreateArray((double[])value); + default: return ReadArray((IEnumerable)value); + } + } + else if (value is IEnumerable) + { + if (type.IsList && type.ElementType != null) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateList(value); + case TypeCode.UInt16: return CreateList(value); + case TypeCode.UInt32: return CreateList(value); + case TypeCode.UInt64: return CreateList(value); + case TypeCode.Int16: return CreateList(value); + case TypeCode.Int32: return CreateList(value); + case TypeCode.Int64: return CreateList(value); + case TypeCode.Single: return CreateList(value); + case TypeCode.Double: return CreateList(value); + } + } + + return ReadArray((IEnumerable)value); + } + else + { + // Complex object + return ReadObject(value); + } + } + + private XList CreateList(object value) => new XList((IList)value); + + private XImmutableArray CreateArray(T[] array) => new XImmutableArray(array); + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Serialization/PropertyTransformation.cs b/src/Peering/generated/runtime/Serialization/PropertyTransformation.cs new file mode 100644 index 000000000000..f38847281863 --- /dev/null +++ b/src/Peering/generated/runtime/Serialization/PropertyTransformation.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal class PropertyTransformation + { + internal PropertyTransformation(string name, Func transformer) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Transformer = transformer ?? throw new ArgumentNullException(nameof(transformer)); + } + + internal string Name { get; } + + internal Func Transformer { get; } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Serialization/SerializationOptions.cs b/src/Peering/generated/runtime/Serialization/SerializationOptions.cs new file mode 100644 index 000000000000..c07396c3c600 --- /dev/null +++ b/src/Peering/generated/runtime/Serialization/SerializationOptions.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal class SerializationOptions + { + internal static readonly SerializationOptions Default = new SerializationOptions(); + + internal SerializationOptions() { } + + internal SerializationOptions( + string[] include = null, + bool ingoreNullValues = false) + { + Include = include; + IgnoreNullValues = ingoreNullValues; + } + + internal string[] Include { get; set; } + + internal string[] Exclude { get; set; } + + internal bool IgnoreNullValues { get; set; } + + internal PropertyTransformation[] Transformations { get; set; } + + internal Func PropertyNameTransformer { get; set; } + + internal int MaxDepth { get; set; } = 5; + + internal bool IsIncluded(string name) + { + if (Exclude != null) + { + return !Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + else if (Include != null) + { + return Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + + return true; + } + + internal PropertyTransformation GetTransformation(string propertyName) + { + if (Transformations == null) return null; + + foreach (var t in Transformations) + { + if (t.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + { + return t; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/SerializationMode.cs b/src/Peering/generated/runtime/SerializationMode.cs new file mode 100644 index 000000000000..8f2f93dedfde --- /dev/null +++ b/src/Peering/generated/runtime/SerializationMode.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + [System.Flags] + public enum SerializationMode + { + None = 0, + IncludeHeaders = 1 << 0, + IncludeReadOnly = 1 << 1, + + IncludeAll = IncludeHeaders | IncludeReadOnly + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/TypeConverterExtensions.cs b/src/Peering/generated/runtime/TypeConverterExtensions.cs new file mode 100644 index 000000000000..b4c6f8b26c8c --- /dev/null +++ b/src/Peering/generated/runtime/TypeConverterExtensions.cs @@ -0,0 +1,211 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.PowerShell +{ + internal static class TypeConverterExtensions + { + internal static T[] SelectToArray(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0]; // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result.ToArray(); + } + + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Management.Automation.PSObject instance) + { + if (null != instance) + { + foreach (var each in instance.Properties) + { + yield return each; + } + } + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.Generic.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys.OfType() + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + // new global::System.Collections.Generic.HashSet(System.StringComparer.InvariantCultureIgnoreCase) + return (null == instance || !instance.Properties.Any()) ? + Enumerable.Empty>() : + instance.Properties + .Where(property => + !(true == exclusions?.Contains(property.Name)) + && (false != inclusions?.Contains(property.Name))) + .Select(property => new System.Collections.Generic.KeyValuePair(property.Name, property.Value)); + } + + + internal static T GetValueForProperty(this System.Collections.Generic.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys, each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + internal static T GetValueForProperty(this System.Collections.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys.OfType(), each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static T GetValueForProperty(this System.Management.Automation.PSObject psObject, string propertyName, T defaultValue, System.Func converter) + { + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return property == null ? defaultValue : (T)converter(property.Value); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static bool Contains(this System.Management.Automation.PSObject psObject, string propertyName) + { + bool result = false; + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + result = property == null ? false : true; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return result; + } + } +} diff --git a/src/Peering/generated/runtime/UndeclaredResponseException.cs b/src/Peering/generated/runtime/UndeclaredResponseException.cs new file mode 100644 index 000000000000..cc9e95262858 --- /dev/null +++ b/src/Peering/generated/runtime/UndeclaredResponseException.cs @@ -0,0 +1,112 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + using static Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Extensions; + + public class RestException : Exception, IDisposable + { + public System.Net.HttpStatusCode StatusCode { get; set; } + public string Code { get; protected set; } + protected string message; + public HttpRequestMessage RequestMessage { get; protected set; } + public HttpResponseHeaders ResponseHeaders { get; protected set; } + + public string ResponseBody { get; protected set; } + public string ClientRequestId { get; protected set; } + public string RequestId { get; protected set; } + + public override string Message => message; + public string Action { get; protected set; } + + public RestException(System.Net.Http.HttpResponseMessage response) + { + StatusCode = response.StatusCode; + //CloneWithContent will not work here since the content is disposed after sendAsync + //Besides, it seems there is no need for the request content cloned here. + RequestMessage = response.RequestMessage.Clone(); + ResponseBody = response.Content.ReadAsStringAsync().Result; + ResponseHeaders = response.Headers; + + RequestId = response.GetFirstHeader("x-ms-request-id"); + ClientRequestId = response.GetFirstHeader("x-ms-client-request-id"); + + try + { + // try to parse the body as JSON, and see if a code and message are in there. + var json = Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json.JsonObject; + + // error message could be in properties.statusMessage + { message = If(json?.Property("properties"), out var p) + && If(p?.PropertyT("statusMessage"), out var sm) + ? (string)sm : (string)Message; } + + // see if there is an error block in the body + json = json?.Property("error") ?? json; + + { Code = If(json?.PropertyT("code"), out var c) ? (string)c : (string)StatusCode.ToString(); } + { message = If(json?.PropertyT("message"), out var m) ? (string)m : (string)Message; } + { Action = If(json?.PropertyT("action"), out var a) ? (string)a : (string)Action; } + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // couldn't get the code/message from the body response. + // In this case, we will assume the response is the expected error message + if(!string.IsNullOrEmpty(ResponseBody)) { + message = ResponseBody; + } + } +#endif + if (string.IsNullOrEmpty(message)) + { + if (StatusCode >= System.Net.HttpStatusCode.BadRequest && StatusCode < System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Request Error, Status: {StatusCode}"; + } + else if (StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Server Error, Status: {StatusCode}"; + } + else + { + message = $"The server responded with an unrecognized response, Status: {StatusCode}"; + } + } + } + + public void Dispose() + { + ((IDisposable)RequestMessage).Dispose(); + } + } + + public class RestException : RestException + { + public T Error { get; protected set; } + public RestException(System.Net.Http.HttpResponseMessage response, T error) : base(response) + { + Error = error; + } + } + + + public class UndeclaredResponseException : RestException + { + public UndeclaredResponseException(System.Net.Http.HttpResponseMessage response) : base(response) + { + + } + } +} \ No newline at end of file diff --git a/src/Peering/generated/runtime/Writers/JsonWriter.cs b/src/Peering/generated/runtime/Writers/JsonWriter.cs new file mode 100644 index 000000000000..9eef09aa4b3e --- /dev/null +++ b/src/Peering/generated/runtime/Writers/JsonWriter.cs @@ -0,0 +1,223 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Web; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.Json +{ + internal class JsonWriter + { + const string indentation = " "; // 2 spaces + + private readonly bool pretty; + private readonly TextWriter writer; + + protected int currentLevel = 0; + + internal JsonWriter(TextWriter writer, bool pretty = true) + { + this.writer = writer ?? throw new ArgumentNullException(nameof(writer)); + this.pretty = pretty; + } + + internal void WriteNode(JsonNode node) + { + switch (node.Type) + { + case JsonType.Array: WriteArray((IEnumerable)node); break; + case JsonType.Object: WriteObject((JsonObject)node); break; + + // Primitives + case JsonType.Binary: WriteBinary((XBinary)node); break; + case JsonType.Boolean: WriteBoolean((bool)node); break; + case JsonType.Date: WriteDate((JsonDate)node); break; + case JsonType.Null: WriteNull(); break; + case JsonType.Number: WriteNumber((JsonNumber)node); break; + case JsonType.String: WriteString(node); break; + } + } + + internal void WriteArray(IEnumerable array) + { + currentLevel++; + + writer.Write('['); + + bool doIndentation = false; + + if (pretty) + { + foreach (var node in array) + { + if (node.Type == JsonType.Object || node.Type == JsonType.Array) + { + doIndentation = true; + + break; + } + } + } + + bool isFirst = true; + + foreach (JsonNode node in array) + { + if (!isFirst) writer.Write(','); + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + WriteNode(node); + + isFirst = false; + } + + currentLevel--; + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + writer.Write(']'); + } + + internal void WriteIndent() + { + if (pretty) + { + writer.Write(Environment.NewLine); + + for (int level = 0; level < currentLevel; level++) + { + writer.Write(indentation); + } + } + } + + internal void WriteObject(JsonObject obj) + { + currentLevel++; + + writer.Write('{'); + + bool isFirst = true; + + foreach (var field in obj) + { + if (!isFirst) writer.Write(','); + + WriteIndent(); + + WriteFieldName(field.Key); + + writer.Write(':'); + + if (pretty) + { + writer.Write(' '); + } + + // Write the field value + WriteNode(field.Value); + + isFirst = false; + } + + currentLevel--; + + WriteIndent(); + + writer.Write('}'); + } + + internal void WriteFieldName(string fieldName) + { + writer.Write('"'); + writer.Write(HttpUtility.JavaScriptStringEncode(fieldName)); + writer.Write('"'); + } + + #region Primitives + + internal void WriteBinary(XBinary value) + { + writer.Write('"'); + writer.Write(value.ToString()); + writer.Write('"'); + } + + internal void WriteBoolean(bool value) + { + writer.Write(value ? "true" : "false"); + } + + internal void WriteDate(JsonDate date) + { + if (date.ToDateTime().Year == 1) + { + WriteNull(); + } + else + { + writer.Write('"'); + writer.Write(date.ToIsoString()); + writer.Write('"'); + } + } + + internal void WriteNull() + { + writer.Write("null"); + } + + internal void WriteNumber(JsonNumber number) + { + if (number.Overflows) + { + writer.Write('"'); + writer.Write(number.Value); + writer.Write('"'); + } + else + { + writer.Write(number.Value); + } + } + + internal void WriteString(string text) + { + if (text == null) + { + WriteNull(); + } + else + { + writer.Write('"'); + + writer.Write(HttpUtility.JavaScriptStringEncode(text)); + + writer.Write('"'); + } + } + + #endregion + } +} + + +// TODO: Replace with System.Text.Json when available diff --git a/src/Peering/generated/runtime/delegates.cs b/src/Peering/generated/runtime/delegates.cs new file mode 100644 index 000000000000..ef7700a25ec1 --- /dev/null +++ b/src/Peering/generated/runtime/delegates.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData=System.Func; + + public delegate Task SendAsync(HttpRequestMessage request, IEventListener callback); + public delegate Task SendAsyncStep(HttpRequestMessage request, IEventListener callback, ISendAsync next); + public delegate Task SignalEvent(string id, CancellationToken token, GetEventData getEventData); + public delegate Task Event(EventData message); + public delegate void SynchEvent(EventData message); + public delegate Task OnResponse(Response message); + public delegate Task OnResponse(Response message); +} \ No newline at end of file diff --git a/src/Peering/help/Az.Peering.md b/src/Peering/help/Az.Peering.md new file mode 100644 index 000000000000..ff5ed07c7b42 --- /dev/null +++ b/src/Peering/help/Az.Peering.md @@ -0,0 +1,130 @@ +--- +Module Name: Az.Peering +Module Guid: 78c6a853-5ea3-4374-9c5f-5b532d62c892 +Download Help Link: https://learn.microsoft.com/powershell/module/az.peering +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.Peering Module +## Description +Microsoft Azure PowerShell: Peering cmdlets + +## Az.Peering Cmdlets +### [Get-AzPeering](Get-AzPeering.md) +Gets an existing peering with the specified name under the given subscription and resource group. + +### [Get-AzPeeringAsn](Get-AzPeeringAsn.md) +Gets the peer ASN with the specified name under the given subscription. + +### [Get-AzPeeringCdnPrefix](Get-AzPeeringCdnPrefix.md) +Lists all of the advertised prefixes for the specified peering location + +### [Get-AzPeeringConnectionMonitorTest](Get-AzPeeringConnectionMonitorTest.md) +Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service. + +### [Get-AzPeeringLegacy](Get-AzPeeringLegacy.md) +Lists all of the legacy peerings under the given subscription matching the specified kind and location. + +### [Get-AzPeeringLocation](Get-AzPeeringLocation.md) +Lists all of the available peering locations for the specified kind of peering. + +### [Get-AzPeeringReceivedRoute](Get-AzPeeringReceivedRoute.md) +Lists the prefixes received over the specified peering under the given subscription and resource group. + +### [Get-AzPeeringRegisteredAsn](Get-AzPeeringRegisteredAsn.md) +Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + +### [Get-AzPeeringRegisteredPrefix](Get-AzPeeringRegisteredPrefix.md) +Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. + +### [Get-AzPeeringRpUnbilledPrefix](Get-AzPeeringRpUnbilledPrefix.md) +Lists all of the RP unbilled prefixes for the specified peering + +### [Get-AzPeeringService](Get-AzPeeringService.md) +Gets an existing peering service with the specified name under the given subscription and resource group. + +### [Get-AzPeeringServiceCountry](Get-AzPeeringServiceCountry.md) +Lists all of the available countries for peering service. + +### [Get-AzPeeringServiceLocation](Get-AzPeeringServiceLocation.md) +Lists all of the available locations for peering service. + +### [Get-AzPeeringServicePrefix](Get-AzPeeringServicePrefix.md) +Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + +### [Get-AzPeeringServiceProvider](Get-AzPeeringServiceProvider.md) +Lists all of the available peering service locations for the specified kind of peering. + +### [Initialize-AzPeeringServiceConnectionMonitor](Initialize-AzPeeringServiceConnectionMonitor.md) +Initialize Peering Service for Connection Monitor functionality + +### [New-AzPeering](New-AzPeering.md) +Creates a new peering or updates an existing peering with the specified name under the given subscription and resource group. + +### [New-AzPeeringAsn](New-AzPeeringAsn.md) +Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + +### [New-AzPeeringCheckServiceProviderAvailabilityInputObject](New-AzPeeringCheckServiceProviderAvailabilityInputObject.md) +Create an in-memory object for CheckServiceProviderAvailabilityInput. + +### [New-AzPeeringConnectionMonitorTest](New-AzPeeringConnectionMonitorTest.md) +Creates or updates a connection monitor test with the specified name under the given subscription, resource group and peering service. + +### [New-AzPeeringContactDetailObject](New-AzPeeringContactDetailObject.md) +Create an in-memory object for ContactDetail. + +### [New-AzPeeringDirectConnectionObject](New-AzPeeringDirectConnectionObject.md) +Create an in-memory object for DirectConnection. + +### [New-AzPeeringExchangeConnectionObject](New-AzPeeringExchangeConnectionObject.md) +Create an in-memory object for ExchangeConnection. + +### [New-AzPeeringRegisteredAsn](New-AzPeeringRegisteredAsn.md) +Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + +### [New-AzPeeringRegisteredPrefix](New-AzPeeringRegisteredPrefix.md) +Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + +### [New-AzPeeringService](New-AzPeeringService.md) +Creates a new peering service or updates an existing peering with the specified name under the given subscription and resource group. + +### [New-AzPeeringServicePrefix](New-AzPeeringServicePrefix.md) +Creates a new prefix with the specified name under the given subscription, resource group and peering service. + +### [Remove-AzPeering](Remove-AzPeering.md) +Deletes an existing peering with the specified name under the given subscription and resource group. + +### [Remove-AzPeeringAsn](Remove-AzPeeringAsn.md) +Deletes an existing peer ASN with the specified name under the given subscription. + +### [Remove-AzPeeringConnectionMonitorTest](Remove-AzPeeringConnectionMonitorTest.md) +Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service. + +### [Remove-AzPeeringRegisteredAsn](Remove-AzPeeringRegisteredAsn.md) +Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. + +### [Remove-AzPeeringRegisteredPrefix](Remove-AzPeeringRegisteredPrefix.md) +Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. + +### [Remove-AzPeeringService](Remove-AzPeeringService.md) +Deletes an existing peering service with the specified name under the given subscription and resource group. + +### [Remove-AzPeeringServicePrefix](Remove-AzPeeringServicePrefix.md) +Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. + +### [Start-AzPeeringInvokeLookingGlass](Start-AzPeeringInvokeLookingGlass.md) +Run looking glass functionality + +### [Test-AzPeeringRegisteredPrefix](Test-AzPeeringRegisteredPrefix.md) +Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. + +### [Test-AzPeeringServiceProviderAvailability](Test-AzPeeringServiceProviderAvailability.md) +Checks if the peering service provider is present within 1000 miles of customer's location + +### [Update-AzPeering](Update-AzPeering.md) +Updates tags for a peering with the specified name under the given subscription and resource group. + +### [Update-AzPeeringService](Update-AzPeeringService.md) +Updates tags for a peering service with the specified name under the given subscription and resource group. + diff --git a/src/Peering/help/Get-AzPeering.md b/src/Peering/help/Get-AzPeering.md new file mode 100644 index 000000000000..028446efe75e --- /dev/null +++ b/src/Peering/help/Get-AzPeering.md @@ -0,0 +1,186 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeering +schema: 2.0.0 +--- + +# Get-AzPeering + +## SYNOPSIS +Gets an existing peering with the specified name under the given subscription and resource group. + +## SYNTAX + +### List1 (Default) +``` +Get-AzPeering [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzPeering -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzPeering -InputObject [-DefaultProfile ] [] +``` + +### List +``` +Get-AzPeering -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets an existing peering with the specified name under the given subscription and resource group. + +## EXAMPLES + +### Example 1: List all peerings +```powershell + Get-AzPeering +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +DemoComp1 Premium_Direct_Free Direct Dallas Succeeded South Central US +DemoPeering Premium_Direct_Free Direct Dallas Succeeded South Central US +TestEdgeZone Premium_Direct_Free Direct Atlanta Succeeded East US 2 +MapsIxRs Premium_Direct_Free Direct Ashburn Succeeded East US +DemoMapsConfig Premium_Direct_Free Direct Seattle Succeeded West US 2 +testexchange Basic_Exchange_Free Exchange Amsterdam Succeeded West Europe +TestPeer1 Basic_Direct_Free Direct Amsterdam Succeeded West Europe +test1 Basic_Direct_Free Direct Athens Succeeded France Central +``` + +List all peerings in subscription + +### Example 2: Get specific peering by name and resource group +```powershell +Get-AzPeering -Name DemoPeering -ResourceGroupName DemoRG +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +DemoPeering Premium_Direct_Free Direct Dallas Succeeded South Central US +``` + +Get a specific peering by resource group and name + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: PeeringName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringAsn.md b/src/Peering/help/Get-AzPeeringAsn.md new file mode 100644 index 000000000000..de1708b544cd --- /dev/null +++ b/src/Peering/help/Get-AzPeeringAsn.md @@ -0,0 +1,158 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringasn +schema: 2.0.0 +--- + +# Get-AzPeeringAsn + +## SYNOPSIS +Gets the peer ASN with the specified name under the given subscription. + +## SYNTAX + +### List (Default) +``` +Get-AzPeeringAsn [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzPeeringAsn -Name [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzPeeringAsn -InputObject [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the peer ASN with the specified name under the given subscription. + +## EXAMPLES + +### Example 1: List PeerAsns +```powershell +Get-AzPeeringAsn +``` + +```output +Name PeerName PropertiesPeerAsn ValidationState PeerContactDetail +---- -------- ----------------- --------------- ----------------- +ContosoEdgeTest Contoso 65000 Approved {{…}} + +``` + +List all the peer asns under subscription + +### Example 2: Get Specific PeerAsn +```powershell +Get-AzPeeringAsn -Name ContosoEdgeTest +``` + +```output +Name PeerName PropertiesPeerAsn ValidationState PeerContactDetail +---- -------- ----------------- --------------- ----------------- +ContosoEdgeTest Contoso 65000 Approved {{…}} +``` + +Get peer asn by name + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The peer ASN name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: PeerAsnName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringCdnPrefix.md b/src/Peering/help/Get-AzPeeringCdnPrefix.md new file mode 100644 index 000000000000..bfebe15358cd --- /dev/null +++ b/src/Peering/help/Get-AzPeeringCdnPrefix.md @@ -0,0 +1,106 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringcdnprefix +schema: 2.0.0 +--- + +# Get-AzPeeringCdnPrefix + +## SYNOPSIS +Lists all of the advertised prefixes for the specified peering location + +## SYNTAX + +``` +Get-AzPeeringCdnPrefix -PeeringLocation [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Lists all of the advertised prefixes for the specified peering location + +## EXAMPLES + +### Example 1: Get Cdn prefixes +```powershell +Get-AzPeeringCdnPrefix -PeeringLocation Seattle +``` + +```output +Prefix AzureRegion AzureService IsPrimaryRegion BgpCommunity +------ ----------- ------------ --------------- ------------ +20.157.110.0/24 West US 2 AzureCompute True 8069:51026 +20.157.118.0/24 West US 2 AzureCompute True 8069:51026 +20.157.125.0/24 West US 2 AzureCompute True 8069:51026 +20.157.180.0/24 West US 2 AzureStorage True 8069:52026 +20.157.25.0/24 West US 2 AzureCompute True 8069:51026 +20.157.50.0/23 West US 2 AzureStorage True 8069:52026 +20.47.120.0/23 West US 2 AzureCompute True 8069:51026 +20.47.62.0/23 West US 2 AzureStorage True 8069:52026 +``` + +Get all cdn prefixes for subscription + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringLocation +The peering location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICdnPeeringPrefix + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringConnectionMonitorTest.md b/src/Peering/help/Get-AzPeeringConnectionMonitorTest.md new file mode 100644 index 000000000000..3860af70cc4c --- /dev/null +++ b/src/Peering/help/Get-AzPeeringConnectionMonitorTest.md @@ -0,0 +1,191 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringconnectionmonitortest +schema: 2.0.0 +--- + +# Get-AzPeeringConnectionMonitorTest + +## SYNOPSIS +Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service. + +## SYNTAX + +### List (Default) +``` +Get-AzPeeringConnectionMonitorTest -PeeringServiceName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzPeeringConnectionMonitorTest -Name -PeeringServiceName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzPeeringConnectionMonitorTest -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service. + +## EXAMPLES + +### Example 1: Lists all connection monitor tests +```powershell + Get-AzPeeringConnectionMonitorTest -ResourceGroupName DemoRG -PeeringServiceName DRTest +``` + +```output +SourceAgent Destination DestinationPort TestFrequency Sucessful ProvisioningState +----------- ----------- --------------- ------------- --------- ----------------- +Agent 1 1.1.1.1 80 30 True Succeeded +Agent 2 8.8.8.8 80 30 True Succeeded +``` + +Lists all connection monitor test objects + +### Example 2: Get single connection monitor test +```powershell + Get-AzPeeringConnectionMonitorTest -ResourceGroupName DemoRG -PeeringServiceName DRTest -Name TestName +``` + +```output +SourceAgent Destination DestinationPort TestFrequency Sucessful ProvisioningState +----------- ----------- --------------- ------------- --------- ----------------- +Agent 1 1.1.1.1 80 30 True Succeeded +``` + +Gets a single connection monitor test + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the connection monitor test + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: ConnectionMonitorTestName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceName +The name of the peering service. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringLegacy.md b/src/Peering/help/Get-AzPeeringLegacy.md new file mode 100644 index 000000000000..d7b05c2a838e --- /dev/null +++ b/src/Peering/help/Get-AzPeeringLegacy.md @@ -0,0 +1,146 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringlegacy +schema: 2.0.0 +--- + +# Get-AzPeeringLegacy + +## SYNOPSIS +Lists all of the legacy peerings under the given subscription matching the specified kind and location. + +## SYNTAX + +``` +Get-AzPeeringLegacy -Kind -PeeringLocation [-SubscriptionId ] + [-Asn ] [-DirectPeeringType ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists all of the legacy peerings under the given subscription matching the specified kind and location. + +## EXAMPLES + +### Example 1: Gets legacy peering object +```powershell +Get-AzPeeringLegacy -Kind Direct -PeeringLocation Seattle +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +DemoComp1 Premium_Direct_Free Direct Dallas Succeeded South Central US +DemoPeering Premium_Direct_Free Direct Dallas Succeeded South Central US +TestEdgeZone Premium_Direct_Free Direct Atlanta Succeeded East US 2 +``` + +Gets legacy peering object + +## PARAMETERS + +### -Asn +The ASN number associated with a legacy peering. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DirectPeeringType +The direct peering type. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Kind +The kind of the peering. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LegacyPeeringsKind +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringLocation +The location of the peering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringLocation.md b/src/Peering/help/Get-AzPeeringLocation.md new file mode 100644 index 000000000000..e175dbb9d999 --- /dev/null +++ b/src/Peering/help/Get-AzPeeringLocation.md @@ -0,0 +1,123 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringlocation +schema: 2.0.0 +--- + +# Get-AzPeeringLocation + +## SYNOPSIS +Lists all of the available peering locations for the specified kind of peering. + +## SYNTAX + +``` +Get-AzPeeringLocation -Kind [-SubscriptionId ] + [-DirectPeeringType ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists all of the available peering locations for the specified kind of peering. + +## EXAMPLES + +### Example 1: Get all direct peering locations +```powershell +Get-AzPeeringLocation -Kind Direct +``` + +```output +Get-AzPeeringLocation -Kind Direct + +Name Country AzureRegion Kind +---- ------- ----------- ---- +Amsterdam NL West Europe Direct +Ashburn US East US Direct +Athens GR France Central Direct +Atlanta US East US 2 Direct +Auckland NZ Australia East Direct +Barcelona ES France Central Direct +Berlin DE West Europe Direct +... +``` + +Gets all peering locations for direct peers + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DirectPeeringType +The type of direct peering. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsDirectPeeringType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Kind +The kind of the peering. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.PeeringLocationsKind +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringLocation + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringReceivedRoute.md b/src/Peering/help/Get-AzPeeringReceivedRoute.md new file mode 100644 index 000000000000..eb23351050fa --- /dev/null +++ b/src/Peering/help/Get-AzPeeringReceivedRoute.md @@ -0,0 +1,224 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringreceivedroute +schema: 2.0.0 +--- + +# Get-AzPeeringReceivedRoute + +## SYNOPSIS +Lists the prefixes received over the specified peering under the given subscription and resource group. + +## SYNTAX + +``` +Get-AzPeeringReceivedRoute -PeeringName -ResourceGroupName [-SubscriptionId ] + [-AsPath ] [-OriginAsValidationState ] [-Prefix ] [-RpkiValidationState ] + [-SkipToken ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists the prefixes received over the specified peering under the given subscription and resource group. + +## EXAMPLES + +### Example 1: Get all received routes for a specific peering +```powershell +Get-AzPeeringReceivedRoute -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +```output +AsPath NextHop OriginAsValidationState Prefix ReceivedTimestamp RpkiValidationState TrustAnchor +------ ------- ----------------------- ------ ----------------- ------------------- ----------- +7018 13335 12.90.152.69 Valid 1.0.0.0/24 2022-12-05T11:51:51.2062620Z Valid None +7018 13335 12.90.152.69 Valid 1.1.1.0/24 2022-12-05T11:51:51.2062620Z Valid None +7018 4837 4808 12.90.152.69 Valid 1.119.192.0/21 2021-12-07T05:21:11.7043790Z Unknown None +7018 4837 4808 12.90.152.69 Valid 1.119.200.0/22 2021-12-07T05:21:11.7043790Z Unknown None +7018 4837 4808 59034 12.90.152.69 Valid 1.119.204.0/24 2021-12-07T05:21:13.7045170Z Unknown None +7018 9680 9680 3462 12.90.152.69 Valid 1.160.0.0/12 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.160.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.161.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.162.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.163.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 15169 396982 12.90.152.69 Unknown 1.179.112.0/20 2021-12-07T05:21:16.7056160Z Unknown None +7018 9680 9680 3462 12.90.152.69 Valid 1.164.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.165.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.166.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.167.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +... +``` + +Gets all the received routes for a specific peering + +### Example 2: Filter received routes based on optional parameters +```powershell +Get-AzPeeringReceivedRoute -PeeringName DemoPeering -ResourceGroupName DemoRG -AsPath "7018 9680 9680 3462" +``` + +```output +AsPath NextHop OriginAsValidationState Prefix ReceivedTimestamp RpkiValidationState TrustAnchor +------ ------- ----------------------- ------ ----------------- ------------------- ----------- +7018 9680 9680 3462 12.90.152.69 Valid 1.160.0.0/12 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.160.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.161.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.162.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.163.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +7018 9680 9680 3462 12.90.152.69 Valid 1.164.0.0/16 2022-11-29T07:46:45.2062680Z Valid None +... +``` + +Gets all received routes of a peering with a specific AsPath + +## PARAMETERS + +### -AsPath +The optional AS path that can be used to filter the routes. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OriginAsValidationState +The optional origin AS validation state that can be used to filter the routes. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringName +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Prefix +The optional prefix that can be used to filter the routes. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RpkiValidationState +The optional RPKI validation state that can be used to filter the routes. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipToken +The optional page continuation token that is used in the event of paginated result. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringReceivedRoute + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringRegisteredAsn.md b/src/Peering/help/Get-AzPeeringRegisteredAsn.md new file mode 100644 index 000000000000..ffdc07ccf8a5 --- /dev/null +++ b/src/Peering/help/Get-AzPeeringRegisteredAsn.md @@ -0,0 +1,191 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringregisteredasn +schema: 2.0.0 +--- + +# Get-AzPeeringRegisteredAsn + +## SYNOPSIS +Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + +## SYNTAX + +### List (Default) +``` +Get-AzPeeringRegisteredAsn -PeeringName -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzPeeringRegisteredAsn -Name -PeeringName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzPeeringRegisteredAsn -InputObject [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + +## EXAMPLES + +### Example 1: List all registered asns for peering +```powershell +Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo +``` + +```output +Name Asn PeeringServicePrefixKey ProvisioningState +---- --- ----------------------- ----------------- +fgfg 6500 767c9f30-7388-49ef-ba8e-e2d16d1c08e4 Succeeded +homedepottest 65000 32259ee0-ea01-495e-8279-06c24ef7aae0 Succeeded +JonOrmondTest 62540 e3f552c5-909e-434b-8fab-93e524a1aeed Succeeded +``` + +Lists all registered asn's for a peering + +### Example 2: Get specific registered asn for peering +```powershell +Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Name fgfg +``` + +```output +Name Asn PeeringServicePrefixKey ProvisioningState +---- --- ----------------------- ----------------- +fgfg 6500 767c9f30-7388-49ef-ba8e-e2d16d1c08e4 Succeeded +``` + +Gets a specific registered asn for a peering by name + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the registered ASN. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: RegisteredAsnName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringName +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringRegisteredPrefix.md b/src/Peering/help/Get-AzPeeringRegisteredPrefix.md new file mode 100644 index 000000000000..3a1561ef8ed6 --- /dev/null +++ b/src/Peering/help/Get-AzPeeringRegisteredPrefix.md @@ -0,0 +1,194 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringregisteredprefix +schema: 2.0.0 +--- + +# Get-AzPeeringRegisteredPrefix + +## SYNOPSIS +Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. + +## SYNTAX + +### List (Default) +``` +Get-AzPeeringRegisteredPrefix -PeeringName -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzPeeringRegisteredPrefix -Name -PeeringName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzPeeringRegisteredPrefix -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. + +## EXAMPLES + +### Example 1: List all registered prefixes for a peering +```powershell +Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +```output +Name Prefix PeeringServicePrefixKey PrefixValidationState ProvisioningState +---- ------ ----------------------- --------------------- ----------------- +accessibilityTesting1 240.0.0.0/24 f5947454-80e3-4ce5-bcb3-2501537b6952 Failed Succeeded +accessibilityTesting2 240.0.1.0/24 249aa0dd-6177-4105-94fe-dfefcbf5ab48 Failed Succeeded +accessibilityTesting3 240.0.2.0/24 4fb59e9e-d4eb-4847-b2ad-9939edda750b Failed Succeeded +accessibilityTesting4 240.0.4.0/24 b725f16c-759b-4144-93ed-ed4eb89cb8f7 Failed Succeeded +accessibilityTesting5 240.0.3.0/24 bb1262ca-0b31-45f3-a301-105b0615b21c Failed Succeeded +``` + +List all registered prefixes + +### Example 2: Get specific registered prefix for a peering +```powershell +Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG -Name accessibilityTesting1 +``` + +```output +Name Prefix PeeringServicePrefixKey PrefixValidationState ProvisioningState +---- ------ ----------------------- --------------------- ----------------- +accessibilityTesting1 240.0.0.0/24 f5947454-80e3-4ce5-bcb3-2501537b6952 Failed Succeeded +``` + +Get a specific registered prefix by name + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the registered prefix. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: RegisteredPrefixName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringName +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringRpUnbilledPrefix.md b/src/Peering/help/Get-AzPeeringRpUnbilledPrefix.md new file mode 100644 index 000000000000..c3891600b0c6 --- /dev/null +++ b/src/Peering/help/Get-AzPeeringRpUnbilledPrefix.md @@ -0,0 +1,131 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringrpunbilledprefix +schema: 2.0.0 +--- + +# Get-AzPeeringRpUnbilledPrefix + +## SYNOPSIS +Lists all of the RP unbilled prefixes for the specified peering + +## SYNTAX + +``` +Get-AzPeeringRpUnbilledPrefix -PeeringName -ResourceGroupName [-SubscriptionId ] + [-Consolidate] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists all of the RP unbilled prefixes for the specified peering + +## EXAMPLES + +### Example 1: List all unbilled prefixes for a peering +```powershell +Get-AzPeeringRpUnbilledPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +```output +Prefix AzureRegion PeerASN +------ ----------- ------- +2.16.0.0/13 West US 2 65010 +23.0.0.0/12 West US 2 65010 +... +``` + +Lists all the unbilled prefixes for a peering + +## PARAMETERS + +### -Consolidate +Flag to enable consolidation prefixes + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringName +The peering name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The Azure resource group name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IRpUnbilledPrefix + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringService.md b/src/Peering/help/Get-AzPeeringService.md new file mode 100644 index 000000000000..7d5c7477f8dc --- /dev/null +++ b/src/Peering/help/Get-AzPeeringService.md @@ -0,0 +1,206 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringservice +schema: 2.0.0 +--- + +# Get-AzPeeringService + +## SYNOPSIS +Gets an existing peering service with the specified name under the given subscription and resource group. + +## SYNTAX + +### List1 (Default) +``` +Get-AzPeeringService [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzPeeringService -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzPeeringService -InputObject [-DefaultProfile ] [] +``` + +### List +``` +Get-AzPeeringService -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets an existing peering service with the specified name under the given subscription and resource group. + +## EXAMPLES + +### Example 1: List all peering services under subscription +```powershell +Get-AzPeeringService +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +TestPrefixForAtlanta DemoRG Georgia MicrosoftEdge Succeeded East US 2 +TestExtension DemoRG Virginia MicrosoftEdge Succeeded East US +TestExtension2 DemoRG Virginia MicrosoftEdge Succeeded East US +DemoPeeringServiceInterCloudLondon DemoRG London InterCloud Succeeded UK South +DRTestInterCloud DemoRG Ile-de-France InterCloud Succeeded UK South +Gaurav Thareja DemoRG Ile-de-France InterCloud Succeeded UK South +TestDRInterCloudZurich DemoRG Zurich InterCloud Succeeded France Central +DRTest DemoRG Ile-de-France InterCloud Succeeded France Central +``` + +Lists all peering services under default subscription + +### Example 2: List all peering services under a specific resource group +```powershell +Get-AzPeeringService -ResourceGroupName DemoRG +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +TestPrefixForAtlanta DemoRG Georgia MicrosoftEdge Succeeded East US 2 +TestExtension DemoRG Virginia MicrosoftEdge Succeeded East US +TestExtension2 DemoRG Virginia MicrosoftEdge Succeeded East US +DemoPeeringServiceInterCloudLondon DemoRG London InterCloud Succeeded UK South +DRTestInterCloud DemoRG Ile-de-France InterCloud Succeeded UK South +Gaurav Thareja DemoRG Ile-de-France InterCloud Succeeded UK South +TestDRInterCloudZurich DemoRG Zurich InterCloud Succeeded France Central +DRTest DemoRG Ile-de-France InterCloud Succeeded France Central +``` + +Lists all the peering services under a resource group + +### Example 3: List all peering services under a specific resource group +```powershell +Get-AzPeeringService -ResourceGroupName DemoRG -Name TestExtension +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +TestExtension DemoRG Virginia MicrosoftEdge Succeeded East US +``` + +Gets a peering service with matching name and resource group + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: PeeringServiceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringServiceCountry.md b/src/Peering/help/Get-AzPeeringServiceCountry.md new file mode 100644 index 000000000000..c06b24dcf6c2 --- /dev/null +++ b/src/Peering/help/Get-AzPeeringServiceCountry.md @@ -0,0 +1,98 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringservicecountry +schema: 2.0.0 +--- + +# Get-AzPeeringServiceCountry + +## SYNOPSIS +Lists all of the available countries for peering service. + +## SYNTAX + +``` +Get-AzPeeringServiceCountry [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists all of the available countries for peering service. + +## EXAMPLES + +### Example 1: Lists all the peering service countries +```powershell +Get-AzPeeringServiceCountry +``` + +```output +Name +---- +Australia +Belgium +Brazil +Canada +Denmark +Finland +France +Germany +Hong Kong +Japan +Kenya +Korea, South +Malaysia +Netherlands +New Zealand +... +``` + +Lists the countries available for peering service. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IResource + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringServiceLocation.md b/src/Peering/help/Get-AzPeeringServiceLocation.md new file mode 100644 index 000000000000..07ea967cc15d --- /dev/null +++ b/src/Peering/help/Get-AzPeeringServiceLocation.md @@ -0,0 +1,145 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringservicelocation +schema: 2.0.0 +--- + +# Get-AzPeeringServiceLocation + +## SYNOPSIS +Lists all of the available locations for peering service. + +## SYNTAX + +``` +Get-AzPeeringServiceLocation [-SubscriptionId ] [-Country ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Lists all of the available locations for peering service. + +## EXAMPLES + +### Example 1: List all peering service locations +```powershell +Get-AzPeeringServiceLocation +``` + +```output +Name State Country AzureRegion +---- ----- ------- ----------- +Obwalden Obwalden Switzerland France Central +Sankt Gallen Sankt Gallen Switzerland France Central +Schaffhausen Schaffhausen Switzerland France Central +Schwyz Schwyz Switzerland France Central +Solothurn Solothurn Switzerland France Central +Thurgau Thurgau Switzerland France Central +Ticino Ticino Switzerland France Central +Uri Uri Switzerland France Central +Valais Valais Switzerland France Central +Vaud Vaud Switzerland France Central +Zug Zug Switzerland France Central +Zurich Zurich Switzerland France Central +Aberdeen City Aberdeen City United Kingdom UK West +Angus Angus United Kingdom UK West +Antrim and Newtownabbey Antrim and Newtownabbey United Kingdom North Europe +Ards and North Down Ards and North Down United Kingdom North Europe +Argyll and Bute Argyll and Bute United Kingdom North Europe +Armagh, Banbridge and Craigavon Armagh, Banbridge and Craigavon United Kingdom North Europe +Barking and Dagenham Barking and Dagenham United Kingdom UK South +... +``` + +Retrieves all peering service locations + +### Example 2: List all peering service +```powershell +Get-AzPeeringServiceLocation -Country Japan +``` + +```output +Name State Country AzureRegion +---- ----- ------- ----------- +Aichi Aichi Japan Japan West +Akita Akita Japan Japan East +Aomori Aomori Japan Japan East +Chiba Chiba Japan Japan East +Ehime Ehime Japan Japan West +Fukui Fukui Japan Japan West +Fukuoka Fukuoka Japan Japan West +Fukushima Fukushima Japan Japan East +Gifu Gifu Japan Japan West +Gunma Gunma Japan Japan East +Hiroshima Hiroshima Japan Japan West +Hyogo Hyogo Japan Japan West +Ibaraki Ibaraki Japan Japan East +Ishikawa Ishikawa Japan Japan West +... +``` + +Retrieves all peering service locations for a specific country + +## PARAMETERS + +### -Country +The country of interest, in which the locations are to be present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceLocation + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringServicePrefix.md b/src/Peering/help/Get-AzPeeringServicePrefix.md new file mode 100644 index 000000000000..71f7cd5b3594 --- /dev/null +++ b/src/Peering/help/Get-AzPeeringServicePrefix.md @@ -0,0 +1,206 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringserviceprefix +schema: 2.0.0 +--- + +# Get-AzPeeringServicePrefix + +## SYNOPSIS +Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + +## SYNTAX + +### List (Default) +``` +Get-AzPeeringServicePrefix -PeeringServiceName -ResourceGroupName + [-SubscriptionId ] [-Expand ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzPeeringServicePrefix -Name -PeeringServiceName -ResourceGroupName + [-SubscriptionId ] [-Expand ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzPeeringServicePrefix -InputObject [-Expand ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + +## EXAMPLES + +### Example 1: List all peering service prefixes +```powershell +Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG +``` + +```output +Name Prefix Key PrefixValidationState LearnedType ProvisioningState +---- ------ --- --------------------- ----------- ----------------- +TestPrefix 91.194.255.0/24 6a7f0d42-e49c-4eea-a930-280610671c3f Failed None Succeeded +TestPrefix2 240.0.0.0/24 Failed None Succeeded +``` + +Lists all peering service prefixes for the peering service + +### Example 2: Get specific peering service prefix +```powershell +Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG -Name TestPrefix +``` + +```output +Name Prefix Key PrefixValidationState LearnedType ProvisioningState +---- ------ --- --------------------- ----------- ----------------- +TestPrefix 91.194.255.0/24 6a7f0d42-e49c-4eea-a930-280610671c3f Failed None Succeeded +``` + +Gets a specific peering service prefix + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Expand +The properties to be expanded. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the prefix. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: PrefixName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceName +The name of the peering service. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Get-AzPeeringServiceProvider.md b/src/Peering/help/Get-AzPeeringServiceProvider.md new file mode 100644 index 000000000000..453a2a8002ff --- /dev/null +++ b/src/Peering/help/Get-AzPeeringServiceProvider.md @@ -0,0 +1,98 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringserviceprovider +schema: 2.0.0 +--- + +# Get-AzPeeringServiceProvider + +## SYNOPSIS +Lists all of the available peering service locations for the specified kind of peering. + +## SYNTAX + +``` +Get-AzPeeringServiceProvider [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists all of the available peering service locations for the specified kind of peering. + +## EXAMPLES + +### Example 1: List all peering service providers +```powershell +Get-AzPeeringServiceProvider +``` + +```output +Name PeeringLocation ServiceProviderName +---- --------------- ------------------- +IIJ {Osaka, Tokyo} IIJ +NTTCom {Osaka, Tokyo} NTTCom +Kordia Limited {Auckland, Sydney} Kordia Limited +Liquid Telecommunications Ltd {Cape Town, Johannesburg, Nairobi} Liquid Telecommunications Ltd +InterCloud {london, Paris, Zurich, Geneva} InterCloud +Computer Concepts Limited {Auckland} Computer Concepts Limited +Singnet {singapore} Singnet +NTT Communications - Flexible InterConnect {Osaka, Tokyo} NTT Communications - Flexible InterConnect +NAPAfrica {Johannesburg, Cape Town} NAPAfrica +Vocusgroup NZ {Sydney, Auckland} Vocusgroup NZ +CMC NETWORKS {Johannesburg, Nairobi, cape Town} CMC NETWORKS +MainOne {Lisbon, Lagos} MainOne +Swisscom Switzerland Ltd {Geneva, Zurich} Swisscom Switzerland Ltd +DE-CIX {Frankfurt, Marseille, Newark, Madrid…} DE-CIX +Lumen Technologies {denver, los Angeles} Lumen Technologies +Colt Technology Services {Amsterdam, Barcelona, Berlin, Frankfurt…} Colt Technology Services +``` + +Lists all peering service providers + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServiceProvider + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/Initialize-AzPeeringServiceConnectionMonitor.md b/src/Peering/help/Initialize-AzPeeringServiceConnectionMonitor.md new file mode 100644 index 000000000000..83c75ca54147 --- /dev/null +++ b/src/Peering/help/Initialize-AzPeeringServiceConnectionMonitor.md @@ -0,0 +1,166 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/initialize-azpeeringserviceconnectionmonitor +schema: 2.0.0 +--- + +# Initialize-AzPeeringServiceConnectionMonitor + +## SYNOPSIS +Initialize Peering Service for Connection Monitor functionality + +## SYNTAX + +### Initialize (Default) +``` +Initialize-AzPeeringServiceConnectionMonitor [-SubscriptionId ] [-DefaultProfile ] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### InitializeViaIdentity +``` +Initialize-AzPeeringServiceConnectionMonitor -InputObject [-DefaultProfile ] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Initialize Peering Service for Connection Monitor functionality + +## EXAMPLES + +### Example 1: Initialize connection monitor functionality +```powershell +Initialize-AzPeeringServiceConnectionMonitor +``` + +Initialize connection monitor functionality + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: InitializeViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Initialize +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeering.md b/src/Peering/help/New-AzPeering.md new file mode 100644 index 000000000000..edd17f66db0d --- /dev/null +++ b/src/Peering/help/New-AzPeering.md @@ -0,0 +1,336 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/new-azpeering +schema: 2.0.0 +--- + +# New-AzPeering + +## SYNOPSIS +Creates a new peering or updates an existing peering with the specified name under the given subscription and resource group. + +## SYNTAX + +``` +New-AzPeering -Name -ResourceGroupName -Kind -Location + [-SubscriptionId ] [-DirectConnection ] [-DirectPeerAsnId ] + [-DirectPeeringType ] [-ExchangeConnection ] + [-ExchangePeerAsnId ] [-PeeringLocation ] [-Sku ] [-Tag ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Creates a new peering or updates an existing peering with the specified name under the given subscription and resource group. + +## EXAMPLES + +### Example 1: Create a new direct peering object +```powershell +$connection1 = New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 ... +$directConnections = ,$connection1 +New-AzPeering -Name TestPeeringPs -ResourceGroupName DemoRG -Kind Direct -Location "South Central US" -DirectConnection $directConnections -DirectPeeringType Cdn -DirectPeerAsnId $peerAsnId -PeeringLocation Dallas -Sku Premium_Direct_Unlimited +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +TestPeering Premium_Direct_Unlimited Direct Dallas Succeeded South Central US +``` + +Create a new direct peering object + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DirectConnection +The set of connections that constitute a direct peering. +To construct, see NOTES section for DIRECTCONNECTION properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IDirectConnection[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DirectPeerAsnId +The identifier of the referenced resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DirectPeeringType +The type of direct peering. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.DirectPeeringType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExchangeConnection +The set of connections that constitute an exchange peering. +To construct, see NOTES section for EXCHANGECONNECTION properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IExchangeConnection[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExchangePeerAsnId +The identifier of the referenced resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Kind +The kind of the peering. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Kind +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The location of the resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: PeeringName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringLocation +The location of the peering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Sku +The name of the peering SKU. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: SkuName + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +The resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + +## NOTES + +ALIASES + +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. + + +`DIRECTCONNECTION `: The set of connections that constitute a direct peering. + - `[BandwidthInMbps ]`: The bandwidth of the connection. + - `[BgpSessionMaxPrefixesAdvertisedV4 ]`: The maximum number of prefixes advertised over the IPv4 session. + - `[BgpSessionMaxPrefixesAdvertisedV6 ]`: The maximum number of prefixes advertised over the IPv6 session. + - `[BgpSessionMd5AuthenticationKey ]`: The MD5 authentication key of the session. + - `[BgpSessionMicrosoftSessionIPv4Address ]`: The IPv4 session address on Microsoft's end. + - `[BgpSessionMicrosoftSessionIPv6Address ]`: The IPv6 session address on Microsoft's end. + - `[BgpSessionPeerSessionIPv4Address ]`: The IPv4 session address on peer's end. + - `[BgpSessionPeerSessionIPv6Address ]`: The IPv6 session address on peer's end. + - `[BgpSessionPrefixV4 ]`: The IPv4 prefix that contains both ends' IPv4 addresses. + - `[BgpSessionPrefixV6 ]`: The IPv6 prefix that contains both ends' IPv6 addresses. + - `[ConnectionIdentifier ]`: The unique identifier (GUID) for the connection. + - `[PeeringDbFacilityId ]`: The PeeringDB.com ID of the facility at which the connection has to be set up. + - `[SessionAddressProvider ]`: The field indicating if Microsoft provides session ip addresses. + - `[UseForPeeringService ]`: The flag that indicates whether or not the connection is used for peering service. + +`EXCHANGECONNECTION `: The set of connections that constitute an exchange peering. + - `[BgpSessionMaxPrefixesAdvertisedV4 ]`: The maximum number of prefixes advertised over the IPv4 session. + - `[BgpSessionMaxPrefixesAdvertisedV6 ]`: The maximum number of prefixes advertised over the IPv6 session. + - `[BgpSessionMd5AuthenticationKey ]`: The MD5 authentication key of the session. + - `[BgpSessionMicrosoftSessionIPv4Address ]`: The IPv4 session address on Microsoft's end. + - `[BgpSessionMicrosoftSessionIPv6Address ]`: The IPv6 session address on Microsoft's end. + - `[BgpSessionPeerSessionIPv4Address ]`: The IPv4 session address on peer's end. + - `[BgpSessionPeerSessionIPv6Address ]`: The IPv6 session address on peer's end. + - `[BgpSessionPrefixV4 ]`: The IPv4 prefix that contains both ends' IPv4 addresses. + - `[BgpSessionPrefixV6 ]`: The IPv6 prefix that contains both ends' IPv6 addresses. + - `[ConnectionIdentifier ]`: The unique identifier (GUID) for the connection. + - `[PeeringDbFacilityId ]`: The PeeringDB.com ID of the facility at which the connection has to be set up. + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringAsn.md b/src/Peering/help/New-AzPeeringAsn.md new file mode 100644 index 000000000000..c4cb0eb714a0 --- /dev/null +++ b/src/Peering/help/New-AzPeeringAsn.md @@ -0,0 +1,189 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringasn +schema: 2.0.0 +--- + +# New-AzPeeringAsn + +## SYNOPSIS +Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + +## SYNTAX + +``` +New-AzPeeringAsn -Name [-SubscriptionId ] [-PeerAsn ] + [-PeerContactDetail ] [-PeerName ] [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + +## EXAMPLES + +### Example 1: Create a new peering asn +```powershell +$contactDetail = New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" +$PeerContactList = ,$contactDetail +New-AzPeeringAsn -Name PsTestAsn -PeerAsn 65001 -PeerContactDetail $PeerContactList -PeerName DemoPeering +``` + +```output +Name PeerName PropertiesPeerAsn ValidationState PeerContactDetail +---- -------- ----------------- --------------- ----------------- +PsTestAsn DemoPeering 65001 Pending {{… +``` + +Create a new peering asn with the specified properties + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The peer ASN name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: PeerAsnName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeerAsn +The Autonomous System Number (ASN) of the peer. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeerContactDetail +The contact details of the peer. +To construct, see NOTES section for PEERCONTACTDETAIL properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IContactDetail[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeerName +The name of the peer. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeerAsn + +## NOTES + +ALIASES + +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. + + +`PEERCONTACTDETAIL `: The contact details of the peer. + - `[Email ]`: The e-mail address of the contact. + - `[Phone ]`: The phone number of the contact. + - `[Role ]`: The role of the contact. + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringCheckServiceProviderAvailabilityInputObject.md b/src/Peering/help/New-AzPeeringCheckServiceProviderAvailabilityInputObject.md new file mode 100644 index 000000000000..6b9e79cd76c8 --- /dev/null +++ b/src/Peering/help/New-AzPeeringCheckServiceProviderAvailabilityInputObject.md @@ -0,0 +1,84 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringCheckServiceProviderAvailabilityInputObject +schema: 2.0.0 +--- + +# New-AzPeeringCheckServiceProviderAvailabilityInputObject + +## SYNOPSIS +Create an in-memory object for CheckServiceProviderAvailabilityInput. + +## SYNTAX + +``` +New-AzPeeringCheckServiceProviderAvailabilityInputObject [-PeeringServiceLocation ] + [-PeeringServiceProvider ] [] +``` + +## DESCRIPTION +Create an in-memory object for CheckServiceProviderAvailabilityInput. + +## EXAMPLES + +### Example 1: Create a check service provider availability object +```powershell +New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ +``` + +```output +PeeringServiceLocation PeeringServiceProvider +---------------------- ---------------------- +Osaka IIJ +``` + +Creates a CheckServiceProviderAvailabilityInputObject with the specified location and provider and stores it in memory + +## PARAMETERS + +### -PeeringServiceLocation +Gets or sets the peering service location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceProvider +Gets or sets the peering service provider. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.CheckServiceProviderAvailabilityInput + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringConnectionMonitorTest.md b/src/Peering/help/New-AzPeeringConnectionMonitorTest.md new file mode 100644 index 000000000000..bcd2152be0c0 --- /dev/null +++ b/src/Peering/help/New-AzPeeringConnectionMonitorTest.md @@ -0,0 +1,221 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringconnectionmonitortest +schema: 2.0.0 +--- + +# New-AzPeeringConnectionMonitorTest + +## SYNOPSIS +Creates or updates a connection monitor test with the specified name under the given subscription, resource group and peering service. + +## SYNTAX + +``` +New-AzPeeringConnectionMonitorTest -Name -PeeringServiceName -ResourceGroupName + [-SubscriptionId ] [-Destination ] [-DestinationPort ] [-SourceAgent ] + [-TestFrequencyInSec ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Creates or updates a connection monitor test with the specified name under the given subscription, resource group and peering service. + +## EXAMPLES + +### Example 1: Create a new connection monitor test +```powershell +New-AzPeeringConnectionMonitorTest -Name TestName -PeeringServiceName DRTest -ResourceGroupName DemoRG +``` + +```output +SourceAgent Destination DestinationPort TestFrequency Sucessful ProvisioningState +----------- ----------- --------------- ------------- --------- ----------------- +Agent 1 1.1.1.1 80 30 True Succeeded +``` + +Creates a connection monitor test for the peering service + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Destination +The Connection Monitor test destination + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DestinationPort +The Connection Monitor test destination port + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the connection monitor test + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: ConnectionMonitorTestName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceName +The name of the peering service. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceAgent +The Connection Monitor test source agent + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestFrequencyInSec +The Connection Monitor test frequency in seconds + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IConnectionMonitorTest + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringContactDetailObject.md b/src/Peering/help/New-AzPeeringContactDetailObject.md new file mode 100644 index 000000000000..019b97d53f2a --- /dev/null +++ b/src/Peering/help/New-AzPeeringContactDetailObject.md @@ -0,0 +1,98 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringContactDetailObject +schema: 2.0.0 +--- + +# New-AzPeeringContactDetailObject + +## SYNOPSIS +Create an in-memory object for ContactDetail. + +## SYNTAX + +``` +New-AzPeeringContactDetailObject [-Email ] [-Phone ] [-Role ] [] +``` + +## DESCRIPTION +Create an in-memory object for ContactDetail. + +## EXAMPLES + +### Example 1: Create a Contact Detail object +```powershell +New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" +``` + +```output +Email Phone Role +----- ----- ---- +abc@xyz.com 1234567890 Noc +``` + +Creates a ContactDetail object with the specified email phone and role stores it in memory + +## PARAMETERS + +### -Email +The e-mail address of the contact. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Phone +The phone number of the contact. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Role +The role of the contact. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.Role +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ContactDetail + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringDirectConnectionObject.md b/src/Peering/help/New-AzPeeringDirectConnectionObject.md new file mode 100644 index 000000000000..a63ed1d42ef6 --- /dev/null +++ b/src/Peering/help/New-AzPeeringDirectConnectionObject.md @@ -0,0 +1,270 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringDirectConnectionObject +schema: 2.0.0 +--- + +# New-AzPeeringDirectConnectionObject + +## SYNOPSIS +Create an in-memory object for DirectConnection. + +## SYNTAX + +``` +New-AzPeeringDirectConnectionObject [-BandwidthInMbps ] [-BgpSessionMaxPrefixesAdvertisedV4 ] + [-BgpSessionMaxPrefixesAdvertisedV6 ] [-BgpSessionMd5AuthenticationKey ] + [-BgpSessionMicrosoftSessionIPv4Address ] [-BgpSessionMicrosoftSessionIPv6Address ] + [-BgpSessionPeerSessionIPv4Address ] [-BgpSessionPeerSessionIPv6Address ] + [-BgpSessionPrefixV4 ] [-BgpSessionPrefixV6 ] [-ConnectionIdentifier ] + [-PeeringDbFacilityId ] [-SessionAddressProvider ] + [-UseForPeeringService ] [] +``` + +## DESCRIPTION +Create an in-memory object for DirectConnection. + +## EXAMPLES + +### Example 1: Create a direct connection object +```powershell +New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 1.1.1.1 -BgpSessionPeerSessionIPv4Address 1.1.1.0 -BgpSessionPrefixV4 1.1.1.1/31 -PeeringDbFacilityId 82 -SessionAddressProvider Peer -ConnectionIdentifier c111111111111 +``` + +```output +BandwidthInMbps ConnectionIdentifier ConnectionState ErrorMessage MicrosoftTrackingId PeeringDbFacilityId ProvisionedBandwidthInMbps ... [more fields] +--------------- -------------------- --------------- ------------ ------------------- ------------------- -------------------------- ... ------------- +10000 c111111111111 PendingApproval 82 + +``` + +Creates an in-memory direct connection object + +## PARAMETERS + +### -BandwidthInMbps +The bandwidth of the connection. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionMaxPrefixesAdvertisedV4 +The maximum number of prefixes advertised over the IPv4 session. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionMaxPrefixesAdvertisedV6 +The maximum number of prefixes advertised over the IPv6 session. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionMd5AuthenticationKey +The MD5 authentication key of the session. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionMicrosoftSessionIPv4Address +The IPv4 session address on Microsoft's end. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionMicrosoftSessionIPv6Address +The IPv6 session address on Microsoft's end. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionPeerSessionIPv4Address +The IPv4 session address on peer's end. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionPeerSessionIPv6Address +The IPv6 session address on peer's end. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionPrefixV4 +The IPv4 prefix that contains both ends' IPv4 addresses. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionPrefixV6 +The IPv6 prefix that contains both ends' IPv6 addresses. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConnectionIdentifier +The unique identifier (GUID) for the connection. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringDbFacilityId +The PeeringDB.com ID of the facility at which the connection has to be set up. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SessionAddressProvider +The field indicating if Microsoft provides session ip addresses. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.SessionAddressProvider +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UseForPeeringService +The flag that indicates whether or not the connection is used for peering service. + +```yaml +Type: System.Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.DirectConnection + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringExchangeConnectionObject.md b/src/Peering/help/New-AzPeeringExchangeConnectionObject.md new file mode 100644 index 000000000000..096476f60c52 --- /dev/null +++ b/src/Peering/help/New-AzPeeringExchangeConnectionObject.md @@ -0,0 +1,223 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.Peering/new-AzPeeringExchangeConnectionObject +schema: 2.0.0 +--- + +# New-AzPeeringExchangeConnectionObject + +## SYNOPSIS +Create an in-memory object for ExchangeConnection. + +## SYNTAX + +``` +New-AzPeeringExchangeConnectionObject [-BgpSessionMaxPrefixesAdvertisedV4 ] + [-BgpSessionMaxPrefixesAdvertisedV6 ] [-BgpSessionMd5AuthenticationKey ] + [-BgpSessionMicrosoftSessionIPv4Address ] [-BgpSessionMicrosoftSessionIPv6Address ] + [-BgpSessionPeerSessionIPv4Address ] [-BgpSessionPeerSessionIPv6Address ] + [-BgpSessionPrefixV4 ] [-BgpSessionPrefixV6 ] [-ConnectionIdentifier ] + [-PeeringDbFacilityId ] [] +``` + +## DESCRIPTION +Create an in-memory object for ExchangeConnection. + +## EXAMPLES + +### Example 1: Create an exchange connection object +```powershell +New-AzPeeringExchangeConnectionObject -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 1.1.1.1 -BgpSessionPeerSessionIPv4Address 1.1.1.0 -BgpSessionPrefixV4 1.1.1.1/31 -PeeringDbFacilityId 82 -ConnectionIdentifier c111111111111 +``` + +```output +ConnectionIdentifier ConnectionState ErrorMessage PeeringDbFacilityId ... [more fields] +-------------------- --------------- ------------ ------------------- ... ------------- +c111111111111 82 +``` + +Create a exchange connection object in memory + +## PARAMETERS + +### -BgpSessionMaxPrefixesAdvertisedV4 +The maximum number of prefixes advertised over the IPv4 session. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionMaxPrefixesAdvertisedV6 +The maximum number of prefixes advertised over the IPv6 session. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionMd5AuthenticationKey +The MD5 authentication key of the session. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionMicrosoftSessionIPv4Address +The IPv4 session address on Microsoft's end. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionMicrosoftSessionIPv6Address +The IPv6 session address on Microsoft's end. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionPeerSessionIPv4Address +The IPv4 session address on peer's end. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionPeerSessionIPv6Address +The IPv6 session address on peer's end. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionPrefixV4 +The IPv4 prefix that contains both ends' IPv4 addresses. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BgpSessionPrefixV6 +The IPv6 prefix that contains both ends' IPv6 addresses. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConnectionIdentifier +The unique identifier (GUID) for the connection. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringDbFacilityId +The PeeringDB.com ID of the facility at which the connection has to be set up. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ExchangeConnection + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringRegisteredAsn.md b/src/Peering/help/New-AzPeeringRegisteredAsn.md new file mode 100644 index 000000000000..89da7b373066 --- /dev/null +++ b/src/Peering/help/New-AzPeeringRegisteredAsn.md @@ -0,0 +1,176 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringregisteredasn +schema: 2.0.0 +--- + +# New-AzPeeringRegisteredAsn + +## SYNOPSIS +Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + +## SYNTAX + +``` +New-AzPeeringRegisteredAsn -Name -PeeringName -ResourceGroupName + [-SubscriptionId ] [-Asn ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + +## EXAMPLES + +### Example 1: Create registered asn +```powershell +New-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Asn 65001 +``` + +```output +Name Asn PeeringServicePrefixKey ProvisioningState +---- --- ----------------------- ----------------- +TestAsn 65001 45a8db73-4b7c-4800-bb0f-d304a747d6f1 Succeeded +``` + +Create a new registered asn for a peering + +## PARAMETERS + +### -Asn +The customer's ASN from which traffic originates. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the ASN. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: RegisteredAsnName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringName +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredAsn + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringRegisteredPrefix.md b/src/Peering/help/New-AzPeeringRegisteredPrefix.md new file mode 100644 index 000000000000..e1507f944ba8 --- /dev/null +++ b/src/Peering/help/New-AzPeeringRegisteredPrefix.md @@ -0,0 +1,176 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringregisteredprefix +schema: 2.0.0 +--- + +# New-AzPeeringRegisteredPrefix + +## SYNOPSIS +Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + +## SYNTAX + +``` +New-AzPeeringRegisteredPrefix -Name -PeeringName -ResourceGroupName + [-SubscriptionId ] [-Prefix ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + +## EXAMPLES + +### Example 1: Create a new registered prefix +```powershell +New-AzPeeringRegisteredPrefix -Name accessibilityTesting6 -PeeringName DemoPeering -ResourceGroupName DemoRG -Prefix 240.0.5.0/24 +``` + +```output +Name Prefix PeeringServicePrefixKey PrefixValidationState ProvisioningState +---- ------ ----------------------- --------------------- ----------------- +accessibilityTesting6 240.0.5.0/24 f5947454-80e3-4ce5-bcb3-2501537b6952 Pending Updating +``` + +Create a new registered prefix object + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the registered prefix. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: RegisteredPrefixName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringName +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Prefix +The customer's prefix from which traffic originates. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringService.md b/src/Peering/help/New-AzPeeringService.md new file mode 100644 index 000000000000..28a73e531c9b --- /dev/null +++ b/src/Peering/help/New-AzPeeringService.md @@ -0,0 +1,252 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringservice +schema: 2.0.0 +--- + +# New-AzPeeringService + +## SYNOPSIS +Creates a new peering service or updates an existing peering with the specified name under the given subscription and resource group. + +## SYNTAX + +``` +New-AzPeeringService -Name -ResourceGroupName -Location [-SubscriptionId ] + [-PeeringServiceLocation ] [-PeeringServiceProvider ] + [-ProviderBackupPeeringLocation ] [-ProviderPrimaryPeeringLocation ] [-Sku ] + [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Creates a new peering service or updates an existing peering with the specified name under the given subscription and resource group. + +## EXAMPLES + +### Example 1: Create a new peering service +```powershell +New-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG -Location "East US 2" -PeeringServiceLocation Georgia -PeeringServiceProvider MicrosoftEdge -ProviderPrimaryPeeringLocation Atlanta +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +TestPeeringService DemoRG Georgia MicrosoftEdge ProvisioningStarted East US 2 +``` + +Create a new peering service in the resource group + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The location of the resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the peering service. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: PeeringServiceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceLocation +The location (state/province) of the customer. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceProvider +The name of the service provider. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderBackupPeeringLocation +The backup peering (Microsoft/service provider) location to be used for customer traffic. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderPrimaryPeeringLocation +The primary peering (Microsoft/service provider) location to be used for customer traffic. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Sku +The name of the peering service SKU. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: SkuName + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +The resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/New-AzPeeringServicePrefix.md b/src/Peering/help/New-AzPeeringServicePrefix.md new file mode 100644 index 000000000000..b1f6d3a133dc --- /dev/null +++ b/src/Peering/help/New-AzPeeringServicePrefix.md @@ -0,0 +1,191 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/new-azpeeringserviceprefix +schema: 2.0.0 +--- + +# New-AzPeeringServicePrefix + +## SYNOPSIS +Creates a new prefix with the specified name under the given subscription, resource group and peering service. + +## SYNTAX + +``` +New-AzPeeringServicePrefix -Name -PeeringServiceName -ResourceGroupName + [-SubscriptionId ] [-PeeringServicePrefixKey ] [-Prefix ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Creates a new prefix with the specified name under the given subscription, resource group and peering service. + +## EXAMPLES + +### Example 1: Create Peering service prefix +```powershell +New-AzPeeringServicePrefix -Name TestPrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG -PeeringServicePrefixKey 6a7f0d42-e49c-4eea-a930-280610671c3f -Prefix 91.194.255.0/24 +``` + +```output +Name Prefix Key PrefixValidationState LearnedType ProvisioningState +---- ------ --- --------------------- ----------- ----------------- +TestPrefix 91.194.255.0/24 6a7f0d42-e49c-4eea-a930-280610671c3f Failed None Succeeded +``` + +Create a peering service prefix + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the prefix. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: PrefixName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceName +The name of the peering service. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServicePrefixKey +The peering service prefix key + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Prefix +The prefix from which your traffic originates. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringServicePrefix + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Peering/help/Remove-AzPeering.md b/src/Peering/help/Remove-AzPeering.md new file mode 100644 index 000000000000..3ff113521f86 --- /dev/null +++ b/src/Peering/help/Remove-AzPeering.md @@ -0,0 +1,196 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/remove-azpeering +schema: 2.0.0 +--- + +# Remove-AzPeering + +## SYNOPSIS +Deletes an existing peering with the specified name under the given subscription and resource group. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzPeering -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzPeering -InputObject [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Deletes an existing peering with the specified name under the given subscription and resource group. + +## EXAMPLES + +### Example 1: Remove peering +```powershell +Remove-AzPeering -Name TestPeering -ResourceGroupName DemoRG +``` + +Remove a peering from the given resource group + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: PeeringName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Remove-AzPeeringAsn.md b/src/Peering/help/Remove-AzPeeringAsn.md new file mode 100644 index 000000000000..5434af369bf1 --- /dev/null +++ b/src/Peering/help/Remove-AzPeeringAsn.md @@ -0,0 +1,181 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringasn +schema: 2.0.0 +--- + +# Remove-AzPeeringAsn + +## SYNOPSIS +Deletes an existing peer ASN with the specified name under the given subscription. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzPeeringAsn -Name [-SubscriptionId ] [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzPeeringAsn -InputObject [-DefaultProfile ] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an existing peer ASN with the specified name under the given subscription. + +## EXAMPLES + +### Example 1: Remove peer asn +```powershell +Remove-AzPeeringAsn -Name PsTestAsn +``` + +Removes peer asn with the name specified + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The peer ASN name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: PeerAsnName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Remove-AzPeeringConnectionMonitorTest.md b/src/Peering/help/Remove-AzPeeringConnectionMonitorTest.md new file mode 100644 index 000000000000..e8189d8171fb --- /dev/null +++ b/src/Peering/help/Remove-AzPeeringConnectionMonitorTest.md @@ -0,0 +1,211 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringconnectionmonitortest +schema: 2.0.0 +--- + +# Remove-AzPeeringConnectionMonitorTest + +## SYNOPSIS +Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzPeeringConnectionMonitorTest -Name -PeeringServiceName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzPeeringConnectionMonitorTest -InputObject [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service. + +## EXAMPLES + +### Example 1: Remove connection monitor test +```powershell +Remove-AzPeeringConnectionMonitorTest -Name TestName -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG +``` + +Removes the given connection monitor test from the peering service + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the connection monitor test + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: ConnectionMonitorTestName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceName +The name of the peering service. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Remove-AzPeeringRegisteredAsn.md b/src/Peering/help/Remove-AzPeeringRegisteredAsn.md new file mode 100644 index 000000000000..cb33c1840c57 --- /dev/null +++ b/src/Peering/help/Remove-AzPeeringRegisteredAsn.md @@ -0,0 +1,211 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringregisteredasn +schema: 2.0.0 +--- + +# Remove-AzPeeringRegisteredAsn + +## SYNOPSIS +Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzPeeringRegisteredAsn -Name -PeeringName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzPeeringRegisteredAsn -InputObject [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. + +## EXAMPLES + +### Example 1: Remove a registered asn from the peering +```powershell +Remove-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo +``` + +Remove a registered asn from the peering object + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the registered ASN. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: RegisteredAsnName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringName +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Remove-AzPeeringRegisteredPrefix.md b/src/Peering/help/Remove-AzPeeringRegisteredPrefix.md new file mode 100644 index 000000000000..2fa7e1464199 --- /dev/null +++ b/src/Peering/help/Remove-AzPeeringRegisteredPrefix.md @@ -0,0 +1,211 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringregisteredprefix +schema: 2.0.0 +--- + +# Remove-AzPeeringRegisteredPrefix + +## SYNOPSIS +Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzPeeringRegisteredPrefix -Name -PeeringName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzPeeringRegisteredPrefix -InputObject [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering. + +## EXAMPLES + +### Example 1: Remove registered prefix +```powershell +Remove-AzPeeringRegisteredPrefix -Name accessibilityTesting6 -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +Removes the specified registered prefix from peering + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the registered prefix. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: RegisteredPrefixName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringName +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Remove-AzPeeringService.md b/src/Peering/help/Remove-AzPeeringService.md new file mode 100644 index 000000000000..50081f201532 --- /dev/null +++ b/src/Peering/help/Remove-AzPeeringService.md @@ -0,0 +1,196 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringservice +schema: 2.0.0 +--- + +# Remove-AzPeeringService + +## SYNOPSIS +Deletes an existing peering service with the specified name under the given subscription and resource group. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzPeeringService -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzPeeringService -InputObject [-DefaultProfile ] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an existing peering service with the specified name under the given subscription and resource group. + +## EXAMPLES + +### Example 1: Remove peering service +```powershell +Remove-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG +``` + +Removes a peering service from the given resource group + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the peering service. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: PeeringServiceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Remove-AzPeeringServicePrefix.md b/src/Peering/help/Remove-AzPeeringServicePrefix.md new file mode 100644 index 000000000000..879fe5fb937c --- /dev/null +++ b/src/Peering/help/Remove-AzPeeringServicePrefix.md @@ -0,0 +1,211 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/remove-azpeeringserviceprefix +schema: 2.0.0 +--- + +# Remove-AzPeeringServicePrefix + +## SYNOPSIS +Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzPeeringServicePrefix -Name -PeeringServiceName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzPeeringServicePrefix -InputObject [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. + +## EXAMPLES + +### Example 1: Remove peering service prefix +```powershell +Remove-AzPeeringServicePrefix -Name TestPrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroup DemoRG +``` + +Removes peering service prefix from peering + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the prefix. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: PrefixName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceName +The name of the peering service. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Start-AzPeeringInvokeLookingGlass.md b/src/Peering/help/Start-AzPeeringInvokeLookingGlass.md new file mode 100644 index 000000000000..c709a31eb2fa --- /dev/null +++ b/src/Peering/help/Start-AzPeeringInvokeLookingGlass.md @@ -0,0 +1,219 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/start-azpeeringinvokelookingglass +schema: 2.0.0 +--- + +# Start-AzPeeringInvokeLookingGlass + +## SYNOPSIS +Run looking glass functionality + +## SYNTAX + +### Invoke (Default) +``` +Start-AzPeeringInvokeLookingGlass -Command -DestinationIP + -SourceLocation -SourceType [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### InvokeViaIdentity +``` +Start-AzPeeringInvokeLookingGlass -InputObject -Command + -DestinationIP -SourceLocation -SourceType + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Run looking glass functionality + +## EXAMPLES + +### Example 1: Invoke looking glass command +```powershell +Start-AzPeeringInvokeLookingGlass -Command Ping -DestinationIp 1.1.1.1 -SourceLocation Seattle -SourceType EdgeSite +``` + +```output +Command Output +------- ------ +Ping PING 1.1.1.1 (1.1.1.1): 56 data bytes… +``` + +Invoke the given looking glass command + +## PARAMETERS + +### -Command +The command to be executed: ping, traceroute, bgpRoute. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassCommand +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DestinationIP +The IP address of the destination. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: InvokeViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SourceLocation +The location of the source. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceType +The type of the source: Edge site or Azure Region. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Support.LookingGlassSourceType +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Invoke +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ILookingGlassOutput + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Test-AzPeeringRegisteredPrefix.md b/src/Peering/help/Test-AzPeeringRegisteredPrefix.md new file mode 100644 index 000000000000..05895145c885 --- /dev/null +++ b/src/Peering/help/Test-AzPeeringRegisteredPrefix.md @@ -0,0 +1,202 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/test-azpeeringregisteredprefix +schema: 2.0.0 +--- + +# Test-AzPeeringRegisteredPrefix + +## SYNOPSIS +Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. + +## SYNTAX + +### Validate (Default) +``` +Test-AzPeeringRegisteredPrefix -Name -PeeringName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### ValidateViaIdentity +``` +Test-AzPeeringRegisteredPrefix -InputObject [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Validates an existing registered prefix with the specified name under the given subscription, resource group and peering. + +## EXAMPLES + +### Example 1: Test registered prefix +```powershell +Test-AzPeeringRegisteredPrefix -Name accessibilityTesting2 -PeeringName DemoPeering -ResourceGroupName DemoRG +``` + +```output +Name Prefix PeeringServicePrefixKey PrefixValidationState ProvisioningState +---- ------ ----------------------- --------------------- ----------------- +accessibilityTesting2 240.0.1.0/24 249aa0dd-6177-4105-94fe-dfefcbf5ab48 Pending Succeeded +``` + +Tests the validity of the given registered prefix (shown in prefix validation state) + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: ValidateViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the registered prefix. + +```yaml +Type: System.String +Parameter Sets: Validate +Aliases: RegisteredPrefixName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringName +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: Validate +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Validate +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Validate +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringRegisteredPrefix + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Test-AzPeeringServiceProviderAvailability.md b/src/Peering/help/Test-AzPeeringServiceProviderAvailability.md new file mode 100644 index 000000000000..91fc7f840657 --- /dev/null +++ b/src/Peering/help/Test-AzPeeringServiceProviderAvailability.md @@ -0,0 +1,222 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/test-azpeeringserviceprovideravailability +schema: 2.0.0 +--- + +# Test-AzPeeringServiceProviderAvailability + +## SYNOPSIS +Checks if the peering service provider is present within 1000 miles of customer's location + +## SYNTAX + +### CheckExpanded (Default) +``` +Test-AzPeeringServiceProviderAvailability [-SubscriptionId ] [-PeeringServiceLocation ] + [-PeeringServiceProvider ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### Check +``` +Test-AzPeeringServiceProviderAvailability + -CheckServiceProviderAvailabilityInput [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CheckViaIdentity +``` +Test-AzPeeringServiceProviderAvailability -InputObject + -CheckServiceProviderAvailabilityInput [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### CheckViaIdentityExpanded +``` +Test-AzPeeringServiceProviderAvailability -InputObject [-PeeringServiceLocation ] + [-PeeringServiceProvider ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Checks if the peering service provider is present within 1000 miles of customer's location + +## EXAMPLES + +### Example 1: Check if provider is available at a location +```powershell +$providerAvailability = New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ +Test-AzPeeringServiceProviderAvailability -CheckServiceProviderAvailabilityInput $providerAvailability +``` + +```output +"Available" +``` + +Check whether the given provider is available at the given location + +## PARAMETERS + +### -CheckServiceProviderAvailabilityInput +Class for CheckServiceProviderAvailabilityInput +To construct, see NOTES section for CHECKSERVICEPROVIDERAVAILABILITYINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput +Parameter Sets: Check, CheckViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: CheckViaIdentity, CheckViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PeeringServiceLocation +Gets or sets the peering service location. + +```yaml +Type: System.String +Parameter Sets: CheckExpanded, CheckViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PeeringServiceProvider +Gets or sets the peering service provider. + +```yaml +Type: System.String +Parameter Sets: CheckExpanded, CheckViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: Check, CheckExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.ICheckServiceProviderAvailabilityInput + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### System.String + +## NOTES + +ALIASES + +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. + + +`CHECKSERVICEPROVIDERAVAILABILITYINPUT `: Class for CheckServiceProviderAvailabilityInput + - `[PeeringServiceLocation ]`: Gets or sets the peering service location. + - `[PeeringServiceProvider ]`: Gets or sets the peering service provider. + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Update-AzPeering.md b/src/Peering/help/Update-AzPeering.md new file mode 100644 index 000000000000..649031bde4aa --- /dev/null +++ b/src/Peering/help/Update-AzPeering.md @@ -0,0 +1,203 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/update-azpeering +schema: 2.0.0 +--- + +# Update-AzPeering + +## SYNOPSIS +Updates tags for a peering with the specified name under the given subscription and resource group. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzPeering -Name -ResourceGroupName [-SubscriptionId ] [-Tag ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzPeering -InputObject [-Tag ] [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Updates tags for a peering with the specified name under the given subscription and resource group. + +## EXAMPLES + +### Example 1: Update peering tags +```powershell +$tags=@{hello='world'} +Update-AzPeering -Name DemoPeering -ResourceGroupName DemoRG -Tag $tags +``` + +```output +Name SkuName Kind PeeringLocation ProvisioningState Location +---- ------- ---- --------------- ----------------- -------- +DemoPeering Premium_Direct_Free Direct Dallas Succeeded South Central US +``` + +Updates the specified peering's tags + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the peering. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: PeeringName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Gets or sets the tags, a dictionary of descriptors arm object + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeering + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/help/Update-AzPeeringService.md b/src/Peering/help/Update-AzPeeringService.md new file mode 100644 index 000000000000..c28802756970 --- /dev/null +++ b/src/Peering/help/Update-AzPeeringService.md @@ -0,0 +1,203 @@ +--- +external help file: +Module Name: Az.Peering +online version: https://learn.microsoft.com/powershell/module/az.peering/update-azpeeringservice +schema: 2.0.0 +--- + +# Update-AzPeeringService + +## SYNOPSIS +Updates tags for a peering service with the specified name under the given subscription and resource group. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzPeeringService -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzPeeringService -InputObject [-Tag ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates tags for a peering service with the specified name under the given subscription and resource group. + +## EXAMPLES + +### Example 1: Update peering service tags +```powershell +$tags=@{hello='world'} +Update-AzPeeringService -Name DRTestInterCloud -ResourceGroupName DemoRG -Tag $tags +``` + +```output +Name ResourceGroupName PeeringServiceLocation Provider ProvisioningState Location +---- ----------------- ---------------------- -------- ----------------- -------- +DRTestInterCloud DemoRG Ile-de-France InterCloud Succeeded UK South +``` + +Updates the peering service tags + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the peering service. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: PeeringServiceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The Azure subscription ID. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Gets or sets the tags, a dictionary of descriptors arm object + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.IPeeringIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IPeeringService + +## NOTES + +ALIASES + +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. + + +`INPUTOBJECT `: Identity Parameter + - `[ConnectionMonitorTestName ]`: The name of the connection monitor test + - `[Id ]`: Resource identity path + - `[PeerAsnName ]`: The peer ASN name. + - `[PeeringName ]`: The name of the peering. + - `[PeeringServiceName ]`: The name of the peering service. + - `[PrefixName ]`: The name of the prefix. + - `[RegisteredAsnName ]`: The name of the registered ASN. + - `[RegisteredPrefixName ]`: The name of the registered prefix. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The Azure subscription ID. + +## RELATED LINKS + diff --git a/src/Peering/how-to.md b/src/Peering/how-to.md new file mode 100644 index 000000000000..deb294266da8 --- /dev/null +++ b/src/Peering/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.Peering`. + +## Building `Az.Peering` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [README.md](custom/README.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder. + +## Testing `Az.Peering` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder. + +## Packing `Az.Peering` +To pack `Az.Peering` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.Peering`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.Peering.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.Peering.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.Peering`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.Peering` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/Peering/internal/Az.Peering.internal.psm1 b/src/Peering/internal/Az.Peering.internal.psm1 new file mode 100644 index 000000000000..7b642cd770cb --- /dev/null +++ b/src/Peering/internal/Az.Peering.internal.psm1 @@ -0,0 +1,38 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Peering.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.Peering.Module]::Instance + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = $PSScriptRoot + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } +# endregion diff --git a/src/Peering/internal/Get-AzPeeringOperation.ps1 b/src/Peering/internal/Get-AzPeeringOperation.ps1 new file mode 100644 index 000000000000..c10be1a619a2 --- /dev/null +++ b/src/Peering/internal/Get-AzPeeringOperation.ps1 @@ -0,0 +1,124 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Lists all of the available API operations for peering resources. +.Description +Lists all of the available API operations for peering resources. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringoperation +#> +function Get-AzPeeringOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringOperation_List'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/Peering/internal/ProxyCmdletDefinitions.ps1 b/src/Peering/internal/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..c10be1a619a2 --- /dev/null +++ b/src/Peering/internal/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,124 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Lists all of the available API operations for peering resources. +.Description +Lists all of the available API operations for peering resources. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation +.Link +https://learn.microsoft.com/powershell/module/az.peering/get-azpeeringoperation +#> +function Get-AzPeeringOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Peering.Models.Api20221001.IOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Peering.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + List = 'Az.Peering.private\Get-AzPeeringOperation_List'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/Peering/internal/README.md b/src/Peering/internal/README.md new file mode 100644 index 000000000000..cea0f0def498 --- /dev/null +++ b/src/Peering/internal/README.md @@ -0,0 +1,14 @@ +# Internal +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest.powershell/blob/main/docs/directives.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The `Az.Peering.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.Peering`. Instead, this sub-module is imported by the `..\custom\Az.Peering.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.Peering.internal\Get-Example` would call an internal cmdlet named `Get-Example`. + +## Purpose +This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.Peering`. diff --git a/src/Peering/pack-module.ps1 b/src/Peering/pack-module.ps1 new file mode 100644 index 000000000000..2f30ca3fffa0 --- /dev/null +++ b/src/Peering/pack-module.ps1 @@ -0,0 +1,17 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +Write-Host -ForegroundColor Green 'Packing module...' +dotnet pack $PSScriptRoot --no-build /nologo +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Peering/run-module.ps1 b/src/Peering/run-module.ps1 new file mode 100644 index 000000000000..dc19eab42d28 --- /dev/null +++ b/src/Peering/run-module.ps1 @@ -0,0 +1,62 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Code) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$isAzure = $true +if($isAzure) { + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts + # Load the latest version of Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Peering.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +function Prompt { + Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" + Write-Host -NoNewline -ForegroundColor Gray ' [' + Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName + ']> ' +} + +# where we would find the launch.json file +$vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') +$launchJson = Join-Path $vscodeDirectory 'launch.json' + +# if there is a launch.json file, let's just assume -Code, and update the file +if(($Code) -or (test-Path $launchJson) ) { + $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' + Set-Content -Path $launchJson -Value $launchContent + if($Code) { + # only launch vscode if they say -code + code $PSScriptRoot + } +} + +Import-Module -Name $modulePath \ No newline at end of file diff --git a/src/Peering/test-module.ps1 b/src/Peering/test-module.ps1 new file mode 100644 index 000000000000..ac54398490e1 --- /dev/null +++ b/src/Peering/test-module.ps1 @@ -0,0 +1,94 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) +{ + Write-Host -ForegroundColor Green 'Creating isolated process...' + if ($PSBoundParameters.ContainsKey("TestName")) { + $PSBoundParameters["TestName"] = $PSBoundParameters["TestName"] -join "," + } + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +# This is a workaround, since for string array parameter, pwsh -File will only take the first element +if ($PSBoundParameters.ContainsKey("TestName") -and ($TestName.count -eq 1) -and ($TestName[0].Contains(','))) { + $TestName = $TestName[0].Split(",") +} + +$ProgressPreference = 'SilentlyContinue' +$baseName = $PSScriptRoot.BaseName +$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule +. ("$PSScriptRoot\test\utils.ps1") + +if ($requireResourceModule) +{ + # Load the latest Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version + $resourceModulePSD = Get-Item -Path (Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psd1') + Import-Module -Name $resourceModulePSD.FullName +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) +{ + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Peering.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +Import-Module -Name Pester +Import-Module -Name $modulePath + +$TestMode = 'playback' +$ExcludeTag = @("LiveOnly") +if($Live) +{ + $TestMode = 'live' + $ExcludeTag = @() +} +if($Record) +{ + $TestMode = 'record' +} +try +{ + if ($TestMode -ne 'playback') + { + setupEnv + } + $testFolder = Join-Path $PSScriptRoot 'test' + if ($null -ne $TestName) + { + Invoke-Pester -Script @{ Path = $testFolder } -TestName $TestName -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } else + { + Invoke-Pester -Script @{ Path = $testFolder } -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } +} Finally +{ + if ($TestMode -ne 'playback') + { + cleanupEnv + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeering.Recording.json b/src/Peering/test/Get-AzPeering.Recording.json new file mode 100644 index 000000000000..eed183527125 --- /dev/null +++ b/src/Peering/test/Get-AzPeering.Recording.json @@ -0,0 +1,124 @@ +{ + "Get-AzPeering+[NoContext]+List1+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerings?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerings?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "0bcfff77-6b6b-4e51-b939-ab76aec1416a" ], + "CommandName": [ "Get-AzPeering" ], + "FullCommandName": [ "Get-AzPeering_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "93ba0a69-df5a-4f5c-812e-5d19ddca47a7", "23bda89c-c67d-4289-998a-dbd860746e1c", "9e743b87-e4e8-4d66-9818-2aa874f85468", "7920d641-c223-44fa-a070-90d75db48bd5" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "599" ], + "x-ms-request-id": [ "af958be4-78a1-41b8-91c9-92b58d667f81" ], + "x-ms-correlation-request-id": [ "af958be4-78a1-41b8-91c9-92b58d667f81" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012513Z:af958be4-78a1-41b8-91c9-92b58d667f81" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:12 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ], + "Content-Length": [ "8059" ] + }, + "Content": "{\"value\":[{\"sku\":{\"name\":\"Premium_Direct_Free\",\"tier\":\"Premium\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":10000,\"provisionedBandwidthInMbps\":0,\"sessionAddressProvider\":\"Microsoft\",\"useForPeeringService\":true,\"peeringDBFacilityId\":69,\"connectionState\":\"PendingApproval\",\"connectionIdentifier\":\"362f1f7a-ff7a-4dc3-84da-0e20846e5f99\"}],\"useForPeeringService\":true,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"},\"directPeeringType\":\"Edge\"},\"peeringLocation\":\"Dallas\",\"provisioningState\":\"Succeeded\"},\"location\":\"South Central US\",\"tags\":{},\"name\":\"DemoComp1\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoComp1\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Premium_Direct_Free\",\"tier\":\"Premium\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":200000,\"provisionedBandwidthInMbps\":200000,\"sessionAddressProvider\":\"Peer\",\"useForPeeringService\":true,\"peeringDBFacilityId\":69,\"connectionState\":\"Active\",\"bgpSession\":{\"sessionPrefixV4\":\"12.90.152.68/30\",\"sessionPrefixV6\":\"\",\"microsoftSessionIPv4Address\":\"12.90.152.70\",\"peerSessionIPv4Address\":\"12.90.152.69\",\"sessionStateV4\":\"Established\",\"sessionStateV6\":\"None\",\"maxPrefixesAdvertisedV4\":200000,\"maxPrefixesAdvertisedV6\":0},\"connectionIdentifier\":\"815870d0-938d-4355-b6b9-dd007999b8f5\"},{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":200000,\"provisionedBandwidthInMbps\":200000,\"sessionAddressProvider\":\"Peer\",\"useForPeeringService\":true,\"peeringDBFacilityId\":69,\"connectionState\":\"Active\",\"bgpSession\":{\"sessionPrefixV4\":\"12.125.145.32/30\",\"sessionPrefixV6\":\"\",\"microsoftSessionIPv4Address\":\"12.125.145.34\",\"peerSessionIPv4Address\":\"12.125.145.33\",\"sessionStateV4\":\"Established\",\"sessionStateV6\":\"None\",\"maxPrefixesAdvertisedV4\":200000,\"maxPrefixesAdvertisedV6\":0},\"connectionIdentifier\":\"0720b596-dca1-4d58-8628-58191be00cc3\"}],\"useForPeeringService\":true,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/AS7018\"},\"directPeeringType\":\"Edge\"},\"peeringLocation\":\"Dallas\",\"provisioningState\":\"Succeeded\"},\"location\":\"South Central US\",\"tags\":{\"hello\":\"world\"},\"name\":\"DemoPeering\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Premium_Direct_Free\",\"tier\":\"Premium\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":100000,\"provisionedBandwidthInMbps\":0,\"sessionAddressProvider\":\"Microsoft\",\"useForPeeringService\":true,\"peeringDBFacilityId\":11,\"connectionState\":\"PendingApproval\",\"connectionIdentifier\":\"1b14538c-04ea-4cee-a094-54823e556806\"}],\"useForPeeringService\":true,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"},\"directPeeringType\":\"EdgeZoneForOperators\"},\"peeringLocation\":\"Atlanta\",\"provisioningState\":\"Succeeded\"},\"location\":\"East US 2\",\"tags\":{},\"name\":\"TestEdgeZone\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/TestEdgeZone\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Premium_Direct_Free\",\"tier\":\"Premium\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":100000,\"provisionedBandwidthInMbps\":0,\"sessionAddressProvider\":\"Peer\",\"useForPeeringService\":true,\"peeringDBFacilityId\":1,\"connectionState\":\"PendingApproval\",\"bgpSession\":{\"sessionPrefixV4\":\"43.243.21.20/30\",\"sessionPrefixV6\":\"\",\"microsoftSessionIPv4Address\":\"43.243.21.22\",\"microsoftSessionIPv6Address\":\"\",\"peerSessionIPv4Address\":\"43.243.21.21\",\"peerSessionIPv6Address\":\"\",\"sessionStateV4\":\"None\",\"sessionStateV6\":\"None\",\"maxPrefixesAdvertisedV4\":20000,\"maxPrefixesAdvertisedV6\":0,\"md5AuthenticationKey\":\"\"},\"connectionIdentifier\":\"2ce397a2-4888-4a89-aa68-34810d8a1919\"}],\"useForPeeringService\":true,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"},\"directPeeringType\":\"IxRs\"},\"peeringLocation\":\"Ashburn\",\"provisioningState\":\"Succeeded\"},\"location\":\"East US\",\"tags\":{},\"name\":\"MapsIxRs\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Premium_Direct_Free\",\"tier\":\"Premium\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":10000,\"provisionedBandwidthInMbps\":0,\"sessionAddressProvider\":\"Microsoft\",\"useForPeeringService\":true,\"peeringDBFacilityId\":71,\"connectionState\":\"PendingApproval\",\"connectionIdentifier\":\"a4d998de-7fff-4ee7-be72-13e8004f2d4f\"}],\"useForPeeringService\":true,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"},\"directPeeringType\":\"Edge\"},\"peeringLocation\":\"Seattle\",\"provisioningState\":\"Succeeded\"},\"location\":\"West US 2\",\"tags\":{},\"name\":\"DemoMapsConfig\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoMapsConfig\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Basic_Exchange_Free\",\"tier\":\"Basic\",\"family\":\"Exchange\",\"size\":\"Free\"},\"kind\":\"Exchange\",\"properties\":{\"exchange\":{\"connections\":[{\"peeringDBFacilityId\":64,\"connectionState\":\"ProvisioningFailed\",\"bgpSession\":{\"sessionPrefixV4\":\"193.239.116.0/22\",\"microsoftSessionIPv4Address\":\"193.239.118.173\",\"peerSessionIPv4Address\":\"193.239.116.1\",\"peerSessionIPv6Address\":\"\",\"sessionStateV4\":\"None\",\"sessionStateV6\":\"None\",\"maxPrefixesAdvertisedV4\":20000,\"maxPrefixesAdvertisedV6\":0,\"md5AuthenticationKey\":\"\"},\"connectionIdentifier\":\"9e5e4dc9-979a-45ce-b251-f7ef7fd64caf\",\"errorMessage\":\"This request was not approved by the Microsoft\u0027s peering team.\"},{\"peeringDBFacilityId\":64,\"connectionState\":\"ProvisioningFailed\",\"bgpSession\":{\"sessionPrefixV6\":\"2001:7f8:13::/64\",\"microsoftSessionIPv6Address\":\"2001:7f8:13::a500:8075:5\",\"peerSessionIPv4Address\":\"\",\"peerSessionIPv6Address\":\"2001:7f8:13::a504:1480:1\",\"sessionStateV4\":\"None\",\"sessionStateV6\":\"None\",\"maxPrefixesAdvertisedV4\":0,\"maxPrefixesAdvertisedV6\":2000,\"md5AuthenticationKey\":\"\"},\"connectionIdentifier\":\"1a782c34-dc52-4f7d-97cd-a7ea7e3f87c1\",\"errorMessage\":\"This request was not approved by the Microsoft\u0027s peering team.\"}],\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"}},\"peeringLocation\":\"Amsterdam\",\"provisioningState\":\"Succeeded\"},\"location\":\"West Europe\",\"tags\":{},\"name\":\"testexchange\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/testexchange\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Basic_Direct_Free\",\"tier\":\"Basic\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":10000,\"provisionedBandwidthInMbps\":0,\"sessionAddressProvider\":\"Microsoft\",\"useForPeeringService\":false,\"peeringDBFacilityId\":1949,\"connectionState\":\"PendingApproval\",\"connectionIdentifier\":\"3025377f-1886-4af5-88c7-4b4d74941d40\"}],\"useForPeeringService\":false,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/AS7018\"},\"directPeeringType\":\"Edge\"},\"peeringLocation\":\"Athens\",\"provisioningState\":\"Succeeded\"},\"location\":\"France Central\",\"tags\":{},\"name\":\"test1\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/AnomalyDetection/providers/Microsoft.Peering/peerings/test1\",\"type\":\"Microsoft.Peering/peerings\"}]}", + "isContentBase64": false + } + }, + "Get-AzPeering+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "40945a58-570c-4d6f-af0c-5766fbd470b0" ], + "CommandName": [ "Get-AzPeering" ], + "FullCommandName": [ "Get-AzPeering_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "08e8a20e-6bcf-4bc7-b23f-d647e26ac1a3" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "598" ], + "x-ms-correlation-request-id": [ "f5a53061-7b3d-4e7a-b997-1454da8379e0" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012513Z:f5a53061-7b3d-4e7a-b997-1454da8379e0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2412" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"sku\": {\r\n \"name\": \"Premium_Direct_Free\",\r\n \"tier\": \"Premium\",\r\n \"family\": \"Direct\",\r\n \"size\": \"Free\"\r\n },\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"connections\": [\r\n {\r\n \"billableBandwidthInMbps\": 0,\r\n \"bandwidthInMbps\": 200000,\r\n \"provisionedBandwidthInMbps\": 200000,\r\n \"sessionAddressProvider\": \"Peer\",\r\n \"useForPeeringService\": true,\r\n \"peeringDBFacilityId\": 69,\r\n \"connectionState\": \"Active\",\r\n \"bgpSession\": {\r\n \"sessionPrefixV4\": \"12.90.152.68/30\",\r\n \"sessionPrefixV6\": \"\",\r\n \"microsoftSessionIPv4Address\": \"12.90.152.70\",\r\n \"peerSessionIPv4Address\": \"12.90.152.69\",\r\n \"sessionStateV4\": \"Established\",\r\n \"sessionStateV6\": \"None\",\r\n \"maxPrefixesAdvertisedV4\": 200000,\r\n \"maxPrefixesAdvertisedV6\": 0\r\n },\r\n \"connectionIdentifier\": \"815870d0-938d-4355-b6b9-dd007999b8f5\"\r\n },\r\n {\r\n \"billableBandwidthInMbps\": 0,\r\n \"bandwidthInMbps\": 200000,\r\n \"provisionedBandwidthInMbps\": 200000,\r\n \"sessionAddressProvider\": \"Peer\",\r\n \"useForPeeringService\": true,\r\n \"peeringDBFacilityId\": 69,\r\n \"connectionState\": \"Active\",\r\n \"bgpSession\": {\r\n \"sessionPrefixV4\": \"12.125.145.32/30\",\r\n \"sessionPrefixV6\": \"\",\r\n \"microsoftSessionIPv4Address\": \"12.125.145.34\",\r\n \"peerSessionIPv4Address\": \"12.125.145.33\",\r\n \"sessionStateV4\": \"Established\",\r\n \"sessionStateV6\": \"None\",\r\n \"maxPrefixesAdvertisedV4\": 200000,\r\n \"maxPrefixesAdvertisedV6\": 0\r\n },\r\n \"connectionIdentifier\": \"0720b596-dca1-4d58-8628-58191be00cc3\"\r\n }\r\n ],\r\n \"useForPeeringService\": true,\r\n \"peerAsn\": {\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/AS7018\"\r\n },\r\n \"directPeeringType\": \"Edge\"\r\n },\r\n \"peeringLocation\": \"Dallas\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"South Central US\",\r\n \"tags\": {\r\n \"hello\": \"world\"\r\n },\r\n \"name\": \"DemoPeering\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering\",\r\n \"type\": \"Microsoft.Peering/peerings\"\r\n}", + "isContentBase64": false + } + }, + "Get-AzPeering+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "7ae25d28-1fc0-49b6-af2f-77fbdf64a7cc" ], + "CommandName": [ "Get-AzPeering" ], + "FullCommandName": [ "Get-AzPeering_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "9cade4f2-8e45-48c5-a594-dfd9ecc84213", "096259cd-7650-4320-884e-39053ba8f2a5", "d1e3f9d8-4a4b-4ced-80a8-fd98cc4ffa11" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "597" ], + "x-ms-request-id": [ "e7a81052-00f7-459f-bab5-44007d4c6320" ], + "x-ms-correlation-request-id": [ "e7a81052-00f7-459f-bab5-44007d4c6320" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012514Z:e7a81052-00f7-459f-bab5-44007d4c6320" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:14 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ], + "Content-Length": [ "5969" ] + }, + "Content": "{\"value\":[{\"sku\":{\"name\":\"Premium_Direct_Free\",\"tier\":\"Premium\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":10000,\"provisionedBandwidthInMbps\":0,\"sessionAddressProvider\":\"Microsoft\",\"useForPeeringService\":true,\"peeringDBFacilityId\":69,\"connectionState\":\"PendingApproval\",\"connectionIdentifier\":\"362f1f7a-ff7a-4dc3-84da-0e20846e5f99\"}],\"useForPeeringService\":true,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"},\"directPeeringType\":\"Edge\"},\"peeringLocation\":\"Dallas\",\"provisioningState\":\"Succeeded\"},\"location\":\"South Central US\",\"tags\":{},\"name\":\"DemoComp1\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoComp1\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Premium_Direct_Free\",\"tier\":\"Premium\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":200000,\"provisionedBandwidthInMbps\":200000,\"sessionAddressProvider\":\"Peer\",\"useForPeeringService\":true,\"peeringDBFacilityId\":69,\"connectionState\":\"Active\",\"bgpSession\":{\"sessionPrefixV4\":\"12.90.152.68/30\",\"sessionPrefixV6\":\"\",\"microsoftSessionIPv4Address\":\"12.90.152.70\",\"peerSessionIPv4Address\":\"12.90.152.69\",\"sessionStateV4\":\"Established\",\"sessionStateV6\":\"None\",\"maxPrefixesAdvertisedV4\":200000,\"maxPrefixesAdvertisedV6\":0},\"connectionIdentifier\":\"815870d0-938d-4355-b6b9-dd007999b8f5\"},{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":200000,\"provisionedBandwidthInMbps\":200000,\"sessionAddressProvider\":\"Peer\",\"useForPeeringService\":true,\"peeringDBFacilityId\":69,\"connectionState\":\"Active\",\"bgpSession\":{\"sessionPrefixV4\":\"12.125.145.32/30\",\"sessionPrefixV6\":\"\",\"microsoftSessionIPv4Address\":\"12.125.145.34\",\"peerSessionIPv4Address\":\"12.125.145.33\",\"sessionStateV4\":\"Established\",\"sessionStateV6\":\"None\",\"maxPrefixesAdvertisedV4\":200000,\"maxPrefixesAdvertisedV6\":0},\"connectionIdentifier\":\"0720b596-dca1-4d58-8628-58191be00cc3\"}],\"useForPeeringService\":true,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/AS7018\"},\"directPeeringType\":\"Edge\"},\"peeringLocation\":\"Dallas\",\"provisioningState\":\"Succeeded\"},\"location\":\"South Central US\",\"tags\":{\"hello\":\"world\"},\"name\":\"DemoPeering\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Premium_Direct_Free\",\"tier\":\"Premium\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":100000,\"provisionedBandwidthInMbps\":0,\"sessionAddressProvider\":\"Microsoft\",\"useForPeeringService\":true,\"peeringDBFacilityId\":11,\"connectionState\":\"PendingApproval\",\"connectionIdentifier\":\"1b14538c-04ea-4cee-a094-54823e556806\"}],\"useForPeeringService\":true,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"},\"directPeeringType\":\"EdgeZoneForOperators\"},\"peeringLocation\":\"Atlanta\",\"provisioningState\":\"Succeeded\"},\"location\":\"East US 2\",\"tags\":{},\"name\":\"TestEdgeZone\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/TestEdgeZone\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Premium_Direct_Free\",\"tier\":\"Premium\",\"family\":\"Direct\",\"size\":\"Free\"},\"kind\":\"Direct\",\"properties\":{\"direct\":{\"connections\":[{\"billableBandwidthInMbps\":0,\"bandwidthInMbps\":10000,\"provisionedBandwidthInMbps\":0,\"sessionAddressProvider\":\"Microsoft\",\"useForPeeringService\":true,\"peeringDBFacilityId\":71,\"connectionState\":\"PendingApproval\",\"connectionIdentifier\":\"a4d998de-7fff-4ee7-be72-13e8004f2d4f\"}],\"useForPeeringService\":true,\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"},\"directPeeringType\":\"Edge\"},\"peeringLocation\":\"Seattle\",\"provisioningState\":\"Succeeded\"},\"location\":\"West US 2\",\"tags\":{},\"name\":\"DemoMapsConfig\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoMapsConfig\",\"type\":\"Microsoft.Peering/peerings\"},{\"sku\":{\"name\":\"Basic_Exchange_Free\",\"tier\":\"Basic\",\"family\":\"Exchange\",\"size\":\"Free\"},\"kind\":\"Exchange\",\"properties\":{\"exchange\":{\"connections\":[{\"peeringDBFacilityId\":64,\"connectionState\":\"ProvisioningFailed\",\"bgpSession\":{\"sessionPrefixV4\":\"193.239.116.0/22\",\"microsoftSessionIPv4Address\":\"193.239.118.173\",\"peerSessionIPv4Address\":\"193.239.116.1\",\"peerSessionIPv6Address\":\"\",\"sessionStateV4\":\"None\",\"sessionStateV6\":\"None\",\"maxPrefixesAdvertisedV4\":20000,\"maxPrefixesAdvertisedV6\":0,\"md5AuthenticationKey\":\"\"},\"connectionIdentifier\":\"9e5e4dc9-979a-45ce-b251-f7ef7fd64caf\",\"errorMessage\":\"This request was not approved by the Microsoft\u0027s peering team.\"},{\"peeringDBFacilityId\":64,\"connectionState\":\"ProvisioningFailed\",\"bgpSession\":{\"sessionPrefixV6\":\"2001:7f8:13::/64\",\"microsoftSessionIPv6Address\":\"2001:7f8:13::a500:8075:5\",\"peerSessionIPv4Address\":\"\",\"peerSessionIPv6Address\":\"2001:7f8:13::a504:1480:1\",\"sessionStateV4\":\"None\",\"sessionStateV6\":\"None\",\"maxPrefixesAdvertisedV4\":0,\"maxPrefixesAdvertisedV6\":2000,\"md5AuthenticationKey\":\"\"},\"connectionIdentifier\":\"1a782c34-dc52-4f7d-97cd-a7ea7e3f87c1\",\"errorMessage\":\"This request was not approved by the Microsoft\u0027s peering team.\"}],\"peerAsn\":{\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"}},\"peeringLocation\":\"Amsterdam\",\"provisioningState\":\"Succeeded\"},\"location\":\"West Europe\",\"tags\":{},\"name\":\"testexchange\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/testexchange\",\"type\":\"Microsoft.Peering/peerings\"}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeering.Tests.ps1 b/src/Peering/test/Get-AzPeering.Tests.ps1 new file mode 100644 index 000000000000..f7f5e9ad8fe9 --- /dev/null +++ b/src/Peering/test/Get-AzPeering.Tests.ps1 @@ -0,0 +1,38 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeering')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeering.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeering' { + It 'List1' { + { + $allPeerings = Get-AzPeering + $allPeerings.Count| Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $peering = Get-AzPeering -Name DemoPeering -ResourceGroupName DemoRG + $peering.Name | Should -Be "DemoPeering" + } | Should -Not -Throw + } + + It 'List' { + { + $rgPeerings = Get-AzPeering -ResourceGroupName DemoRG + $rgPeerings.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringAsn.Recording.json b/src/Peering/test/Get-AzPeeringAsn.Recording.json new file mode 100644 index 000000000000..8513a3c5a303 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringAsn.Recording.json @@ -0,0 +1,162 @@ +{ + "Get-AzPeeringAsn+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "3f8dd36b-9a36-4475-8154-9d9fddc388b1" ], + "CommandName": [ "Get-AzPeeringAsn" ], + "FullCommandName": [ "Get-AzPeeringAsn_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "981f8bc5-3453-4076-b2c3-8985ce268cb7" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "599" ], + "x-ms-correlation-request-id": [ "8216bf35-5de8-490f-a4db-68eabce65ffd" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012515Z:8216bf35-5de8-490f-a4db-68eabce65ffd" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "546" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"peerAsn\": 65000,\r\n \"peerContactDetail\": [\r\n {\r\n \"role\": \"Noc\",\r\n \"email\": \"test@microsoft.com\",\r\n \"phone\": \"+12345678900\"\r\n }\r\n ],\r\n \"peerName\": \"Contoso\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"ContosoEdgeTest\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + }, + "Get-AzPeeringAsn+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "131c133d-202f-404c-bde4-45f64e712552" ], + "CommandName": [ "Get-AzPeeringAsn" ], + "FullCommandName": [ "Get-AzPeeringAsn_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "fe128aa3-e7a4-45cb-aa8a-4cd871654942" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "598" ], + "x-ms-correlation-request-id": [ "9da12ea7-4728-4310-958d-3d71802f4d93" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012515Z:9da12ea7-4728-4310-958d-3d71802f4d93" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "453" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"peerAsn\": 65000,\r\n \"peerContactDetail\": [\r\n {\r\n \"role\": \"Noc\",\r\n \"email\": \"test@microsoft.com\",\r\n \"phone\": \"+12345678900\"\r\n }\r\n ],\r\n \"peerName\": \"Contoso\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"ContosoEdgeTest\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n}", + "isContentBase64": false + } + }, + "Get-AzPeeringAsn+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "069bd14a-1bc3-4ee4-97b7-e9c60a5608f0" ], + "CommandName": [ "Get-AzPeeringAsn" ], + "FullCommandName": [ "Get-AzPeeringAsn_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "b72463c8-f5c8-4961-b222-876b2f1773d2" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "597" ], + "x-ms-correlation-request-id": [ "ed932401-8970-461b-8d27-99264ed547cf" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012515Z:ed932401-8970-461b-8d27-99264ed547cf" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "453" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"peerAsn\": 65000,\r\n \"peerContactDetail\": [\r\n {\r\n \"role\": \"Noc\",\r\n \"email\": \"test@microsoft.com\",\r\n \"phone\": \"+12345678900\"\r\n }\r\n ],\r\n \"peerName\": \"Contoso\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"ContosoEdgeTest\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n}", + "isContentBase64": false + } + }, + "Get-AzPeeringAsn+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest?api-version=2022-10-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "32f946b4-19f4-4ce0-afb2-d8b7e5a2f20c" ], + "CommandName": [ "Get-AzPeeringAsn" ], + "FullCommandName": [ "Get-AzPeeringAsn_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "d46805bd-12ef-4089-a19c-2fd58a0aab90" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "596" ], + "x-ms-correlation-request-id": [ "a737b245-101d-4ce1-8327-5bc12c0c2d51" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012515Z:a737b245-101d-4ce1-8327-5bc12c0c2d51" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "453" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"peerAsn\": 65000,\r\n \"peerContactDetail\": [\r\n {\r\n \"role\": \"Noc\",\r\n \"email\": \"test@microsoft.com\",\r\n \"phone\": \"+12345678900\"\r\n }\r\n ],\r\n \"peerName\": \"Contoso\",\r\n \"validationState\": \"Approved\"\r\n },\r\n \"name\": \"ContosoEdgeTest\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringAsn.Tests.ps1 b/src/Peering/test/Get-AzPeeringAsn.Tests.ps1 new file mode 100644 index 000000000000..0a8f9c36c63d --- /dev/null +++ b/src/Peering/test/Get-AzPeeringAsn.Tests.ps1 @@ -0,0 +1,39 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringAsn')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringAsn.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringAsn' { + It 'List' { + { + $peeringAsns = Get-AzPeeringAsn + $peeringAsns.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $asn = Get-AzPeeringAsn -Name ContosoEdgeTest + $asn.Name | Should -Be "ContosoEdgeTest" + } | Should -Not -Throw + } + + It 'GetViaIdentity' { + { + $asn = Get-AzPeeringAsn -Name ContosoEdgeTest + $asnIdentity = Get-AzPeeringAsn -InputObject $asn + $asnIdentity.Name | Should -Be "ContosoEdgeTest" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringCdnPrefix.Recording.json b/src/Peering/test/Get-AzPeeringCdnPrefix.Recording.json new file mode 100644 index 000000000000..2e4367d160b9 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringCdnPrefix.Recording.json @@ -0,0 +1,42 @@ +{ + "Get-AzPeeringCdnPrefix+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes?peeringLocation=Seattle\u0026api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes?peeringLocation=Seattle\u0026api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "a9834d72-37c0-44b8-9e72-e9f21eb487cf" ], + "CommandName": [ "Get-AzPeeringCdnPrefix" ], + "FullCommandName": [ "Get-AzPeeringCdnPrefix_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "9662f7b8-ec2e-4761-99bb-34831bae7562" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "599" ], + "x-ms-correlation-request-id": [ "cd8bd89a-afce-4f31-922d-ed72dc662224" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012515Z:cd8bd89a-afce-4f31-922d-ed72dc662224" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "3807" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"prefix\": \"20.157.110.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"azureService\": \"AzureCompute\",\r\n \"isPrimaryRegion\": true,\r\n \"bgpCommunity\": \"8069:51026\"\r\n },\r\n \"name\": \"CdnPrefix_20_157_110_0_24\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes/CdnPrefix_20_157_110_0_24\",\r\n \"type\": \"Microsoft.Peering/cdnPeeringPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"20.157.118.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"azureService\": \"AzureCompute\",\r\n \"isPrimaryRegion\": true,\r\n \"bgpCommunity\": \"8069:51026\"\r\n },\r\n \"name\": \"CdnPrefix_20_157_118_0_24\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes/CdnPrefix_20_157_118_0_24\",\r\n \"type\": \"Microsoft.Peering/cdnPeeringPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"20.157.125.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"azureService\": \"AzureCompute\",\r\n \"isPrimaryRegion\": true,\r\n \"bgpCommunity\": \"8069:51026\"\r\n },\r\n \"name\": \"CdnPrefix_20_157_125_0_24\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes/CdnPrefix_20_157_125_0_24\",\r\n \"type\": \"Microsoft.Peering/cdnPeeringPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"20.157.180.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"azureService\": \"AzureStorage\",\r\n \"isPrimaryRegion\": true,\r\n \"bgpCommunity\": \"8069:52026\"\r\n },\r\n \"name\": \"CdnPrefix_20_157_180_0_24\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes/CdnPrefix_20_157_180_0_24\",\r\n \"type\": \"Microsoft.Peering/cdnPeeringPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"20.157.25.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"azureService\": \"AzureCompute\",\r\n \"isPrimaryRegion\": true,\r\n \"bgpCommunity\": \"8069:51026\"\r\n },\r\n \"name\": \"CdnPrefix_20_157_25_0_24\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes/CdnPrefix_20_157_25_0_24\",\r\n \"type\": \"Microsoft.Peering/cdnPeeringPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"20.157.50.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"azureService\": \"AzureStorage\",\r\n \"isPrimaryRegion\": true,\r\n \"bgpCommunity\": \"8069:52026\"\r\n },\r\n \"name\": \"CdnPrefix_20_157_50_0_23\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes/CdnPrefix_20_157_50_0_23\",\r\n \"type\": \"Microsoft.Peering/cdnPeeringPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"20.47.120.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"azureService\": \"AzureCompute\",\r\n \"isPrimaryRegion\": true,\r\n \"bgpCommunity\": \"8069:51026\"\r\n },\r\n \"name\": \"CdnPrefix_20_47_120_0_23\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes/CdnPrefix_20_47_120_0_23\",\r\n \"type\": \"Microsoft.Peering/cdnPeeringPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"20.47.62.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"azureService\": \"AzureStorage\",\r\n \"isPrimaryRegion\": true,\r\n \"bgpCommunity\": \"8069:52026\"\r\n },\r\n \"name\": \"CdnPrefix_20_47_62_0_23\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/cdnPeeringPrefixes/CdnPrefix_20_47_62_0_23\",\r\n \"type\": \"Microsoft.Peering/cdnPeeringPrefixes\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringCdnPrefix.Tests.ps1 b/src/Peering/test/Get-AzPeeringCdnPrefix.Tests.ps1 new file mode 100644 index 000000000000..e08efb0201d3 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringCdnPrefix.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringCdnPrefix')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringCdnPrefix.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringCdnPrefix' { + It 'List' { + { + $cdnPrefixes = Get-AzPeeringCdnPrefix -PeeringLocation Seattle + $cdnPrefixes.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringConnectionMonitorTest.Tests.ps1 b/src/Peering/test/Get-AzPeeringConnectionMonitorTest.Tests.ps1 new file mode 100644 index 000000000000..58f288755e45 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringConnectionMonitorTest.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringConnectionMonitorTest')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringConnectionMonitorTest.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringConnectionMonitorTest' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringLegacy.Tests.ps1 b/src/Peering/test/Get-AzPeeringLegacy.Tests.ps1 new file mode 100644 index 000000000000..15df1612ee6e --- /dev/null +++ b/src/Peering/test/Get-AzPeeringLegacy.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringLegacy')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringLegacy.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringLegacy' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringLocation.Recording.json b/src/Peering/test/Get-AzPeeringLocation.Recording.json new file mode 100644 index 000000000000..a7f035f36cb3 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringLocation.Recording.json @@ -0,0 +1,42 @@ +{ + "Get-AzPeeringLocation+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringLocations?kind=Direct\u0026api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringLocations?kind=Direct\u0026api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "9" ], + "x-ms-client-request-id": [ "82523222-8cf7-42cb-8a3c-c49c8c16010a" ], + "CommandName": [ "Get-AzPeeringLocation" ], + "FullCommandName": [ "Get-AzPeeringLocation_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "22fc2b5a-eb48-46d6-8ec0-4cd2a8e63190" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "599" ], + "x-ms-correlation-request-id": [ "603fb6de-089d-4658-a7ff-ef0949f5f8c1" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012516Z:603fb6de-089d-4658-a7ff-ef0949f5f8c1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "96632" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Cessnalaan 1\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 64,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/64\"\r\n },\r\n {\r\n \"address\": \"Science Park 121\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 104,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/104\"\r\n },\r\n {\r\n \"address\": \"Schepenbergweg 42\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1236,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1236\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Amsterdam\",\r\n \"country\": \"NL\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Amsterdam\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"21715 Filigree Ct\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Ashburn\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Ashburn\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Ifestou 76\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1949,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1949\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Athens\",\r\n \"country\": \"GR\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Athens\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"56 Marietta St NW\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 11,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/11\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Atlanta\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US 2\"\r\n },\r\n \"name\": \"Atlanta\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"7A Parkhead Place\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1353,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1353\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Auckland\",\r\n \"country\": \"NZ\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Auckland\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Carrer de l\u0027Acer 30-32\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 122,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/122\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Barcelona\",\r\n \"country\": \"ES\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Barcelona\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Nonnendammallee 15\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 478,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/478\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Berlin\",\r\n \"country\": \"DE\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Berlin\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Carrera 106 No. 15A-25\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1354,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1354\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Bogota\",\r\n \"country\": \"CO\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Bogota\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"1 Summer Street\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 219,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/219\"\r\n },\r\n {\r\n \"address\": \"70 Innerbelt Rd\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 584,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/584\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Boston\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Boston\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"20 Wharf Street\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1340,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1340\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Brisbane\",\r\n \"country\": \"AU\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Brisbane\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Wezenbeekstraat 2\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 68,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/68\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Brussels\",\r\n \"country\": \"BE\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Brussels\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"8, Dimitrie Pompeiu Blvd., 3rd fl.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 439,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/439\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Bucharest\",\r\n \"country\": \"RO\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Bucharest\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Asztalos Sandor u. 13.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 301,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/301\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Budapest\",\r\n \"country\": \"HU\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Budapest\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Colectora Este 32375\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2114,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2114\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Buenos Aires\",\r\n \"country\": \"AR\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Buenos Aires\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Great Westerford Building, 240 Main Road\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1225,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1225\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Cape Town\",\r\n \"country\": \"ZA\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"Cape Town\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"4th floor, 2nd block\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 552,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/552\"\r\n },\r\n {\r\n \"address\": \"Bharti Towers\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2006,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2006\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Chennai\",\r\n \"country\": \"IN\",\r\n \"azureRegion\": \"South India\"\r\n },\r\n \"name\": \"Chennai\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"350 E Cermak Rd\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 7,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/7\"\r\n },\r\n {\r\n \"address\": \"427 S. LaSalle\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 440,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/440\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Chicago\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"North Central US\"\r\n },\r\n \"name\": \"Chicago\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Industriparken 20A\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 148,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/148\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Copenhagen\",\r\n \"country\": \"DK\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Copenhagen\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Lingkaran Teknokrat Timur\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 5655,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/5655\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Cyberjaya\",\r\n \"country\": \"\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Cyberjaya\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"1950 N Stemmons Fwy\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 69,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/69\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Dallas\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Dallas\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"910 15th Street\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 389,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/389\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Denver\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West Central US\"\r\n },\r\n \"name\": \"Denver\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"21005 Lahser Rd\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1927,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1927\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Detroit\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Detroit\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"International Media Production Zone (IMPZ)\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1355,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1355\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Dubai\",\r\n \"country\": \"AE\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Dubai\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Unit 4027, Kingswood Road\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 164,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/164\"\r\n },\r\n {\r\n \"address\": \"Unit 2, North West Business Park\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1065,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1065\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Dublin\",\r\n \"country\": \"IE\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Dublin\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"In der Steele 29\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 106,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/106\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Dusseldorf\",\r\n \"country\": \"DE\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Dusseldorf\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Hanauer Landstrasse 298\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 58,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/58\"\r\n },\r\n {\r\n \"address\": \"Gutleutstrasse 310\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 74,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/74\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Frankfurt\",\r\n \"country\": \"DE\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Frankfurt\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Route du Bois-des-Fréres 46\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 826,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/826\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Geneva\",\r\n \"country\": \"CH\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Geneva\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Parrukatu 2\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1457,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1457\"\r\n },\r\n {\r\n \"address\": \"Sahamyllyntie 4\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1459,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1459\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Helsinki\",\r\n \"country\": \"FI\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Helsinki\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"H158/2A Hoang Hoa Tham\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 8755,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/8755\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Ho Chi Minh City\",\r\n \"country\": \"VN\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Ho Chi Minh City\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"17/F Global Gateway\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 170,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/170\"\r\n },\r\n {\r\n \"address\": \"399 Chai Wan Road\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 225,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/225\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Hong Kong\",\r\n \"country\": \"HK\",\r\n \"azureRegion\": \"East Asia\"\r\n },\r\n \"name\": \"Hong Kong\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"3375 Koapaka St\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2526,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2526\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Honolulu\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"Honolulu\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"5150 \u0026 5170 Westway Park Blvd\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1476,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1476\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Houston\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Houston\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"HUDA Techno Enclave, HITEC City\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 5236,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/5236\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Hyderabad\",\r\n \"country\": \"IN\",\r\n \"azureRegion\": \"South India\"\r\n },\r\n \"name\": \"Hyderabad\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Yukarı Dudullu Organize Sanayi Bölgesi\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 4148,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/4148\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Istanbul\",\r\n \"country\": \"TR\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Istanbul\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"6602 Executive Park Court N\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2076,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2076\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Jacksonville\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US 2\"\r\n },\r\n \"name\": \"Jacksonville\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Cyber Building, 1st floor. Jl. Kuningan Barat no. 8\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2368,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2368\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Jakarta\",\r\n \"country\": \"ID\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Jakarta\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"5 Brewery Street\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 850,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/850\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Johannesburg\",\r\n \"country\": \"ZA\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"Johannesburg\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Ground Floor, Menara AIMS\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 460,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/460\"\r\n },\r\n {\r\n \"address\": \"CSF Building, Computer Exchange\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1279,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1279\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Kuala Lumpur\",\r\n \"country\": \"MY\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Kuala Lumpur\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Oregun, Ikeja\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 4411,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/4411\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Lagos\",\r\n \"country\": \"NG\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Lagos\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"7135 S Decatur Boulevard\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 770,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/770\"\r\n },\r\n {\r\n \"address\": \"1541 Pama Ln\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1918,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1918\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Las Vegas\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"Las Vegas\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Av. Severiano Falcao, 14\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 126,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/126\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Lisbon\",\r\n \"country\": \"PT\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Lisbon\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Sovereign House\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 40,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/40\"\r\n },\r\n {\r\n \"address\": \"8 Buckingham Avenue\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 832,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/832\"\r\n },\r\n {\r\n \"address\": \"14 Coriander Avenue\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 4360,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/4360\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"London\",\r\n \"country\": \"GB\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"London\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"600 W 7th St\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 8,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/8\"\r\n },\r\n {\r\n \"address\": \"624 S. Grand Ave.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 19,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/19\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Los Angeles\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"Los Angeles\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Avenida Pedro Castro Van Dúnem Loy\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1275,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1275\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Luanda\",\r\n \"country\": \"AO\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Luanda\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"C/ Albasanz 71\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 130,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/130\"\r\n },\r\n {\r\n \"address\": \"Calle Isabel Colbrand 6-8\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 179,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/179\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Madrid\",\r\n \"country\": \"ES\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Madrid\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Manchester Science Park\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 76,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/76\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Manchester\",\r\n \"country\": \"GB\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Manchester\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"3F PLDT Bldg. Danny Floro St. corner CP Garcia St.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 4810,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/4810\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Manila\",\r\n \"country\": \"PH\",\r\n \"azureRegion\": \"East Asia\"\r\n },\r\n \"name\": \"Manila\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"40 avenue Roger Salengro\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 226,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/226\"\r\n },\r\n {\r\n \"address\": \"71 Avenue André Roussin\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1879,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1879\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Marseille\",\r\n \"country\": \"FR\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Marseille\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"820 Lorimer Street\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1339,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1339\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Melbourne\",\r\n \"country\": \"AU\",\r\n \"azureRegion\": \"Australia Southeast\"\r\n },\r\n \"name\": \"Melbourne\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"4005 S Mendenhall Rd\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1930,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1930\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Memphis\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Memphis\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Privada de la Princesa 4\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1778,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1778\"\r\n },\r\n {\r\n \"address\": \"Epigmenio González 2, Industria del Hierro\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 11756,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/11756\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Mexico\",\r\n \"country\": \"MX\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Mexico\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"50 NE 9th St\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 15,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/15\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Miami\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US 2\"\r\n },\r\n \"name\": \"Miami\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Via Caldera, 21\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1974,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1974\"\r\n },\r\n {\r\n \"address\": \"Via Monzoro 105\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 3348,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/3348\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Milan\",\r\n \"country\": \"IT\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Milan\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"511 11th Ave S\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 803,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/803\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Minneapolis\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Minneapolis\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"1250 Rene Levesque West\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1944,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1944\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Montreal\",\r\n \"country\": \"CA\",\r\n \"azureRegion\": \"Canada East\"\r\n },\r\n \"name\": \"Montreal\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Kashinath Dhuru Marg\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 554,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/554\"\r\n },\r\n {\r\n \"address\": \"Plot No, TPS-2, 14/3, 2nd floor\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2046,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2046\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Mumbai\",\r\n \"country\": \"IN\",\r\n \"azureRegion\": \"West India\"\r\n },\r\n \"name\": \"Mumbai\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Landsberger Str. 155\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 109,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/109\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Munich\",\r\n \"country\": \"DE\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Munich\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Sameer Business Park\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1964,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1964\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Nairobi\",\r\n \"country\": \"KE\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nairobi\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"1841 Air Lane Dr\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1924,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1924\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Nashville\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Nashville\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"VSNL Colony\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1982,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1982\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"New Delhi\",\r\n \"country\": \"IN\",\r\n \"azureRegion\": \"West India\"\r\n },\r\n \"name\": \"New Delhi\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"111 8th Avenue\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 38,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/38\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"New York\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"New York\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"165 Halsey St\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 350,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/350\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Newark\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Newark\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"NTT DATA Dojima Bldg\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1157,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1157\"\r\n },\r\n {\r\n \"address\": \"1-26-1 Shinmachi Nishi-ku\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1791,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1791\"\r\n },\r\n {\r\n \"address\": \"3-1-7 Dojima, Kita-ku, Osaka-shi\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2072,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2072\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Osaka\",\r\n \"country\": \"JP\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Osaka\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Ulvenveien 89b\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 345,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/345\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Oslo\",\r\n \"country\": \"NO\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Oslo\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"529 Bryant St\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 5,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/5\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Palo Alto\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"Palo Alto\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"137 Boulevard Voltaire\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 53,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/53\"\r\n },\r\n {\r\n \"address\": \"11-13 Avenue des Arts et Metiers\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 714,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/714\"\r\n },\r\n {\r\n \"address\": \"Boulevard General Leclerc, 160\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1244,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1244\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Paris\",\r\n \"country\": \"FR\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Paris\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"91 Moo12, Phahonyothin Road\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 6741,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/6741\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Pathum Thani\",\r\n \"country\": \"TH\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Pathum Thani\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"1 William Street\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 568,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/568\"\r\n },\r\n {\r\n \"address\": \"4 Millrose Drive\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1940,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1940\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Perth\",\r\n \"country\": \"AU\",\r\n \"azureRegion\": \"Australia Central\"\r\n },\r\n \"name\": \"Perth\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"401 North Broad Street\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 146,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/146\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Philadelphia\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Philadelphia\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"2335 South Ellis Road\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1488,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1488\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Phoenix\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"Phoenix\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"6327 NE Evergreen Parkway\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1922,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1922\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Portland\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Portland\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Nad Elektrarnou 1428/47\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 214,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/214\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Prague\",\r\n \"country\": \"CZ\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Prague\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"T-1, V S N L Old Colony, Dighi, Pimpri-Chinchwad\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 6777,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/6777\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Pune\",\r\n \"country\": \"IN\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Pune\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"2200 M St NE\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 5545,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/5545\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Quincy\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Quincy\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Hodneveien 240\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 5343,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/5343\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Rennesoy\",\r\n \"country\": \"NO\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Rennesoy\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"12100 Sunrise Valley Drive\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 668,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/668\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Reston\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Reston\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"329 - Sao Cristovao\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1374,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1374\"\r\n },\r\n {\r\n \"address\": \"Estrada Adhemar Bebiano, 1380\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1899,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1899\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Rio de Janeiro\",\r\n \"country\": \"BR\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Rio de Janeiro\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Via dei Tizi 6/b\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 555,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/555\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Rome\",\r\n \"country\": \"IT\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Rome\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"2302 Presidents Drive\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2077,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2077\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Salt Lake City\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West Central US\"\r\n },\r\n \"name\": \"Salt Lake City\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"9999 Westover Hills Blvd\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1484,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1484\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"San Antonio\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"San Antonio\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"5761 Copley Dr\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1928,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1928\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"San Diego\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"San Diego\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"11 Great Oaks Blvd\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 6,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/6\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"San Jose\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"San Jose\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"3020 Coronado Drive\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 3344,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/3344\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Santa Clara\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"Santa Clara\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Santa Marta de Huechuraba 6951\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2093,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2093\"\r\n },\r\n {\r\n \"address\": \"Bodegas Megaflex\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 11784,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/11784\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Santiago\",\r\n \"country\": \"CL\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Santiago\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Ceci Avenue, 1900\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 165,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/165\"\r\n },\r\n {\r\n \"address\": \"Alameda Araguaia 3641\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1283,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1283\"\r\n },\r\n {\r\n \"address\": \"Rua Bento Branco de Andrade Filho, 621\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1325,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1325\"\r\n },\r\n {\r\n \"address\": \"Av Pierre Simon de Laplace n1211\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2812,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2812\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Sao Paulo\",\r\n \"country\": \"BR\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Sao Paulo\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"2001 Sixth Avenue\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 71,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/71\"\r\n },\r\n {\r\n \"address\": \"2001 Sixth Avenue\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 86,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/86\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Seattle\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Seattle\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"323 Mokdongdong-ro Yangcheon-gu\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2491,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2491\"\r\n },\r\n {\r\n \"address\": \"3F, 189, Gasan Digital 1-ro, Geumcheon-gu\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 7674,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/7674\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Seoul\",\r\n \"country\": \"KR\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Seoul\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"20 Ayer Rajah Crescent\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 282,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/282\"\r\n },\r\n {\r\n \"address\": \" 2 TAI SENG AVENUE\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 388,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/388\"\r\n },\r\n {\r\n \"address\": \"26A Ayer Rajah Crescent\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2260,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2260\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Singapore\",\r\n \"country\": \"SG\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Singapore\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"122 Ovcho Pole str.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 663,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/663\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Sofia\",\r\n \"country\": \"BG\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Sofia\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Mariehällsvägen 36\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 156,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/156\"\r\n },\r\n {\r\n \"address\": \"Esbogatan 11\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 208,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/208\"\r\n },\r\n {\r\n \"address\": \"Kvastvägen 25-29\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 684,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/684\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Stockholm\",\r\n \"country\": \"SE\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Stockholm\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Unit B 639 Gardeners Road\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 131,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/131\"\r\n },\r\n {\r\n \"address\": \"4 Eden Park Drive\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1660,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1660\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Sydney\",\r\n \"country\": \"AU\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Sydney\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"NO. 8, Guoqing Rd., Banqiao Dist.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2886,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2886\"\r\n },\r\n {\r\n \"address\": \"No. 37 Lane 188, Ruiguang Rd. Nei-hu Dist.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 5678,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/5678\"\r\n },\r\n {\r\n \"address\": \"No. 31, Aiguo E. Rd., Da’an Dist., Taipei City 106, Taiwan (R.O.C.)\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 5904,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/5904\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Taipei\",\r\n \"country\": \"TW\",\r\n \"azureRegion\": \"East Asia\"\r\n },\r\n \"name\": \"Taipei\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"1531 Commonwealth Business Dr.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2074,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2074\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Tallahassee\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Tallahassee\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"6 Nevatim street\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 8433,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/8433\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Tel Aviv\",\r\n \"country\": \"IL\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Tel Aviv\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"800 Secaucus Road\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 36,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/36\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Teterboro\",\r\n \"country\": \"US\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Teterboro\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Otemachi Building\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 142,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/142\"\r\n },\r\n {\r\n \"address\": \"ComSpace Bldg.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 599,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/599\"\r\n },\r\n {\r\n \"address\": \"Koto-ku\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 738,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/738\"\r\n },\r\n {\r\n \"address\": \"Otemachi Finance City\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1893,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1893\"\r\n },\r\n {\r\n \"address\": \"***, ***, Inzai-shi,Chiba, 270-****\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 9596,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/9596\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Tokyo\",\r\n \"country\": \"JP\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Tokyo\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"151 Front St W.\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 775,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/775\"\r\n },\r\n {\r\n \"address\": \"905 King Street West\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 7011,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/7011\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Toronto\",\r\n \"country\": \"CA\",\r\n \"azureRegion\": \"Canada Central\"\r\n },\r\n \"name\": \"Toronto\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"555 West Hastings St\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1330,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1330\"\r\n },\r\n {\r\n \"address\": \"1050 W Pender Street\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1881,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1881\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Vancouver\",\r\n \"country\": \"CA\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Vancouver\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Louis-Haefliger-Gasse 10\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 67,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/67\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Vienna\",\r\n \"country\": \"AT\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Vienna\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Al. Jerozolimskie 65/79\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 509,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/509\"\r\n },\r\n {\r\n \"address\": \"23 Poleczki\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 2908,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/2908\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Warsaw\",\r\n \"country\": \"PL\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Warsaw\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Selska cesta 93\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 1368,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/1368\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Zagreb\",\r\n \"country\": \"HR\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Zagreb\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n },\r\n {\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"peeringFacilities\": [\r\n {\r\n \"address\": \"Sagereistrasse 35\",\r\n \"directPeeringType\": \"Edge\",\r\n \"peeringDBFacilityId\": 81,\r\n \"peeringDBFacilityLink\": \"https://www.peeringdb.com/fac/81\"\r\n }\r\n ],\r\n \"bandwidthOffers\": [\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n },\r\n {\r\n \"offerName\": \"100Gbps\",\r\n \"valueInMbps\": 100000\r\n }\r\n ]\r\n },\r\n \"peeringLocation\": \"Zurich\",\r\n \"country\": \"CH\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Zurich\",\r\n \"type\": \"Microsoft.Peering/peeringLocations\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringLocation.Tests.ps1 b/src/Peering/test/Get-AzPeeringLocation.Tests.ps1 new file mode 100644 index 000000000000..7878002c5b82 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringLocation.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringLocation')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringLocation.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringLocation' { + It 'List' { + { + $locations = Get-AzPeeringLocation -Kind Direct + $locations.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringReceivedRoute.Recording.json b/src/Peering/test/Get-AzPeeringReceivedRoute.Recording.json new file mode 100644 index 000000000000..f56a742524d1 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringReceivedRoute.Recording.json @@ -0,0 +1,42 @@ +{ + "Get-AzPeeringReceivedRoute+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/receivedRoutes?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/receivedRoutes?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "10" ], + "x-ms-client-request-id": [ "8672df9e-cb95-46f6-808e-26e59784175d" ], + "CommandName": [ "Get-AzPeeringReceivedRoute" ], + "FullCommandName": [ "Get-AzPeeringReceivedRoute_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "dbb5863f-abff-4a54-9e75-4d6136934545" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "7afeeb26-845d-4d29-a0cf-4363c58bca30" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012517Z:7afeeb26-845d-4d29-a0cf-4363c58bca30" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "59373" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"prefix\": \"1.0.0.0/24\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 13335\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-12-05T11:51:51.2062620Z\"\r\n },\r\n {\r\n \"prefix\": \"1.1.1.0/24\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 13335\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-12-05T11:51:51.2062620Z\"\r\n },\r\n {\r\n \"prefix\": \"1.119.192.0/21\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:11.7043790Z\"\r\n },\r\n {\r\n \"prefix\": \"1.119.200.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:11.7043790Z\"\r\n },\r\n {\r\n \"prefix\": \"1.119.204.0/24\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 59034\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045170Z\"\r\n },\r\n {\r\n \"prefix\": \"1.160.0.0/12\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.160.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.161.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.162.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.163.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.164.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.165.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.166.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.167.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.168.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.169.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.170.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.171.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.172.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.173.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062640Z\"\r\n },\r\n {\r\n \"prefix\": \"1.174.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.175.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.179.112.0/20\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 15169 396982\",\r\n \"originAsValidationState\": \"Unknown\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:16.7056160Z\"\r\n },\r\n {\r\n \"prefix\": \"1.188.0.0/14\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:15.7051820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.2.4.0/24\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 24151\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:10.7044540Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.0.0/13\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:15.7051820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.192.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.196.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.216.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.236.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.32.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.36.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.80.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.81.0/24\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-05-01T01:53:19.5844330Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.84.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.88.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.92.0/24\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.93.0/24\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.94.0/24\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.0.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.128.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.132.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.24.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.28.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.32.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.4.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.40.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.44.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.92.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.12.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.140.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.148.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.156.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.16.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.168.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.176.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.20.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.224.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.24.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.96.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.100.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.164.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.180.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.184.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.40.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.44.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.48.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.92.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.96.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.31.192.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.31.36.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T05:21:13.7045630Z\"\r\n },\r\n {\r\n \"prefix\": \"1.34.0.0/15\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.34.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:16.2062640Z\"\r\n },\r\n {\r\n \"prefix\": \"1.35.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.0.0/16\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:06:43.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.0.0/17\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.100.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.104.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.108.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.112.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.116.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.120.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.124.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.128.0/17\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.128.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.132.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.136.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.140.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.144.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.148.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.152.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.156.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.16.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.160.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.164.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.168.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.172.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.176.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.180.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.184.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:15.2062680Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.188.0/22\",\r\n \"nextHop\": \"12.90.152.69\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:44.2062660Z\"\r\n },\r\n {\r\n \"prefix\": \"1.0.0.0/24\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 13335\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-12-05T11:51:51.7220900Z\"\r\n },\r\n {\r\n \"prefix\": \"1.1.1.0/24\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 13335\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-12-05T11:51:51.7220900Z\"\r\n },\r\n {\r\n \"prefix\": \"1.119.192.0/21\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:52.6816360Z\"\r\n },\r\n {\r\n \"prefix\": \"1.119.200.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:52.6816360Z\"\r\n },\r\n {\r\n \"prefix\": \"1.119.204.0/24\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 59034\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:44.6812560Z\"\r\n },\r\n {\r\n \"prefix\": \"1.160.0.0/12\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.160.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.161.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.162.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.163.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.164.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.165.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.166.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.167.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.168.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.169.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.170.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.171.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.172.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.173.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220860Z\"\r\n },\r\n {\r\n \"prefix\": \"1.174.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.175.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.179.112.0/20\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 15169 396982\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-12-24T09:07:58.7221460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.188.0.0/14\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:48.6815180Z\"\r\n },\r\n {\r\n \"prefix\": \"1.2.4.0/24\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 24151\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:43.6813030Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.0.0/13\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:48.6815180Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.192.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.196.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.216.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.236.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.32.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.36.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.80.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.81.0/24\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-05-01T01:53:18.8292190Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.84.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.88.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.92.0/24\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.93.0/24\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.24.94.0/24\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.0.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.128.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.132.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.24.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.28.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.32.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.4.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.40.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.44.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.25.92.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.12.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.140.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.148.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.156.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.16.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.168.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.176.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.20.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.224.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.24.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.28.96.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.100.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.164.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.180.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.184.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.40.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.44.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.48.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.92.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.30.96.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.31.192.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.31.36.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 139007\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2021-12-07T06:16:45.6811060Z\"\r\n },\r\n {\r\n \"prefix\": \"1.34.0.0/15\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.34.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:15.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.35.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 9680 9680 3462\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Valid\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-11-29T07:46:45.7220820Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.0.0/16\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:06:16.9256440Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.0.0/17\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.100.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.104.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256400Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.108.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256400Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.112.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.116.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256440Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.120.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.124.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.128.0/17\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.128.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256440Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.132.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.136.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256440Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.140.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256400Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.144.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.148.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256440Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.152.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.156.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.16.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.160.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256440Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.164.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.168.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256440Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.172.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256440Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.176.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.180.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.184.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:27:20.9256440Z\"\r\n },\r\n {\r\n \"prefix\": \"1.45.188.0/22\",\r\n \"nextHop\": \"12.125.145.33\",\r\n \"asPath\": \"7018 4837 4808 45083\",\r\n \"originAsValidationState\": \"Valid\",\r\n \"rpkiValidationState\": \"Unknown\",\r\n \"trustAnchor\": \"None\",\r\n \"receivedTimestamp\": \"2022-09-25T21:14:48.9256460Z\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringReceivedRoute.Tests.ps1 b/src/Peering/test/Get-AzPeeringReceivedRoute.Tests.ps1 new file mode 100644 index 000000000000..6a6034f6fc36 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringReceivedRoute.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringReceivedRoute')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringReceivedRoute.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringReceivedRoute' { + It 'List' { + { + $routes = Get-AzPeeringReceivedRoute -PeeringName DemoPeering -ResourceGroupName DemoRG + $routes.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringRegisteredAsn.Recording.json b/src/Peering/test/Get-AzPeeringRegisteredAsn.Recording.json new file mode 100644 index 000000000000..2190aebc9aff --- /dev/null +++ b/src/Peering/test/Get-AzPeeringRegisteredAsn.Recording.json @@ -0,0 +1,82 @@ +{ + "Get-AzPeeringRegisteredAsn+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "11" ], + "x-ms-client-request-id": [ "7a45c7c5-95ca-4347-8739-981946896caf" ], + "CommandName": [ "Get-AzPeeringRegisteredAsn" ], + "FullCommandName": [ "Get-AzPeeringRegisteredAsn_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "1a449030-4a85-47be-a942-17ef2d85d806" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "x-ms-correlation-request-id": [ "928eb76f-45fa-4459-9123-bec563b2e05e" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012517Z:928eb76f-45fa-4459-9123-bec563b2e05e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "897" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"asn\": 6500,\r\n \"peeringServicePrefixKey\": \"767c9f30-7388-49ef-ba8e-e2d16d1c08e4\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"fgfg\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/fgfg\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredAsns\"\r\n },\r\n {\r\n \"properties\": {\r\n \"asn\": 65000,\r\n \"peeringServicePrefixKey\": \"32259ee0-ea01-495e-8279-06c24ef7aae0\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"homedepottest\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/homedepottest\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredAsns\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + }, + "Get-AzPeeringRegisteredAsn+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/fgfg?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/fgfg?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "12" ], + "x-ms-client-request-id": [ "5e5261da-668c-44b1-b692-4186aa9d9a64" ], + "CommandName": [ "Get-AzPeeringRegisteredAsn" ], + "FullCommandName": [ "Get-AzPeeringRegisteredAsn_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "daf75a4c-dd2a-441e-b53a-729f6201efe3" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11996" ], + "x-ms-correlation-request-id": [ "a13cf023-95e9-4a08-bcb1-8a43d4b55bd0" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012517Z:a13cf023-95e9-4a08-bcb1-8a43d4b55bd0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "385" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"asn\": 6500,\r\n \"peeringServicePrefixKey\": \"767c9f30-7388-49ef-ba8e-e2d16d1c08e4\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"fgfg\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/fgfg\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredAsns\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringRegisteredAsn.Tests.ps1 b/src/Peering/test/Get-AzPeeringRegisteredAsn.Tests.ps1 new file mode 100644 index 000000000000..d9a652388d3f --- /dev/null +++ b/src/Peering/test/Get-AzPeeringRegisteredAsn.Tests.ps1 @@ -0,0 +1,31 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringRegisteredAsn')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringRegisteredAsn.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringRegisteredAsn' { + It 'List' { + { + $asns = Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo + $asns.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $fgfgAsn = Get-AzPeeringRegisteredAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Name fgfg + $fgfgAsn.Name | Should -Be "fgfg" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringRegisteredPrefix.Recording.json b/src/Peering/test/Get-AzPeeringRegisteredPrefix.Recording.json new file mode 100644 index 000000000000..8d563644388a --- /dev/null +++ b/src/Peering/test/Get-AzPeeringRegisteredPrefix.Recording.json @@ -0,0 +1,82 @@ +{ + "Get-AzPeeringRegisteredPrefix+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "13" ], + "x-ms-client-request-id": [ "a8385ec0-d6f5-446e-84de-ddbaab4e82fd" ], + "CommandName": [ "Get-AzPeeringRegisteredPrefix" ], + "FullCommandName": [ "Get-AzPeeringRegisteredPrefix_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "4fbd3574-8139-4f3d-9cdc-8b823f935cf1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11995" ], + "x-ms-correlation-request-id": [ "991efdb8-406e-474b-ba9c-1075206c5735" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012517Z:991efdb8-406e-474b-ba9c-1075206c5735" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2912" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"prefix\": \"240.0.0.0/24\",\r\n \"prefixValidationState\": \"Failed\",\r\n \"peeringServicePrefixKey\": \"f5947454-80e3-4ce5-bcb3-2501537b6952\",\r\n \"errorMessage\": \"Internal server error\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"accessibilityTesting1\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting1\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"240.0.1.0/24\",\r\n \"prefixValidationState\": \"Failed\",\r\n \"peeringServicePrefixKey\": \"249aa0dd-6177-4105-94fe-dfefcbf5ab48\",\r\n \"errorMessage\": \"Internal server error\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"accessibilityTesting2\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting2\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"240.0.2.0/24\",\r\n \"prefixValidationState\": \"Failed\",\r\n \"peeringServicePrefixKey\": \"4fb59e9e-d4eb-4847-b2ad-9939edda750b\",\r\n \"errorMessage\": \"Internal server error\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"accessibilityTesting3\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting3\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"240.0.4.0/24\",\r\n \"prefixValidationState\": \"Failed\",\r\n \"peeringServicePrefixKey\": \"b725f16c-759b-4144-93ed-ed4eb89cb8f7\",\r\n \"errorMessage\": \"Internal server error\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"accessibilityTesting4\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting4\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredPrefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"240.0.3.0/24\",\r\n \"prefixValidationState\": \"Failed\",\r\n \"peeringServicePrefixKey\": \"bb1262ca-0b31-45f3-a301-105b0615b21c\",\r\n \"errorMessage\": \"Internal server error\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"accessibilityTesting5\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting5\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredPrefixes\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + }, + "Get-AzPeeringRegisteredPrefix+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting1?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting1?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "14" ], + "x-ms-client-request-id": [ "a48975fb-20ed-4697-8212-6648c44c6537" ], + "CommandName": [ "Get-AzPeeringRegisteredPrefix" ], + "FullCommandName": [ "Get-AzPeeringRegisteredPrefix_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "de416494-6ac4-4ef8-9da3-90d973d5c711" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], + "x-ms-correlation-request-id": [ "da1a1615-73c8-45ec-be6e-c16430f3f7b2" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012518Z:da1a1615-73c8-45ec-be6e-c16430f3f7b2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "527" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"prefix\": \"240.0.0.0/24\",\r\n \"prefixValidationState\": \"Failed\",\r\n \"peeringServicePrefixKey\": \"f5947454-80e3-4ce5-bcb3-2501537b6952\",\r\n \"errorMessage\": \"Internal server error\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"accessibilityTesting1\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting1\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredPrefixes\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringRegisteredPrefix.Tests.ps1 b/src/Peering/test/Get-AzPeeringRegisteredPrefix.Tests.ps1 new file mode 100644 index 000000000000..1cb3c0ec6e87 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringRegisteredPrefix.Tests.ps1 @@ -0,0 +1,32 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringRegisteredPrefix')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringRegisteredPrefix.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringRegisteredPrefix' { + It 'List' { + { + $prefixes = Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG + $prefixes.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $prefix = Get-AzPeeringRegisteredPrefix -PeeringName DemoPeering -ResourceGroupName DemoRG -Name accessibilityTesting1 + $prefix.Name | Should -Be "accessibilityTesting1" + } | Should -Not -Throw + } + +} diff --git a/src/Peering/test/Get-AzPeeringRpUnbilledPrefix.Recording.json b/src/Peering/test/Get-AzPeeringRpUnbilledPrefix.Recording.json new file mode 100644 index 000000000000..fe5d7bdb95f4 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringRpUnbilledPrefix.Recording.json @@ -0,0 +1,44 @@ +{ + "Get-AzPeeringRpUnbilledPrefix+[NoContext]+List+$GET+https://management.azure.com/subscriptions/4445bf11-61c4-436f-a940-60194f8aca57/resourceGroups/Seattle/providers/Microsoft.Peering/peerings/CdnPeering/rpUnbilledPrefixes?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://api-dogfood.resources.windows-int.net/subscriptions/4445bf11-61c4-436f-a940-60194f8aca57/resourceGroups/Seattle/providers/Microsoft.Peering/peerings/CdnPeering/rpUnbilledPrefixes?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "6415df04-5976-45bb-8ef8-bb3ef250c090" ], + "CommandName": [ "Get-AzPeeringRpUnbilledPrefix" ], + "FullCommandName": [ "Get-AzPeeringRpUnbilledPrefix_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "82ff3c58-df01-4c4a-a70c-d5c636c12c44" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "14997" ], + "x-ms-correlation-request-id": [ "dcb47447-ae93-4b7c-a7b9-04b7d674bdd5" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230113T191800Z:dcb47447-ae93-4b7c-a7b9-04b7d674bdd5" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A900CBE4ACF748ABA133C37C7C276934 Ref B: PAOEDGE0621 Ref C: 2023-01-13T19:18:00Z" ], + "Date": [ "Fri, 13 Jan 2023 19:18:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "37973" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"prefix\": \"2.16.0.0/13\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"23.0.0.0/12\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"23.32.0.0/11\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"23.64.0.0/14\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"23.72.0.0/13\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"23.92.16.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"23.92.28.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"23.192.0.0/11\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"23.239.8.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"23.239.16.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"43.254.120.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.33.64.0/19\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.33.96.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.56.96.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.56.112.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.79.128.0/18\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.79.192.0/19\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.79.244.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.79.252.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.32.0/19\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"59.151.128.0/18\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"60.254.128.0/18\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"63.141.192.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"63.141.196.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"63.233.112.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"63.233.126.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"63.235.20.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"63.243.228.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"63.243.230.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"63.243.231.0/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"64.86.204.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"64.86.206.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"64.124.167.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"65.115.216.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"65.158.184.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"66.171.230.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"66.175.208.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"66.198.8.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"66.228.32.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"66.228.56.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"66.246.75.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"66.246.76.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"66.246.138.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"67.220.142.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.22.150.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.22.154.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.31.38.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.31.74.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.31.112.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.31.118.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.31.119.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.31.121.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.31.122.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.164.208.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.174.30.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"69.192.0.0/16\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"70.39.169.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"72.246.0.0/15\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"72.249.192.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"72.249.193.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"72.249.197.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"74.207.224.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"77.67.85.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"77.67.126.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"80.67.64.0/19\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"84.53.128.0/18\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"88.221.0.0/16\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"92.122.0.0/15\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"95.100.0.0/15\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"96.6.0.0/15\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"96.16.0.0/15\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"96.126.104.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"97.107.128.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"103.238.148.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"104.64.0.0/10\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"104.200.28.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"104.237.144.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"109.69.136.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"118.214.0.0/16\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"118.215.0.0/17\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"118.215.128.0/18\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"122.252.32.0/19\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"122.252.128.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"125.56.128.0/17\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"125.252.192.0/18\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"128.241.91.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"128.241.217.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"128.241.218.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"131.103.136.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"131.103.156.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.16.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.48.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.80.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.128.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.164.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.168.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.184.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.232.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.240.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.248.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.162.145.220/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.177.200.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"140.174.24.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"143.42.0.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"157.238.70.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"157.238.79.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"162.216.16.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.0.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.2.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.23.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.26.128/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.40.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.44.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.50.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.52.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.58.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.81.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.82.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.96.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.107.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.110.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.119.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.123.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.133.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.136.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.138.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.141.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.142.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.145.64/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.150.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.156.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.203.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.203.192/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.206.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.212.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.215.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.237.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.238.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.240.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.244.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.246.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.247.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"168.143.240.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"168.143.242.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"170.187.129.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"170.187.131.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"170.187.134.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"170.187.136.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"170.187.144.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"170.187.160.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"170.187.200.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"170.199.195.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"170.199.196.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.4.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.8.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.16.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.200.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.208.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.128.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.134.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.145.236/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.147.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.148.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.152.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.224.0.0/12\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"173.205.14.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"173.205.28.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"173.205.69.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"173.205.72.128/27\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"173.222.0.0/15\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"173.230.128.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"173.255.224.0/20\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"184.24.0.0/13\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"184.50.0.0/15\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"184.84.0.0/14\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"192.33.24.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"192.80.13.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"192.81.134.237/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"192.155.88.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"192.204.5.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"192.204.26.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"193.108.88.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"193.108.152.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"194.195.208.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"195.245.124.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"198.47.116.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"198.63.231.192/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"198.74.52.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"198.74.56.0/21\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"198.87.182.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"198.144.96.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"198.144.102.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"198.173.160.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"199.239.182.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"199.239.184.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.1.141.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.132.64/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.132.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.136.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.139.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.145.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.146.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.158.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.160.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.162.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.164.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.196.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.211.0/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.232.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.241.128/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.243.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.2.254.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.8.48.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.10.28.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.93.38.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.93.46.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.93.48.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.141.239.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.201.160.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.134.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.135.0/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.142.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.173.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.182.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.183.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.186.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.188.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.201.0/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.204.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.222.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.229.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.231.0/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.237.231.192/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.245.143.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"206.239.100.0/23\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"207.192.68.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"207.192.72.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"208.184.139.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"208.185.115.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"209.123.162.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"209.123.234.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"216.206.145.128/26\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.192.45/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.192.46/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.252.70/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.33.108.229/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"194.233.172.115/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"173.255.217.107/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"70.39.139.0/25\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"192.46.214.188/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.33.108.28/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.4/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.32/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.35/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.46/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.181.8/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.233/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.22/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.21/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.54/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.65/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.82/31\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.91/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.92/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.109/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.128/31\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.130/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.132/31\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.137/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.170/31\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.186/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.194/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.197/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.208/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.215/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.235/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.236/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.241/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.125/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.168/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.192/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.72/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"50.116.7.213/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.162.106.146/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.224.86/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.162.114.72/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.125.184/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"96.126.124.45/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"165.254.245.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.20/31\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.23/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.27/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.65/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.68/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.101/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.114/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.117/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.121/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.133/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.153/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.169/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.170/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.190/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.195/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.213/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.225/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.226/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.231/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.232/31\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.200.184/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.131/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.89/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.228/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.33.109.187/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.33.111.128/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.56.85.127/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.56.93.215/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.79.88.20/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"45.79.115.247/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.250/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.48/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.70/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"207.109.111.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.30/31\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.160/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.92.37/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.103.183/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.124.221/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.231.104/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.104.76/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.118.66/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"178.79.172.254/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.80.122/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"173.205.76.0/22\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.104.85/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.104.244/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.144.77.180/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.114.102/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"139.162.80.65/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.214.52/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.104.106.123/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.231.92/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"172.105.215.81/32\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n },\r\n {\r\n \"prefix\": \"204.156.7.0/24\",\r\n \"azureRegion\": \"West US 2\",\r\n \"peerAsn\": 65010\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringRpUnbilledPrefix.Tests.ps1 b/src/Peering/test/Get-AzPeeringRpUnbilledPrefix.Tests.ps1 new file mode 100644 index 000000000000..f716bc0eafc0 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringRpUnbilledPrefix.Tests.ps1 @@ -0,0 +1,26 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringRpUnbilledPrefix')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnvDogfood.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringRpUnbilledPrefix.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringRpUnbilledPrefix' { + It 'List' { + { + $env.SubscriptionId = "f686d426-8d16-42db-81b7-ab578e110ccd" + $env.Tenant = "4445bf11-61c4-436f-a940-60194f8aca57" + $prefixes = Get-AzPeeringRpUnbilledPrefix -PeeringName CdnPeering -ResourceGroupName Seattle + $prefixes.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringService.Recording.json b/src/Peering/test/Get-AzPeeringService.Recording.json new file mode 100644 index 000000000000..4b5a1e899a99 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringService.Recording.json @@ -0,0 +1,124 @@ +{ + "Get-AzPeeringService+[NoContext]+List1+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServices?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServices?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "15" ], + "x-ms-client-request-id": [ "67cdb48f-977a-47fd-b39a-9ae43e984328" ], + "CommandName": [ "Get-AzPeeringService" ], + "FullCommandName": [ "Get-AzPeeringService_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "01f9f314-256a-4a65-9b14-ffe533bef4d3", "fb2199f3-49dc-4dcb-ab66-4ca9cdc33b82", "84de8adb-1ec4-4f92-920e-2ee153e5c173" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "599" ], + "x-ms-request-id": [ "d11923e7-2cdd-41d9-8829-5b8dc7835758" ], + "x-ms-correlation-request-id": [ "d11923e7-2cdd-41d9-8829-5b8dc7835758" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012518Z:d11923e7-2cdd-41d9-8829-5b8dc7835758" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:18 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ], + "Content-Length": [ "3332" ] + }, + "Content": "{\"value\":[{\"properties\":{\"peeringServiceLocation\":\"Georgia\",\"peeringServiceProvider\":\"MicrosoftEdge\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Atlanta\"},\"location\":\"East US 2\",\"tags\":{},\"name\":\"TestPrefixForAtlanta\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestPrefixForAtlanta\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Virginia\",\"peeringServiceProvider\":\"MicrosoftEdge\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Dallas\"},\"location\":\"East US\",\"tags\":{},\"name\":\"TestExtension\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestExtension\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Virginia\",\"peeringServiceProvider\":\"MicrosoftEdge\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Atlanta\",\"providerBackupPeeringLocation\":\"Dallas\"},\"location\":\"East US\",\"tags\":{},\"name\":\"TestExtension2\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestExtension2\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"London\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"London\"},\"location\":\"UK South\",\"tags\":{},\"name\":\"DemoPeeringServiceInterCloudLondon\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/DemoPeeringServiceInterCloudLondon\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Ile-de-France\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\"},\"location\":\"UK South\",\"tags\":{\"hello\":\"world\"},\"name\":\"DRTestInterCloud\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/DRTestInterCloud\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Ile-de-France\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"London\"},\"location\":\"UK South\",\"tags\":{},\"name\":\"Gaurav Thareja\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/Gaurav Thareja\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Zurich\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Zurich\"},\"location\":\"France Central\",\"tags\":{},\"name\":\"TestDRInterCloudZurich\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestDRInterCloudZurich\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Ile-de-France\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Paris\"},\"location\":\"France Central\",\"name\":\"DRTest\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/DRTest\",\"type\":\"Microsoft.Peering/peeringServices\"}]}", + "isContentBase64": false + } + }, + "Get-AzPeeringService+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestExtension?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestExtension?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "16" ], + "x-ms-client-request-id": [ "ed8bdf59-d287-4209-b48f-f585dfa4c746" ], + "CommandName": [ "Get-AzPeeringService" ], + "FullCommandName": [ "Get-AzPeeringService_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "d94a6bcf-a36f-4bd0-93bb-e016b8e1a32e" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "598" ], + "x-ms-correlation-request-id": [ "b4921d18-3d7f-4272-bc75-d171e2e69c98" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012518Z:b4921d18-3d7f-4272-bc75-d171e2e69c98" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "467" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"peeringServiceLocation\": \"Virginia\",\r\n \"peeringServiceProvider\": \"MicrosoftEdge\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"providerPrimaryPeeringLocation\": \"Dallas\"\r\n },\r\n \"location\": \"East US\",\r\n \"tags\": {},\r\n \"name\": \"TestExtension\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestExtension\",\r\n \"type\": \"Microsoft.Peering/peeringServices\"\r\n}", + "isContentBase64": false + } + }, + "Get-AzPeeringService+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "17" ], + "x-ms-client-request-id": [ "b6e25a3d-2a15-4478-9608-a110937c65cf" ], + "CommandName": [ "Get-AzPeeringService" ], + "FullCommandName": [ "Get-AzPeeringService_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "cfa9f530-92bc-48ff-a848-6eed5a4f1808", "cb671b6c-3d1d-4167-bf35-5d8b786059af", "f7506798-318d-4a76-a36a-4fc134e77355" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "597" ], + "x-ms-request-id": [ "3798d4fb-1f42-417b-a6c5-f0a48325489f" ], + "x-ms-correlation-request-id": [ "3798d4fb-1f42-417b-a6c5-f0a48325489f" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012520Z:3798d4fb-1f42-417b-a6c5-f0a48325489f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:19 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ], + "Content-Length": [ "3332" ] + }, + "Content": "{\"value\":[{\"properties\":{\"peeringServiceLocation\":\"Georgia\",\"peeringServiceProvider\":\"MicrosoftEdge\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Atlanta\"},\"location\":\"East US 2\",\"tags\":{},\"name\":\"TestPrefixForAtlanta\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestPrefixForAtlanta\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Virginia\",\"peeringServiceProvider\":\"MicrosoftEdge\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Dallas\"},\"location\":\"East US\",\"tags\":{},\"name\":\"TestExtension\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestExtension\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Virginia\",\"peeringServiceProvider\":\"MicrosoftEdge\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Atlanta\",\"providerBackupPeeringLocation\":\"Dallas\"},\"location\":\"East US\",\"tags\":{},\"name\":\"TestExtension2\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestExtension2\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"London\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"London\"},\"location\":\"UK South\",\"tags\":{},\"name\":\"DemoPeeringServiceInterCloudLondon\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/DemoPeeringServiceInterCloudLondon\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Ile-de-France\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\"},\"location\":\"UK South\",\"tags\":{\"hello\":\"world\"},\"name\":\"DRTestInterCloud\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/DRTestInterCloud\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Ile-de-France\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"London\"},\"location\":\"UK South\",\"tags\":{},\"name\":\"Gaurav Thareja\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/Gaurav Thareja\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Zurich\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Zurich\"},\"location\":\"France Central\",\"tags\":{},\"name\":\"TestDRInterCloudZurich\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestDRInterCloudZurich\",\"type\":\"Microsoft.Peering/peeringServices\"},{\"properties\":{\"peeringServiceLocation\":\"Ile-de-France\",\"peeringServiceProvider\":\"InterCloud\",\"provisioningState\":\"Succeeded\",\"providerPrimaryPeeringLocation\":\"Paris\"},\"location\":\"France Central\",\"name\":\"DRTest\",\"id\":\"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/DRTest\",\"type\":\"Microsoft.Peering/peeringServices\"}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringService.Tests.ps1 b/src/Peering/test/Get-AzPeeringService.Tests.ps1 new file mode 100644 index 000000000000..c07edc12e4b9 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringService.Tests.ps1 @@ -0,0 +1,39 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringService')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringService.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringService' { + It 'List1' { + { + $allPeeringServices = Get-AzPeeringService + $allPeeringServices.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $peeringService = Get-AzPeeringService -ResourceGroupName DemoRG -Name TestExtension + $peeringService.Name | Should -Be "TestExtension" + } | Should -Not -Throw + } + + It 'List' { + { + $rgPeeringServices = Get-AzPeeringService -ResourceGroupName DemoRG + $rgPeeringServices.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + +} diff --git a/src/Peering/test/Get-AzPeeringServiceCountry.Recording.json b/src/Peering/test/Get-AzPeeringServiceCountry.Recording.json new file mode 100644 index 000000000000..c0a58380f7d3 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringServiceCountry.Recording.json @@ -0,0 +1,42 @@ +{ + "Get-AzPeeringServiceCountry+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "18" ], + "x-ms-client-request-id": [ "a00f82dc-e20b-4322-a8c2-f741a820b3c2" ], + "CommandName": [ "Get-AzPeeringServiceCountry" ], + "FullCommandName": [ "Get-AzPeeringServiceCountry_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "3993c7c5-c229-4051-a1f4-d42cbcd9a54e" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "599" ], + "x-ms-correlation-request-id": [ "c2d503eb-1043-48d3-90bb-b8e30b59d657" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012520Z:c2d503eb-1043-48d3-90bb-b8e30b59d657" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "6012" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"name\": \"Australia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Australia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Belgium\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Belgium\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Brazil\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Brazil\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Canada\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Canada\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Denmark\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Denmark\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Finland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Finland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"France\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/France\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Germany\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Germany\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Hong Kong\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Hong Kong\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Japan\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Japan\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Kenya\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Kenya\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Korea, South\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Korea, South\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Malaysia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Malaysia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Netherlands\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Netherlands\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"New Zealand\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/New Zealand\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Nigeria\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Nigeria\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Norway\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Norway\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Poland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Poland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Portugal\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Portugal\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Singapore\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Singapore\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"South Africa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/South Africa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Spain\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Spain\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Sweden\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Sweden\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"Switzerland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/Switzerland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"United Kingdom\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/United Kingdom\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n },\r\n {\r\n \"name\": \"United States\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceCountries/United States\",\r\n \"type\": \"Microsoft.Peering/peeringServiceCountries\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringServiceCountry.Tests.ps1 b/src/Peering/test/Get-AzPeeringServiceCountry.Tests.ps1 new file mode 100644 index 000000000000..a41dab03ae01 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringServiceCountry.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringServiceCountry')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringServiceCountry.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringServiceCountry' { + It 'List' { + { + $countries = Get-AzPeeringServiceCountry + $countries.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringServiceLocation.Recording.json b/src/Peering/test/Get-AzPeeringServiceLocation.Recording.json new file mode 100644 index 000000000000..b3794fe8ab04 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringServiceLocation.Recording.json @@ -0,0 +1,82 @@ +{ + "Get-AzPeeringServiceLocation+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "19" ], + "x-ms-client-request-id": [ "b071c41f-e1c2-43b2-9fee-f5f47e50e5b8" ], + "CommandName": [ "Get-AzPeeringServiceLocation" ], + "FullCommandName": [ "Get-AzPeeringServiceLocation_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "b0fbd3d4-6087-4ce4-858a-1099475ea0c6" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "599" ], + "x-ms-correlation-request-id": [ "7fb6064a-0141-43b0-89b0-9a4e5288d7e9" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012520Z:7fb6064a-0141-43b0-89b0-9a4e5288d7e9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "236407" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"country\": \"Australia\",\r\n \"state\": \"Australian Capital Territory\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Australian Capital Territory\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Australian Capital Territory\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Australia\",\r\n \"state\": \"New South Wales\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"New South Wales\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/New South Wales\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Australia\",\r\n \"state\": \"Queensland\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Queensland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Queensland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Australia\",\r\n \"state\": \"South Australia\",\r\n \"azureRegion\": \"Australia Southeast\"\r\n },\r\n \"name\": \"South Australia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/South Australia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Australia\",\r\n \"state\": \"Tasmania\",\r\n \"azureRegion\": \"Australia Southeast\"\r\n },\r\n \"name\": \"Tasmania\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tasmania\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Australia\",\r\n \"state\": \"Victoria\",\r\n \"azureRegion\": \"Australia Southeast\"\r\n },\r\n \"name\": \"Victoria\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Victoria\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Australia\",\r\n \"state\": \"Western Australia\",\r\n \"azureRegion\": \"Australia Central\"\r\n },\r\n \"name\": \"Western Australia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Western Australia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Belgium\",\r\n \"state\": \"Brussels-Capital Region\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Brussels-Capital Region\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Brussels-Capital Region\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Belgium\",\r\n \"state\": \"Flanders\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Flanders\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Flanders\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Belgium\",\r\n \"state\": \"Wallonia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Wallonia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wallonia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Brazil\",\r\n \"state\": \"Espirito Santo\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Espirito Santo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Espirito Santo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Brazil\",\r\n \"state\": \"Goias\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Goias\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Goias\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Brazil\",\r\n \"state\": \"Minas Gerais\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Minas Gerais\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Minas Gerais\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Brazil\",\r\n \"state\": \"Parana\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Parana\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Parana\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Brazil\",\r\n \"state\": \"Rio de Janeiro\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Rio de Janeiro\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Rio de Janeiro\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Brazil\",\r\n \"state\": \"Santa Catarina\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Santa Catarina\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Santa Catarina\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Brazil\",\r\n \"state\": \"Sao Paulo\",\r\n \"azureRegion\": \"Brazil South\"\r\n },\r\n \"name\": \"Sao Paulo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sao Paulo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Canada\",\r\n \"state\": \"Alberta\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Alberta\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Alberta\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Canada\",\r\n \"state\": \"British Columbia\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"British Columbia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/British Columbia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Canada\",\r\n \"state\": \"Manitoba\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Manitoba\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Manitoba\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Canada\",\r\n \"state\": \"New Brunswick\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"New Brunswick\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/New Brunswick\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Canada\",\r\n \"state\": \"Nova Scotia\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Nova Scotia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nova Scotia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Canada\",\r\n \"state\": \"Ontario\",\r\n \"azureRegion\": \"Canada Central\"\r\n },\r\n \"name\": \"Ontario\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ontario\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Canada\",\r\n \"state\": \"Prince Edward Island\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Prince Edward Island\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Prince Edward Island\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Canada\",\r\n \"state\": \"Quebec\",\r\n \"azureRegion\": \"Canada East\"\r\n },\r\n \"name\": \"Quebec\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Quebec\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Denmark\",\r\n \"state\": \"Hovedstaden\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Hovedstaden\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hovedstaden\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Denmark\",\r\n \"state\": \"Midtjylland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Midtjylland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Midtjylland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Denmark\",\r\n \"state\": \"Nordjylland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Nordjylland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nordjylland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Denmark\",\r\n \"state\": \"Sjaelland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Sjaelland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sjaelland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Denmark\",\r\n \"state\": \"Syddanmark\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Syddanmark\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Syddanmark\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Aland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Aland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Etela-Karjala\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Etela-Karjala\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Etela-Karjala\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Etela-Pohjanmaa\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Etela-Pohjanmaa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Etela-Pohjanmaa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Etela-Savo\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Etela-Savo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Etela-Savo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Kainuu\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Kainuu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kainuu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Kanta-Hame\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Kanta-Hame\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kanta-Hame\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Keski-Pohjanmaa\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Keski-Pohjanmaa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Keski-Pohjanmaa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Keski-Suomi\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Keski-Suomi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Keski-Suomi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Kymenlaakso\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Kymenlaakso\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kymenlaakso\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Lappi\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Lappi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lappi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Paijat-Hame\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Paijat-Hame\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Paijat-Hame\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Pirkanmaa\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Pirkanmaa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pirkanmaa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Pohjanmaa\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Pohjanmaa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pohjanmaa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Pohjois-Karjala\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Pohjois-Karjala\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pohjois-Karjala\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Pohjois-Pohjanmaa\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Pohjois-Pohjanmaa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pohjois-Pohjanmaa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Pohjois-Savo\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Pohjois-Savo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pohjois-Savo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Satakunta\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Satakunta\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Satakunta\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Uusimaa\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Uusimaa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Uusimaa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Finland\",\r\n \"state\": \"Varsinais-Suomi\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Varsinais-Suomi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Varsinais-Suomi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Auvergne-Rhone-Alpes\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Auvergne-Rhone-Alpes\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Auvergne-Rhone-Alpes\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Bourgogne-Franche-Comte\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Bourgogne-Franche-Comte\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bourgogne-Franche-Comte\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Bretagne\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Bretagne\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bretagne\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Centre-Val de Loire\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Centre-Val de Loire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Centre-Val de Loire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Corsica\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Corsica\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Corsica\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Grand Est\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Grand Est\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Grand Est\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Hauts-de-France\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Hauts-de-France\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hauts-de-France\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Ile-de-France\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Ile-de-France\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ile-de-France\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Normandie\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Normandie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Normandie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Nouvelle-Aquitaine\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nouvelle-Aquitaine\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nouvelle-Aquitaine\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Occitanie\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Occitanie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Occitanie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Pays de la Loire\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Pays de la Loire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pays de la Loire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"France\",\r\n \"state\": \"Provence-Alpes-Cote d’Azur\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Provence-Alpes-Cote d’Azur\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Provence-Alpes-Cote d’Azur\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Baden-Wurttemberg\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Baden-Wurttemberg\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Baden-Wurttemberg\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Bavaria\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Bavaria\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bavaria\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Berlin\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Berlin\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Berlin\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Brandenburg\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Brandenburg\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Brandenburg\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Bremen\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Bremen\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bremen\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Hamburg\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Hamburg\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hamburg\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Hesse\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Hesse\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hesse\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Lower Saxony\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Lower Saxony\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lower Saxony\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Mecklenburg-Western Pomerania\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Mecklenburg-Western Pomerania\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Mecklenburg-Western Pomerania\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"North Rhine-Westphalia\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"North Rhine-Westphalia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North Rhine-Westphalia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Rhineland-Palatinate\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Rhineland-Palatinate\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Rhineland-Palatinate\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Saarland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Saarland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Saarland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Saxony\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Saxony\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Saxony\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Saxony-Anhalt\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Saxony-Anhalt\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Saxony-Anhalt\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Schleswig-Holstein\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Schleswig-Holstein\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Schleswig-Holstein\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Germany\",\r\n \"state\": \"Thuringia\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Thuringia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Thuringia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Hong Kong\",\r\n \"state\": \"Hong Kong\",\r\n \"azureRegion\": \"East Asia\"\r\n },\r\n \"name\": \"Hong Kong\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hong Kong\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Aichi\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Aichi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aichi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Akita\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Akita\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Akita\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Aomori\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Aomori\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aomori\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Chiba\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Chiba\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Chiba\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Ehime\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Ehime\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ehime\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Fukui\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Fukui\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fukui\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Fukuoka\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Fukuoka\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fukuoka\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Fukushima\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Fukushima\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fukushima\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Gifu\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Gifu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gifu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Gunma\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Gunma\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gunma\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Hiroshima\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Hiroshima\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hiroshima\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Hyogo\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Hyogo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hyogo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Ibaraki\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Ibaraki\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ibaraki\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Ishikawa\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Ishikawa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ishikawa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Iwate\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Iwate\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Iwate\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kagawa\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kagawa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kagawa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kagoshima\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kagoshima\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kagoshima\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kanagawa\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Kanagawa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kanagawa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kochi\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kochi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kochi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kumamoto\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kumamoto\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kumamoto\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kyoto\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kyoto\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kyoto\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Mie\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Mie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Mie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Miyagi\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Miyagi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Miyagi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Miyazaki\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Miyazaki\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Miyazaki\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Nagano\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Nagano\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nagano\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Nagasaki\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Nagasaki\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nagasaki\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Nara\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Nara\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nara\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Niigata\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Niigata\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Niigata\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Oita\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Oita\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Oita\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Okayama\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Okayama\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Okayama\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Okinawa\",\r\n \"azureRegion\": \"East Asia\"\r\n },\r\n \"name\": \"Okinawa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Okinawa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Osaka\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Osaka\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Osaka\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Saga\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Saga\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Saga\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Saitama\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Saitama\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Saitama\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Shiga\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Shiga\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Shiga\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Shimane\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Shimane\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Shimane\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Shizuoka\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Shizuoka\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Shizuoka\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Tochigi\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Tochigi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tochigi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Tokushima\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Tokushima\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tokushima\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Tokyo\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Tokyo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tokyo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Tottori\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Tottori\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tottori\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Toyama\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Toyama\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Toyama\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Wakayama\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Wakayama\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wakayama\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Yamagata\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Yamagata\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Yamagata\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Yamaguchi\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Yamaguchi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Yamaguchi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Yamanashi\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Yamanashi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Yamanashi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Baringo\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Baringo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Baringo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Bomet\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Bomet\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bomet\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Bungoma\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Bungoma\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bungoma\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Busia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Busia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Busia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Elgeyo/Marakwet\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Elgeyo/Marakwet\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Elgeyo/Marakwet\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Embu\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Embu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Embu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Garissa\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Garissa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Garissa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Homa Bay\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Homa Bay\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Homa Bay\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Isiolo\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Isiolo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Isiolo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kajiado\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kajiado\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kajiado\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kakamega\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kakamega\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kakamega\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kericho\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kericho\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kericho\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kiambu\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kiambu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kiambu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kilifi\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kilifi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kilifi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kirinyaga\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kirinyaga\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kirinyaga\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kisii\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kisii\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kisii\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kisumu\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kisumu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kisumu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kitui\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kitui\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kitui\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Kwale\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kwale\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kwale\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Laikipia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Laikipia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Laikipia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Lamu\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Lamu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lamu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Machakos\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Machakos\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Machakos\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Makueni\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Makueni\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Makueni\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Marsabit\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Marsabit\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Marsabit\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Meru\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Meru\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Meru\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Migori\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Migori\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Migori\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Mombasa\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Mombasa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Mombasa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Murang’a\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Murang’a\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Murang’a\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Nairobi City\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nairobi City\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nairobi City\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Nakuru\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nakuru\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nakuru\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Namanga\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Namanga\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Namanga\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Nandi\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nandi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nandi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Narok\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Narok\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Narok\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Nyamira\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nyamira\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nyamira\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Nyandarua\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nyandarua\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nyandarua\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Nyeri\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nyeri\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nyeri\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Samburu\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Samburu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Samburu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Siaya\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Siaya\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Siaya\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Taita/Taveta\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Taita/Taveta\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Taita/Taveta\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Tana River\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Tana River\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tana River\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Tharaka-Nithi\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Tharaka-Nithi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tharaka-Nithi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Trans Nzoia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Trans Nzoia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Trans Nzoia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Turkana\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Turkana\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Turkana\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Uasin Gishu\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Uasin Gishu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Uasin Gishu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Vihiga\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Vihiga\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vihiga\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"Wajir\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Wajir\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wajir\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Kenya\",\r\n \"state\": \"West Pokot\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"West Pokot\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/West Pokot\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Busan\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Busan\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Busan\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Chungbuk\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Chungbuk\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Chungbuk\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Chungnam\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Chungnam\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Chungnam\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Daegu\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Daegu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Daegu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Daejeon\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Daejeon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Daejeon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Gangwon\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Gangwon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gangwon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Gwangju\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Gwangju\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gwangju\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Gyeongbuk\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Gyeongbuk\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gyeongbuk\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Gyeonggi\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Gyeonggi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gyeonggi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Gyeongnam\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Gyeongnam\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gyeongnam\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Incheon\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Incheon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Incheon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Jeju\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Jeju\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Jeju\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Jeonbuk\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Jeonbuk\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Jeonbuk\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Jeonnam\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Jeonnam\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Jeonnam\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Sejong\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Sejong\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sejong\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Seoul\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Seoul\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Seoul\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Korea, South\",\r\n \"state\": \"Ulsan\",\r\n \"azureRegion\": \"Korea Central\"\r\n },\r\n \"name\": \"Ulsan\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ulsan\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Johor\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Johor\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Johor\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Kedah\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Kedah\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kedah\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Kelantan\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Kelantan\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kelantan\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Kuala Lumpur \",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Kuala Lumpur \",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kuala Lumpur \",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Melaka\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Melaka\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Melaka\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Negeri Sembilan\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Negeri Sembilan\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Negeri Sembilan\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Pahang\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Pahang\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pahang\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Perak\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Perak\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Perak\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Perlis\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Perlis\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Perlis\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Pulau Pinang\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Pulau Pinang\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pulau Pinang\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Sarawak\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Sarawak\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sarawak\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Selangor\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Selangor\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Selangor\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Malaysia\",\r\n \"state\": \"Terengganu\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Terengganu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Terengganu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Drenthe\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Drenthe\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Drenthe\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Flevoland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Flevoland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Flevoland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Fryslan\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Fryslan\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fryslan\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Gelderland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Gelderland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gelderland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Groningen\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Groningen\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Groningen\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Limburg\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Limburg\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Limburg\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Noord-Brabant\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Noord-Brabant\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Noord-Brabant\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Noord-Holland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Noord-Holland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Noord-Holland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Overijssel\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Overijssel\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Overijssel\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Utrecht\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Utrecht\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Utrecht\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Zeeland\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Zeeland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Zeeland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Netherlands\",\r\n \"state\": \"Zuid-Holland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Zuid-Holland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Zuid-Holland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Auckland\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Auckland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Auckland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Bay of Plenty\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Bay of Plenty\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bay of Plenty\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Canterbury\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Canterbury\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Canterbury\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Gisborne\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Gisborne\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gisborne\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Hawke’s Bay\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Hawke’s Bay\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hawke’s Bay\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Manawatu-Wanganui\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Manawatu-Wanganui\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Manawatu-Wanganui\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Marlborough\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Marlborough\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Marlborough\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Nelson\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Nelson\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nelson\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Northland\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Northland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Northland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Taranaki\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Taranaki\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Taranaki\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Waikato\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Waikato\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Waikato\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"Wellington\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"Wellington\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wellington\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"New Zealand\",\r\n \"state\": \"West Coast\",\r\n \"azureRegion\": \"Australia East\"\r\n },\r\n \"name\": \"West Coast\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/West Coast\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Abia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Abia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Abia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Akwa Ibom\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Akwa Ibom\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Akwa Ibom\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Anambra\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Anambra\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Anambra\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Bayelsa\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Bayelsa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bayelsa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Benue\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Benue\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Benue\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Cross River\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Cross River\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Cross River\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Delta\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Delta\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Delta\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Ebonyi\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Ebonyi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ebonyi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Edo\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Edo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Edo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Ekiti\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Ekiti\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ekiti\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Enugu\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Enugu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Enugu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Federal Capital Territory\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Federal Capital Territory\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Federal Capital Territory\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Imo\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Imo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Imo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Kaduna\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kaduna\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kaduna\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Kebbi\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kebbi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kebbi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Kogi\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kogi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kogi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Kwara\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Kwara\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kwara\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Lagos\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Lagos\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lagos\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Nasarawa\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nasarawa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nasarawa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Niger\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Niger\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Niger\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Ogun\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Ogun\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ogun\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Ondo\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Ondo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ondo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Osun\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Osun\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Osun\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Oyo\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Oyo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Oyo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Plateau\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Plateau\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Plateau\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Rivers\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Rivers\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Rivers\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Sokoto\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Sokoto\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sokoto\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Nigeria\",\r\n \"state\": \"Zamfara\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Zamfara\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Zamfara\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Akershus\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Akershus\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Akershus\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Aust-Agder\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Aust-Agder\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aust-Agder\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Buskerud\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Buskerud\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Buskerud\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Hedmark\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Hedmark\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hedmark\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Hordaland\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Hordaland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hordaland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"More og Romsdal\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"More og Romsdal\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/More og Romsdal\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Oppland\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Oppland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Oppland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Oslo\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Oslo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Oslo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Ostfold\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Ostfold\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ostfold\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Rogaland\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Rogaland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Rogaland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Sogn og Fjordane\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Sogn og Fjordane\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sogn og Fjordane\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Telemark\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Telemark\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Telemark\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Vest-Agder\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Vest-Agder\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vest-Agder\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Norway\",\r\n \"state\": \"Vestfold\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Vestfold\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vestfold\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Dolnoslaskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Dolnoslaskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Dolnoslaskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Kujawsko-Pomorskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Kujawsko-Pomorskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kujawsko-Pomorskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Lodzkie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Lodzkie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lodzkie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Lubelskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Lubelskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lubelskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Lubuskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Lubuskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lubuskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Malopolskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Malopolskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Malopolskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Mazowieckie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Mazowieckie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Mazowieckie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Opolskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Opolskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Opolskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Podkarpackie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Podkarpackie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Podkarpackie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Podlaskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Podlaskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Podlaskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Pomorskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Pomorskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pomorskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Slaskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Slaskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Slaskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Swietokrzyskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Swietokrzyskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Swietokrzyskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Warminsko-Mazurskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Warminsko-Mazurskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Warminsko-Mazurskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Wielkopolskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Wielkopolskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wielkopolskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Poland\",\r\n \"state\": \"Zachodniopomorskie\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Zachodniopomorskie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Zachodniopomorskie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Aveiro\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Aveiro\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aveiro\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Beja\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Beja\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Beja\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Braga\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Braga\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Braga\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Braganca\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Braganca\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Braganca\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Castelo Branco\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Castelo Branco\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Castelo Branco\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Coimbra\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Coimbra\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Coimbra\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Evora\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Evora\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Evora\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Faro\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Faro\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Faro\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Guarda\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Guarda\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Guarda\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Leiria\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Leiria\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Leiria\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Lisboa\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Lisboa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lisboa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Portalegre\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Portalegre\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Portalegre\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Porto\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Porto\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Porto\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Santarem\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Santarem\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Santarem\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Setubal\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Setubal\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Setubal\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Viana do Castelo\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Viana do Castelo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Viana do Castelo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Vila Real\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Vila Real\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vila Real\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Portugal\",\r\n \"state\": \"Viseu\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Viseu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Viseu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Singapore\",\r\n \"state\": \"Singapore\",\r\n \"azureRegion\": \"Southeast Asia\"\r\n },\r\n \"name\": \"Singapore\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Singapore\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"South Africa\",\r\n \"state\": \"Eastern Cape\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"Eastern Cape\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Eastern Cape\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"South Africa\",\r\n \"state\": \"Free State\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"Free State\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Free State\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"South Africa\",\r\n \"state\": \"Gauteng\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"Gauteng\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gauteng\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"South Africa\",\r\n \"state\": \"KwaZulu-Natal\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"KwaZulu-Natal\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/KwaZulu-Natal\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"South Africa\",\r\n \"state\": \"Limpopo\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"Limpopo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Limpopo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"South Africa\",\r\n \"state\": \"Mpumalanga\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"Mpumalanga\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Mpumalanga\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"South Africa\",\r\n \"state\": \"North West\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"North West\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North West\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"South Africa\",\r\n \"state\": \"Northern Cape\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"Northern Cape\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Northern Cape\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"South Africa\",\r\n \"state\": \"Western Cape\",\r\n \"azureRegion\": \"South Africa North\"\r\n },\r\n \"name\": \"Western Cape\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Western Cape\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Andalusia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Andalusia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Andalusia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Aragon\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Aragon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aragon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Asturias\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Asturias\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Asturias\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Balearic Islands\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Balearic Islands\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Balearic Islands\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Basque Country\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Basque Country\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Basque Country\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Cantabria\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Cantabria\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Cantabria\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Castille-La Mancha\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Castille-La Mancha\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Castille-La Mancha\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Castille-Leon\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Castille-Leon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Castille-Leon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Catalonia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Catalonia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Catalonia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Ceuta\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Ceuta\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ceuta\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Extremadura\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Extremadura\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Extremadura\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Galicia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Galicia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Galicia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"La Rioja\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"La Rioja\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/La Rioja\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Madrid\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Madrid\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Madrid\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Melilla\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Melilla\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Melilla\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Murcia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Murcia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Murcia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Navarre\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Navarre\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Navarre\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Spain\",\r\n \"state\": \"Valencia\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Valencia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Valencia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Blekinge\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Blekinge\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Blekinge\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Dalarna\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Dalarna\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Dalarna\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Gavleborg\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Gavleborg\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gavleborg\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Gotland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Gotland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gotland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Halland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Halland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Halland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Jamtland\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Jamtland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Jamtland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Jonkoping\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Jonkoping\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Jonkoping\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Kalmar\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Kalmar\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kalmar\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Kronoberg\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Kronoberg\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kronoberg\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Norrbotten\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Norrbotten\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Norrbotten\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Orebro\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Orebro\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Orebro\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Ostergotland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Ostergotland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ostergotland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Skane\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Skane\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Skane\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Sodermanland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Sodermanland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sodermanland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Stockholm\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Stockholm\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Stockholm\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Uppsala\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Uppsala\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Uppsala\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Varmland\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Varmland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Varmland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Vasterbotten\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Vasterbotten\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vasterbotten\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Vasternorrland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Vasternorrland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vasternorrland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Vastmanland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Vastmanland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vastmanland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Sweden\",\r\n \"state\": \"Vastra Gotaland\",\r\n \"azureRegion\": \"West Europe\"\r\n },\r\n \"name\": \"Vastra Gotaland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vastra Gotaland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Aargau\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Aargau\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aargau\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Appenzell Ausserrhoden\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Appenzell Ausserrhoden\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Appenzell Ausserrhoden\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Appenzell Innerrhoden\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Appenzell Innerrhoden\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Appenzell Innerrhoden\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Basel-Landschaft\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Basel-Landschaft\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Basel-Landschaft\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Basel-Stadt\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Basel-Stadt\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Basel-Stadt\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Bern\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Bern\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bern\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Fribourg\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Fribourg\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fribourg\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Geneve\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Geneve\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Geneve\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Glarus\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Glarus\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Glarus\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Graubunden\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Graubunden\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Graubunden\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Jura\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Jura\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Jura\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Luzern\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Luzern\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Luzern\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Neuchatel\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Neuchatel\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Neuchatel\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Nidwalden\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Nidwalden\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nidwalden\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Obwalden\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Obwalden\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Obwalden\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Sankt Gallen\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Sankt Gallen\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sankt Gallen\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Schaffhausen\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Schaffhausen\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Schaffhausen\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Schwyz\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Schwyz\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Schwyz\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Solothurn\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Solothurn\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Solothurn\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Thurgau\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Thurgau\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Thurgau\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Ticino\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Ticino\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ticino\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Uri\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Uri\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Uri\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Valais\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Valais\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Valais\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Vaud\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Vaud\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vaud\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Zug\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Zug\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Zug\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Switzerland\",\r\n \"state\": \"Zurich\",\r\n \"azureRegion\": \"France Central\"\r\n },\r\n \"name\": \"Zurich\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Zurich\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Aberdeen City\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Aberdeen City\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aberdeen City\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Angus\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Angus\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Angus\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Antrim and Newtownabbey\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Antrim and Newtownabbey\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Antrim and Newtownabbey\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Ards and North Down\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Ards and North Down\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ards and North Down\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Argyll and Bute\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Argyll and Bute\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Argyll and Bute\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Armagh, Banbridge and Craigavon\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Armagh, Banbridge and Craigavon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Armagh, Banbridge and Craigavon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Barking and Dagenham\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Barking and Dagenham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Barking and Dagenham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Barnet\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Barnet\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Barnet\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Barnsley\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Barnsley\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Barnsley\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bath and North East Somerset\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Bath and North East Somerset\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bath and North East Somerset\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bedford\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Bedford\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bedford\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Belfast\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Belfast\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Belfast\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bexley\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Bexley\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bexley\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Birmingham\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Birmingham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Birmingham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Blackburn with Darwen\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Blackburn with Darwen\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Blackburn with Darwen\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Blackpool\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Blackpool\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Blackpool\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Blaenau Gwent\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Blaenau Gwent\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Blaenau Gwent\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bolton\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Bolton\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bolton\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bournemouth\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Bournemouth\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bournemouth\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bracknell Forest\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Bracknell Forest\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bracknell Forest\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bradford\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Bradford\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bradford\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Brent\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Brent\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Brent\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bridgend\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Bridgend\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bridgend\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Brighton and Hove\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Brighton and Hove\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Brighton and Hove\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bristol, City of\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Bristol, City of\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bristol, City of\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bromley\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Bromley\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bromley\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Buckinghamshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Buckinghamshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Buckinghamshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Bury\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Bury\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Bury\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Caerphilly\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Caerphilly\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Caerphilly\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Calderdale\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Calderdale\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Calderdale\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Cambridgeshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Cambridgeshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Cambridgeshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Camden\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Camden\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Camden\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Cardiff\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Cardiff\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Cardiff\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Carmarthenshire\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Carmarthenshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Carmarthenshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Causeway Coast and Glens\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Causeway Coast and Glens\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Causeway Coast and Glens\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Central Bedfordshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Central Bedfordshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Central Bedfordshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Ceredigion\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Ceredigion\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ceredigion\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Cheshire East\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Cheshire East\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Cheshire East\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Cheshire West and Chester\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Cheshire West and Chester\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Cheshire West and Chester\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Clackmannanshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Clackmannanshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Clackmannanshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Conwy\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Conwy\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Conwy\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Cornwall\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Cornwall\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Cornwall\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Coventry\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Coventry\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Coventry\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Croydon\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Croydon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Croydon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Cumbria\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Cumbria\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Cumbria\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Darlington\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Darlington\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Darlington\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Denbighshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Denbighshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Denbighshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Derby\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Derby\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Derby\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Derbyshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Derbyshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Derbyshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Derry and Strabane\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Derry and Strabane\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Derry and Strabane\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Devon\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Devon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Devon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Doncaster\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Doncaster\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Doncaster\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Dorset\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Dorset\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Dorset\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Dudley\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Dudley\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Dudley\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Dumfries and Galloway\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Dumfries and Galloway\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Dumfries and Galloway\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Dundee City\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Dundee City\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Dundee City\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Durham\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Durham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Durham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Ealing\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Ealing\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ealing\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"East Ayrshire\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"East Ayrshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/East Ayrshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"East Dunbartonshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"East Dunbartonshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/East Dunbartonshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"East Lothian\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"East Lothian\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/East Lothian\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"East Renfrewshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"East Renfrewshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/East Renfrewshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"East Riding of Yorkshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"East Riding of Yorkshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/East Riding of Yorkshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"East Sussex\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"East Sussex\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/East Sussex\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Edinburgh, City of\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Edinburgh, City of\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Edinburgh, City of\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Eilean Siar\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Eilean Siar\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Eilean Siar\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Enfield\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Enfield\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Enfield\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Essex\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Essex\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Essex\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Falkirk\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Falkirk\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Falkirk\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Fermanagh and Omagh\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Fermanagh and Omagh\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fermanagh and Omagh\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Fife\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Fife\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fife\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Flintshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Flintshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Flintshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Gateshead\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Gateshead\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gateshead\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Glasgow City\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Glasgow City\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Glasgow City\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Gloucestershire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Gloucestershire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gloucestershire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Greenwich\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Greenwich\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Greenwich\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Gwynedd\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Gwynedd\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gwynedd\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Hackney\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Hackney\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hackney\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Halton\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Halton\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Halton\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Hammersmith and Fulham\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Hammersmith and Fulham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hammersmith and Fulham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Hampshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Hampshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hampshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Haringey\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Haringey\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Haringey\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Harrow\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Harrow\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Harrow\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Hartlepool\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Hartlepool\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hartlepool\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Havering\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Havering\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Havering\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Herefordshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Herefordshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Herefordshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Hertfordshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Hertfordshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hertfordshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Highland\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Highland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Highland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Hillingdon\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Hillingdon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hillingdon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Hounslow\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Hounslow\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hounslow\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Inverclyde\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Inverclyde\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Inverclyde\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Isle of Anglesey\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Isle of Anglesey\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Isle of Anglesey\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Isle of Wight\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Isle of Wight\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Isle of Wight\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Isles of Scilly\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Isles of Scilly\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Isles of Scilly\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Islington\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Islington\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Islington\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Kensington and Chelsea\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Kensington and Chelsea\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kensington and Chelsea\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Kent\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Kent\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kent\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Kingston upon Hull, City of\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Kingston upon Hull, City of\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kingston upon Hull, City of\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Kingston upon Thames\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Kingston upon Thames\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kingston upon Thames\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Kirklees\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Kirklees\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kirklees\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Knowsley\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Knowsley\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Knowsley\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Lambeth\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Lambeth\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lambeth\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Lancashire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Lancashire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lancashire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Leeds\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Leeds\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Leeds\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Leicester\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Leicester\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Leicester\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Lewisham\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Lewisham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lewisham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Lincolnshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Lincolnshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lincolnshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Lisburn and Castlereagh\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Lisburn and Castlereagh\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Lisburn and Castlereagh\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Liverpool\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Liverpool\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Liverpool\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"London\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"London\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/London\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Luton\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Luton\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Luton\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Manchester\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Manchester\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Manchester\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Medway\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Medway\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Medway\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Merthyr Tydfil\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Merthyr Tydfil\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Merthyr Tydfil\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Merton\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Merton\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Merton\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Mid Ulster\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Mid Ulster\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Mid Ulster\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Mid and East Antrim\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Mid and East Antrim\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Mid and East Antrim\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Midlothian\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Midlothian\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Midlothian\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Milton Keynes\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Milton Keynes\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Milton Keynes\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Monmouthshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Monmouthshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Monmouthshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Moray\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Moray\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Moray\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Neath Port Talbot\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Neath Port Talbot\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Neath Port Talbot\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Newcastle upon Tyne\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Newcastle upon Tyne\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Newcastle upon Tyne\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Newham\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Newham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Newham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Newport\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Newport\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Newport\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Newry, Mourne and Down\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Newry, Mourne and Down\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Newry, Mourne and Down\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Norfolk\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Norfolk\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Norfolk\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"North Ayrshire\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"North Ayrshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North Ayrshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"North East Lincolnshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"North East Lincolnshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North East Lincolnshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"North Lanarkshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"North Lanarkshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North Lanarkshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"North Lincolnshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"North Lincolnshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North Lincolnshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"North Somerset\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"North Somerset\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North Somerset\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"North Tyneside\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"North Tyneside\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North Tyneside\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"North Yorkshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"North Yorkshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North Yorkshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Northamptonshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Northamptonshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Northamptonshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Northumberland\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Northumberland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Northumberland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Nottingham\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Nottingham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nottingham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Oldham\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Oldham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Oldham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Orkney Islands\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Orkney Islands\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Orkney Islands\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Oxfordshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Oxfordshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Oxfordshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Pembrokeshire\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Pembrokeshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pembrokeshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Perth and Kinross\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Perth and Kinross\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Perth and Kinross\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Peterborough\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Peterborough\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Peterborough\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Plymouth\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Plymouth\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Plymouth\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Poole\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Poole\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Poole\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Portsmouth\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Portsmouth\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Portsmouth\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Powys\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Powys\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Powys\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Reading\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Reading\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Reading\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Redbridge\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Redbridge\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Redbridge\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Redcar and Cleveland\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Redcar and Cleveland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Redcar and Cleveland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Renfrewshire\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"Renfrewshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Renfrewshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Rhondda Cynon Taff\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Rhondda Cynon Taff\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Rhondda Cynon Taff\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Richmond upon Thames\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Richmond upon Thames\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Richmond upon Thames\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Rochdale\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Rochdale\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Rochdale\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Rotherham\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Rotherham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Rotherham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Rutland\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Rutland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Rutland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Salford\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Salford\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Salford\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Sandwell\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Sandwell\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sandwell\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Scottish Borders, The\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Scottish Borders, The\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Scottish Borders, The\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Sefton\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Sefton\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sefton\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Sheffield\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Sheffield\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sheffield\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Shetland Islands\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Shetland Islands\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Shetland Islands\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Shropshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Shropshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Shropshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Slough\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Slough\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Slough\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Solihull\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Solihull\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Solihull\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Somerset\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Somerset\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Somerset\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"South Ayrshire\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"South Ayrshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/South Ayrshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"South Gloucestershire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"South Gloucestershire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/South Gloucestershire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"South Lanarkshire\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"South Lanarkshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/South Lanarkshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"South Tyneside\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"South Tyneside\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/South Tyneside\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Southampton\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Southampton\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Southampton\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Southend-on-Sea\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Southend-on-Sea\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Southend-on-Sea\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Southwark\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Southwark\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Southwark\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"St. Helens\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"St. Helens\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/St. Helens\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Stirling\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Stirling\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Stirling\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Stockport\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Stockport\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Stockport\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Stockton-on-Tees\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Stockton-on-Tees\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Stockton-on-Tees\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Stoke-on-Trent\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Stoke-on-Trent\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Stoke-on-Trent\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Suffolk\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Suffolk\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Suffolk\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Sunderland\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Sunderland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sunderland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Sutton\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Sutton\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Sutton\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Swansea\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Swansea\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Swansea\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Swindon\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Swindon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Swindon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Tameside\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Tameside\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tameside\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Telford and Wrekin\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Telford and Wrekin\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Telford and Wrekin\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Thurrock\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Thurrock\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Thurrock\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Torbay\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Torbay\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Torbay\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Torfaen\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Torfaen\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Torfaen\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Tower Hamlets\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Tower Hamlets\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tower Hamlets\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Trafford\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Trafford\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Trafford\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Vale of Glamorgan, The\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Vale of Glamorgan, The\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vale of Glamorgan, The\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Wakefield\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Wakefield\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wakefield\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Walsall\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Walsall\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Walsall\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Waltham Forest\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Waltham Forest\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Waltham Forest\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Wandsworth\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Wandsworth\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wandsworth\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Warrington\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Warrington\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Warrington\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Warwickshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Warwickshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Warwickshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"West Berkshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"West Berkshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/West Berkshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"West Dunbartonshire\",\r\n \"azureRegion\": \"North Europe\"\r\n },\r\n \"name\": \"West Dunbartonshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/West Dunbartonshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"West Lothian\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"West Lothian\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/West Lothian\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"West Sussex\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"West Sussex\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/West Sussex\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Westminster\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Westminster\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Westminster\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Wigan\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Wigan\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wigan\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Wiltshire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Wiltshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wiltshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Windsor and Maidenhead\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Windsor and Maidenhead\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Windsor and Maidenhead\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Wirral\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Wirral\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wirral\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Wokingham\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Wokingham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wokingham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Wolverhampton\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Wolverhampton\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wolverhampton\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Worcestershire\",\r\n \"azureRegion\": \"UK South\"\r\n },\r\n \"name\": \"Worcestershire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Worcestershire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"Wrexham\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"Wrexham\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wrexham\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United Kingdom\",\r\n \"state\": \"York\",\r\n \"azureRegion\": \"UK West\"\r\n },\r\n \"name\": \"York\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/York\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Alabama\",\r\n \"azureRegion\": \"East US 2\"\r\n },\r\n \"name\": \"Alabama\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Alabama\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Arizona\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"Arizona\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Arizona\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Arkansas\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Arkansas\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Arkansas\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"California\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"California\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/California\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Colorado\",\r\n \"azureRegion\": \"West Central US\"\r\n },\r\n \"name\": \"Colorado\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Colorado\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Connecticut\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Connecticut\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Connecticut\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Delaware\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Delaware\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Delaware\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"District of Columbia\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"District of Columbia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/District of Columbia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Florida\",\r\n \"azureRegion\": \"East US 2\"\r\n },\r\n \"name\": \"Florida\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Florida\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Georgia\",\r\n \"azureRegion\": \"East US 2\"\r\n },\r\n \"name\": \"Georgia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Georgia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Hawaii\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"Hawaii\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hawaii\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Idaho\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Idaho\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Idaho\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Illinois\",\r\n \"azureRegion\": \"North Central US\"\r\n },\r\n \"name\": \"Illinois\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Illinois\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Indiana\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Indiana\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Indiana\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Iowa\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Iowa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Iowa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Kansas\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Kansas\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kansas\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Kentucky\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Kentucky\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kentucky\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Louisiana\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Louisiana\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Louisiana\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Maine\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Maine\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Maine\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Maryland\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Maryland\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Maryland\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Massachusetts\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Massachusetts\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Massachusetts\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Michigan\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Michigan\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Michigan\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Minnesota\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Minnesota\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Minnesota\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Mississippi\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Mississippi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Mississippi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Missouri\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Missouri\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Missouri\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Montana\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Montana\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Montana\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Nebraska\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Nebraska\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nebraska\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Nevada\",\r\n \"azureRegion\": \"West US\"\r\n },\r\n \"name\": \"Nevada\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nevada\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"New Hampshire\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"New Hampshire\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/New Hampshire\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"New Jersey\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"New Jersey\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/New Jersey\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"New Mexico\",\r\n \"azureRegion\": \"West Central US\"\r\n },\r\n \"name\": \"New Mexico\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/New Mexico\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"New York\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"New York\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/New York\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"North Carolina\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"North Carolina\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North Carolina\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"North Dakota\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"North Dakota\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/North Dakota\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Ohio\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Ohio\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ohio\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Oklahoma\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Oklahoma\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Oklahoma\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Oregon\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Oregon\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Oregon\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Pennsylvania\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Pennsylvania\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Pennsylvania\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Rhode Island\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Rhode Island\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Rhode Island\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"South Carolina\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"South Carolina\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/South Carolina\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"South Dakota\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"South Dakota\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/South Dakota\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Tennessee\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Tennessee\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tennessee\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Texas\",\r\n \"azureRegion\": \"South Central US\"\r\n },\r\n \"name\": \"Texas\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Texas\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Utah\",\r\n \"azureRegion\": \"West Central US\"\r\n },\r\n \"name\": \"Utah\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Utah\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Vermont\",\r\n \"azureRegion\": \"Canada East\"\r\n },\r\n \"name\": \"Vermont\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Vermont\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Virginia\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"Virginia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Virginia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Washington\",\r\n \"azureRegion\": \"West US 2\"\r\n },\r\n \"name\": \"Washington\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Washington\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"West Virginia\",\r\n \"azureRegion\": \"East US\"\r\n },\r\n \"name\": \"West Virginia\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/West Virginia\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Wisconsin\",\r\n \"azureRegion\": \"North Central US\"\r\n },\r\n \"name\": \"Wisconsin\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wisconsin\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"United States\",\r\n \"state\": \"Wyoming\",\r\n \"azureRegion\": \"West Central US\"\r\n },\r\n \"name\": \"Wyoming\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wyoming\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + }, + "Get-AzPeeringServiceLocation+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations?country=Japan\u0026api-version=2022-10-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations?country=Japan\u0026api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "20" ], + "x-ms-client-request-id": [ "b0a8d420-0210-48f2-8772-28b6bb7b6185" ], + "CommandName": [ "Get-AzPeeringServiceLocation" ], + "FullCommandName": [ "Get-AzPeeringServiceLocation_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "feaec6cd-61e2-450a-8a84-4f9f5c9d3626" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "598" ], + "x-ms-correlation-request-id": [ "f11249dc-6f41-4650-9ef5-dce9be0cc435" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012520Z:f11249dc-6f41-4650-9ef5-dce9be0cc435" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "16316" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Aichi\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Aichi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aichi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Akita\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Akita\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Akita\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Aomori\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Aomori\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Aomori\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Chiba\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Chiba\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Chiba\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Ehime\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Ehime\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ehime\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Fukui\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Fukui\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fukui\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Fukuoka\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Fukuoka\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fukuoka\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Fukushima\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Fukushima\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Fukushima\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Gifu\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Gifu\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gifu\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Gunma\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Gunma\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Gunma\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Hiroshima\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Hiroshima\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hiroshima\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Hyogo\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Hyogo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Hyogo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Ibaraki\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Ibaraki\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ibaraki\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Ishikawa\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Ishikawa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Ishikawa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Iwate\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Iwate\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Iwate\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kagawa\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kagawa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kagawa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kagoshima\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kagoshima\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kagoshima\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kanagawa\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Kanagawa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kanagawa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kochi\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kochi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kochi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kumamoto\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kumamoto\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kumamoto\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Kyoto\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Kyoto\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Kyoto\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Mie\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Mie\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Mie\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Miyagi\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Miyagi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Miyagi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Miyazaki\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Miyazaki\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Miyazaki\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Nagano\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Nagano\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nagano\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Nagasaki\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Nagasaki\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nagasaki\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Nara\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Nara\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Nara\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Niigata\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Niigata\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Niigata\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Oita\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Oita\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Oita\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Okayama\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Okayama\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Okayama\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Okinawa\",\r\n \"azureRegion\": \"East Asia\"\r\n },\r\n \"name\": \"Okinawa\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Okinawa\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Osaka\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Osaka\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Osaka\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Saga\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Saga\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Saga\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Saitama\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Saitama\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Saitama\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Shiga\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Shiga\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Shiga\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Shimane\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Shimane\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Shimane\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Shizuoka\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Shizuoka\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Shizuoka\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Tochigi\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Tochigi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tochigi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Tokushima\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Tokushima\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tokushima\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Tokyo\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Tokyo\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tokyo\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Tottori\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Tottori\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Tottori\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Toyama\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Toyama\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Toyama\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Wakayama\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Wakayama\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Wakayama\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Yamagata\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Yamagata\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Yamagata\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Yamaguchi\",\r\n \"azureRegion\": \"Japan West\"\r\n },\r\n \"name\": \"Yamaguchi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Yamaguchi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n },\r\n {\r\n \"properties\": {\r\n \"country\": \"Japan\",\r\n \"state\": \"Yamanashi\",\r\n \"azureRegion\": \"Japan East\"\r\n },\r\n \"name\": \"Yamanashi\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceLocations/Yamanashi\",\r\n \"type\": \"Microsoft.Peering/peeringServiceLocations\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringServiceLocation.Tests.ps1 b/src/Peering/test/Get-AzPeeringServiceLocation.Tests.ps1 new file mode 100644 index 000000000000..3ce83dab0a78 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringServiceLocation.Tests.ps1 @@ -0,0 +1,27 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringServiceLocation')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringServiceLocation.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringServiceLocation' { + It 'List' { + { + $locations = Get-AzPeeringServiceLocation + $locations.Count | Should -BeGreaterThan 0 + + $jpLocations = Get-AzPeeringServiceLocation -Country Japan + $jpLocations.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringServicePrefix.Recording.json b/src/Peering/test/Get-AzPeeringServicePrefix.Recording.json new file mode 100644 index 000000000000..07ffa2fc7224 --- /dev/null +++ b/src/Peering/test/Get-AzPeeringServicePrefix.Recording.json @@ -0,0 +1,82 @@ +{ + "Get-AzPeeringServicePrefix+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestDRInterCloudZurich/prefixes?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestDRInterCloudZurich/prefixes?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "21" ], + "x-ms-client-request-id": [ "bffb4689-41d8-419e-bb55-647db2a4c9db" ], + "CommandName": [ "Get-AzPeeringServicePrefix" ], + "FullCommandName": [ "Get-AzPeeringServicePrefix_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "e30aadc3-8485-4fe0-a6b7-998d22823d73" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "x-ms-correlation-request-id": [ "adce3b33-cfd5-4d98-b790-d7e1385f9397" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012521Z:adce3b33-cfd5-4d98-b790-d7e1385f9397" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1150" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"prefix\": \"91.194.255.0/24\",\r\n \"prefixValidationState\": \"Failed\",\r\n \"learnedType\": \"None\",\r\n \"errorMessage\": \"Peering service provider not found\",\r\n \"peeringServicePrefixKey\": \"6a7f0d42-e49c-4eea-a930-280610671c3f\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"TestPrefix\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestDRInterCloudZurich/prefixes/TestPrefix\",\r\n \"type\": \"Microsoft.Peering/peeringServices/prefixes\"\r\n },\r\n {\r\n \"properties\": {\r\n \"prefix\": \"240.0.0.0/24\",\r\n \"prefixValidationState\": \"Pending\",\r\n \"learnedType\": \"None\",\r\n \"errorMessage\": \"Deletion in progress\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"TestPrefix2\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestDRInterCloudZurich/prefixes/TestPrefix2\",\r\n \"type\": \"Microsoft.Peering/peeringServices/prefixes\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + }, + "Get-AzPeeringServicePrefix+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestDRInterCloudZurich/prefixes/TestPrefix?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestDRInterCloudZurich/prefixes/TestPrefix?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "22" ], + "x-ms-client-request-id": [ "fa81dc9e-2209-4725-896b-564c59a9251c" ], + "CommandName": [ "Get-AzPeeringServicePrefix" ], + "FullCommandName": [ "Get-AzPeeringServicePrefix_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "d7534262-746a-4cc4-a4cb-c2d23cd5ae35" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "x-ms-correlation-request-id": [ "f4d04cad-ace2-406f-b4cb-f60df2ec8ee8" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012521Z:f4d04cad-ace2-406f-b4cb-f60df2ec8ee8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "554" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"prefix\": \"91.194.255.0/24\",\r\n \"prefixValidationState\": \"Failed\",\r\n \"learnedType\": \"None\",\r\n \"errorMessage\": \"Peering service provider not found\",\r\n \"peeringServicePrefixKey\": \"6a7f0d42-e49c-4eea-a930-280610671c3f\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"TestPrefix\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestDRInterCloudZurich/prefixes/TestPrefix\",\r\n \"type\": \"Microsoft.Peering/peeringServices/prefixes\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringServicePrefix.Tests.ps1 b/src/Peering/test/Get-AzPeeringServicePrefix.Tests.ps1 new file mode 100644 index 000000000000..3ebfb527835d --- /dev/null +++ b/src/Peering/test/Get-AzPeeringServicePrefix.Tests.ps1 @@ -0,0 +1,31 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringServicePrefix')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringServicePrefix.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringServicePrefix' { + It 'List' { + { + $prefixes = Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG + $prefixes.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $prefix = Get-AzPeeringServicePrefix -PeeringServiceName TestDRInterCloudZurich -ResourceGroupName DemoRG -Name TestPrefix + $prefix.Name | Should -Be "TestPrefix" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Get-AzPeeringServiceProvider.Recording.json b/src/Peering/test/Get-AzPeeringServiceProvider.Recording.json new file mode 100644 index 000000000000..9305755c2c8b --- /dev/null +++ b/src/Peering/test/Get-AzPeeringServiceProvider.Recording.json @@ -0,0 +1,42 @@ +{ + "Get-AzPeeringServiceProvider+[NoContext]+List+$GET+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceProviders?api-version=2022-10-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peeringServiceProviders?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "23" ], + "x-ms-client-request-id": [ "4c829506-bb3e-4b54-9252-1d08ceb5a070" ], + "CommandName": [ "Get-AzPeeringServiceProvider" ], + "FullCommandName": [ "Get-AzPeeringServiceProvider_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "f00cfc43-2708-4888-8641-1360ec8f6b0a" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "599" ], + "x-ms-correlation-request-id": [ "7d987eff-e00f-43f0-8e3e-9d5c183f0dc0" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012522Z:7d987eff-e00f-43f0-8e3e-9d5c183f0dc0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "10458" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"IIJ\",\r\n \"peeringLocations\": [\r\n \"Osaka\",\r\n \"Tokyo\"\r\n ]\r\n },\r\n \"name\": \"IIJ\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"BBIX\",\r\n \"peeringLocations\": [\r\n \"Tokyo\",\r\n \"Osaka\"\r\n ]\r\n },\r\n \"name\": \"BBIX\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"NTTCom\",\r\n \"peeringLocations\": [\r\n \"Osaka\",\r\n \"Tokyo\"\r\n ]\r\n },\r\n \"name\": \"NTTCom\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Kordia Limited\",\r\n \"peeringLocations\": [\r\n \"Auckland\",\r\n \"Sydney\"\r\n ]\r\n },\r\n \"name\": \"Kordia Limited\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Liquid Telecommunications Ltd\",\r\n \"peeringLocations\": [\r\n \"Cape Town\",\r\n \"Johannesburg\",\r\n \"Nairobi\"\r\n ]\r\n },\r\n \"name\": \"Liquid Telecommunications Ltd\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"InterCloud\",\r\n \"peeringLocations\": [\r\n \"london\",\r\n \"Paris\",\r\n \"Zurich\",\r\n \"Geneva\"\r\n ]\r\n },\r\n \"name\": \"InterCloud\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Computer Concepts Limited\",\r\n \"peeringLocations\": [\r\n \"Auckland\"\r\n ]\r\n },\r\n \"name\": \"Computer Concepts Limited\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Singnet\",\r\n \"peeringLocations\": [\r\n \"singapore\"\r\n ]\r\n },\r\n \"name\": \"Singnet\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"NTT Communications - Flexible InterConnect\",\r\n \"peeringLocations\": [\r\n \"Osaka\",\r\n \"Tokyo\"\r\n ]\r\n },\r\n \"name\": \"NTT Communications - Flexible InterConnect\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"NAPAfrica\",\r\n \"peeringLocations\": [\r\n \"Johannesburg\",\r\n \"Cape Town\"\r\n ]\r\n },\r\n \"name\": \"NAPAfrica\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Vocusgroup NZ\",\r\n \"peeringLocations\": [\r\n \"Sydney\",\r\n \"Auckland\"\r\n ]\r\n },\r\n \"name\": \"Vocusgroup NZ\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"CMC NETWORKS\",\r\n \"peeringLocations\": [\r\n \"Johannesburg\",\r\n \"Nairobi\",\r\n \"cape Town\"\r\n ]\r\n },\r\n \"name\": \"CMC NETWORKS\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"MainOne\",\r\n \"peeringLocations\": [\r\n \"Lisbon\",\r\n \"Lagos\"\r\n ]\r\n },\r\n \"name\": \"MainOne\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Swisscom Switzerland Ltd\",\r\n \"peeringLocations\": [\r\n \"Geneva\",\r\n \"Zurich\"\r\n ]\r\n },\r\n \"name\": \"Swisscom Switzerland Ltd\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"DE-CIX\",\r\n \"peeringLocations\": [\r\n \"Frankfurt\",\r\n \"Marseille\",\r\n \"Newark\",\r\n \"Madrid\",\r\n \"mumbai\"\r\n ]\r\n },\r\n \"name\": \"DE-CIX\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Lumen Technologies\",\r\n \"peeringLocations\": [\r\n \"denver\",\r\n \"los Angeles\"\r\n ]\r\n },\r\n \"name\": \"Lumen Technologies\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Colt Technology Services\",\r\n \"peeringLocations\": [\r\n \"Amsterdam\",\r\n \"Barcelona\",\r\n \"Berlin\",\r\n \"Frankfurt\",\r\n \"Hong Kong\",\r\n \"London\",\r\n \"Madrid\",\r\n \"Milan\",\r\n \"Paris\",\r\n \"Singapore\",\r\n \"Tokyo\",\r\n \"Zurich\",\r\n \"osaka\"\r\n ]\r\n },\r\n \"name\": \"Colt Technology Services\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"BICS\",\r\n \"peeringLocations\": [\r\n \"Brussels\",\r\n \"Frankfurt\",\r\n \"Paris\",\r\n \"Marseille\",\r\n \"Singapore\",\r\n \"Tokyo\"\r\n ]\r\n },\r\n \"name\": \"BICS\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Atman\",\r\n \"peeringLocations\": [\r\n \"Warsaw\"\r\n ]\r\n },\r\n \"name\": \"Atman\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"ATT\",\r\n \"peeringLocations\": [\r\n \"Dallas\"\r\n ]\r\n },\r\n \"name\": \"ATT\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Vodafone Global Network AS1273\",\r\n \"peeringLocations\": [\r\n \"Amsterdam\",\r\n \"Ashburn\",\r\n \"Barcelona\",\r\n \"Brussels\",\r\n \"Bucharest\",\r\n \"Budapest\",\r\n \"Dublin\",\r\n \"Frankfurt\",\r\n \"London\",\r\n \"Madrid\",\r\n \"Marseille\",\r\n \"Milan\",\r\n \"Paris\",\r\n \"Prague\",\r\n \"Singapore\",\r\n \"Sofia\",\r\n \"Vienna\",\r\n \"Miami\"\r\n ]\r\n },\r\n \"name\": \"Vodafone Global Network AS1273\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Dimension Data\",\r\n \"peeringLocations\": [\r\n \"Johannesburg\",\r\n \"Cape Town\"\r\n ]\r\n },\r\n \"name\": \"Dimension Data\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"Vodacom\",\r\n \"peeringLocations\": [\r\n \"Johannesburg\",\r\n \"Cape Town\"\r\n ]\r\n },\r\n \"name\": \"Vodacom\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"LINX LON1 MAPS\",\r\n \"peeringLocations\": [\r\n \"London\"\r\n ]\r\n },\r\n \"name\": \"LINX LON1 MAPS\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"advanced Wireless Network Co Ltd IIG\",\r\n \"peeringLocations\": [\r\n \"singapore\"\r\n ]\r\n },\r\n \"name\": \"advanced Wireless Network Co Ltd IIG\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"equinix MAPS\",\r\n \"peeringLocations\": [\r\n \"ashburn\",\r\n \"dallas\",\r\n \"atlanta\",\r\n \"seattle\",\r\n \"chicago\",\r\n \"san Jose\"\r\n ]\r\n },\r\n \"name\": \"equinix MAPS\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"bt\",\r\n \"peeringLocations\": [\r\n \"amsterdam\"\r\n ]\r\n },\r\n \"name\": \"bt\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"decixDxbRouteServerAsn\",\r\n \"peeringLocations\": [\r\n \"dubai\"\r\n ]\r\n },\r\n \"name\": \"decixDxbRouteServerAsn\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"cello Communications\",\r\n \"peeringLocations\": [\r\n \"auckland\"\r\n ]\r\n },\r\n \"name\": \"cello Communications\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"sejongtelecom Inc.\",\r\n \"peeringLocations\": [\r\n \"seoul\"\r\n ]\r\n },\r\n \"name\": \"sejongtelecom Inc.\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"vodafone Asia AS6660\",\r\n \"peeringLocations\": [\r\n \"Hong Kong\"\r\n ]\r\n },\r\n \"name\": \"vodafone Asia AS6660\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"singapore Telecommunications Limited\",\r\n \"peeringLocations\": [\r\n \"hong Kong\"\r\n ]\r\n },\r\n \"name\": \"singapore Telecommunications Limited\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"deciX-DFW-CUG-MAPS-AS\",\r\n \"peeringLocations\": [\r\n \"dallas\"\r\n ]\r\n },\r\n \"name\": \"deciX-DFW-CUG-MAPS-AS\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"sonic.net Inc.\",\r\n \"peeringLocations\": [\r\n \"san Jose\",\r\n \"palo Alto\"\r\n ]\r\n },\r\n \"name\": \"sonic.net Inc.\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n },\r\n {\r\n \"properties\": {\r\n \"serviceProviderName\": \"advanced Wireless Network Co Ltd Enterprise\",\r\n \"peeringLocations\": [\r\n \"pathum Thani\"\r\n ]\r\n },\r\n \"name\": \"advanced Wireless Network Co Ltd Enterprise\",\r\n \"type\": \"Microsoft.Peering/peeringServiceProviders\"\r\n }\r\n ]\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Get-AzPeeringServiceProvider.Tests.ps1 b/src/Peering/test/Get-AzPeeringServiceProvider.Tests.ps1 new file mode 100644 index 000000000000..2d558b2c45ed --- /dev/null +++ b/src/Peering/test/Get-AzPeeringServiceProvider.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzPeeringServiceProvider')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzPeeringServiceProvider.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzPeeringServiceProvider' { + It 'List' { + { + $providers = Get-AzPeeringServiceProvider + $providers.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Initialize-AzPeeringServiceConnectionMonitor.Tests.ps1 b/src/Peering/test/Initialize-AzPeeringServiceConnectionMonitor.Tests.ps1 new file mode 100644 index 000000000000..d3722f70004e --- /dev/null +++ b/src/Peering/test/Initialize-AzPeeringServiceConnectionMonitor.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Initialize-AzPeeringServiceConnectionMonitor')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Initialize-AzPeeringServiceConnectionMonitor.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Initialize-AzPeeringServiceConnectionMonitor' { + It 'Initialize' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'InitializeViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeering.Recording.json b/src/Peering/test/New-AzPeering.Recording.json new file mode 100644 index 000000000000..23fc5dbdd453 --- /dev/null +++ b/src/Peering/test/New-AzPeering.Recording.json @@ -0,0 +1,37 @@ +{ + "New-AzPeering+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/TestPeeringPs?api-version=2022-10-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/TestPeeringPs?api-version=2022-10-01", + "Content": "{\n \"sku\": {\n \"name\": \"Premium_Direct_Unlimited\"\n },\n \"properties\": {\n \"direct\": {\n \"peerAsn\": {\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"\n },\n \"connections\": [\n {\n \"bgpSession\": {\n \"sessionPrefixV4\": \"12.90.152.60/30\",\n \"microsoftSessionIPv4Address\": \"12.90.152.62\",\n \"peerSessionIPv4Address\": \"12.90.152.61\",\n \"maxPrefixesAdvertisedV4\": 20000,\n \"maxPrefixesAdvertisedV6\": 0,\n \"md5AuthenticationKey\": \"\"\n },\n \"bandwidthInMbps\": 10000,\n \"sessionAddressProvider\": \"Peer\",\n \"peeringDBFacilityId\": 86,\n \"connectionIdentifier\": \"d1111111111111111111111111111111\"\n }\n ],\n \"directPeeringType\": \"Cdn\"\n },\n \"peeringLocation\": \"Seattle\"\n },\n \"kind\": \"Direct\",\n \"location\": \"West US 2\"\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "932" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "d3ddd2b1-bd1b-4be3-8aff-14b6a50cce85" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-correlation-request-id": [ "8fbf0904-b6af-46a4-853e-bcacca2e3be8" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T014927Z:8fbf0904-b6af-46a4-853e-bcacca2e3be8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:49:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1575" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"sku\": {\r\n \"name\": \"Premium_Direct_Unlimited\",\r\n \"tier\": \"Premium\",\r\n \"family\": \"Direct\",\r\n \"size\": \"Unlimited\"\r\n },\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"connections\": [\r\n {\r\n \"billableBandwidthInMbps\": 0,\r\n \"bandwidthInMbps\": 10000,\r\n \"provisionedBandwidthInMbps\": 0,\r\n \"sessionAddressProvider\": \"Peer\",\r\n \"useForPeeringService\": false,\r\n \"peeringDBFacilityId\": 86,\r\n \"connectionState\": \"PendingApproval\",\r\n \"bgpSession\": {\r\n \"sessionPrefixV4\": \"12.90.152.60/30\",\r\n \"microsoftSessionIPv4Address\": \"12.90.152.62\",\r\n \"peerSessionIPv4Address\": \"12.90.152.61\",\r\n \"sessionStateV4\": \"None\",\r\n \"sessionStateV6\": \"None\",\r\n \"maxPrefixesAdvertisedV4\": 20000,\r\n \"maxPrefixesAdvertisedV6\": 0,\r\n \"md5AuthenticationKey\": \"\"\r\n },\r\n \"connectionIdentifier\": \"d1111111111111111111111111111111\"\r\n }\r\n ],\r\n \"useForPeeringService\": false,\r\n \"peerAsn\": {\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest\"\r\n },\r\n \"directPeeringType\": \"Cdn\"\r\n },\r\n \"peeringLocation\": \"Seattle\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"West US 2\",\r\n \"name\": \"TestPeeringPs\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/TestPeeringPs\",\r\n \"type\": \"Microsoft.Peering/peerings\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/New-AzPeering.Tests.ps1 b/src/Peering/test/New-AzPeering.Tests.ps1 new file mode 100644 index 000000000000..02eb6a759343 --- /dev/null +++ b/src/Peering/test/New-AzPeering.Tests.ps1 @@ -0,0 +1,27 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeering')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeering.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeering' { + It 'CreateExpanded' { + { + $peerAsnId = "/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/ContosoEdgeTest" + $connection = New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 12.90.152.62 -BgpSessionPeerSessionIPv4Address 12.90.152.61 -BgpSessionPrefixV4 12.90.152.60/30 -PeeringDbFacilityId 86 -SessionAddressProvider Peer -ConnectionIdentifier d1111111111111111111111111111111 + $directConnections = ,$connection + $peering = New-AzPeering -Name TestPeeringPs -ResourceGroupName DemoRG -Kind Direct -Location "West US 2" -DirectConnection $directConnections -DirectPeeringType Cdn -DirectPeerAsnId $peerAsnId -PeeringLocation Seattle -Sku Premium_Direct_Unlimited + $peering.Name | Should -Be "TestPeeringPs" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringAsn.Recording.json b/src/Peering/test/New-AzPeeringAsn.Recording.json new file mode 100644 index 000000000000..f378fe792353 --- /dev/null +++ b/src/Peering/test/New-AzPeeringAsn.Recording.json @@ -0,0 +1,37 @@ +{ + "New-AzPeeringAsn+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/PsTestAsn?api-version=2022-10-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/PsTestAsn?api-version=2022-10-01", + "Content": "{\n \"properties\": {\n \"peerAsn\": 65001,\n \"peerContactDetail\": [\n {\n \"role\": \"Noc\",\n \"email\": \"abc@xyz.com\",\n \"phone\": \"1234567890\"\n }\n ],\n \"peerName\": \"DemoPeering\"\n }\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "212" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "3ba3f113-aa9a-4f3a-a5af-b5990093ac33" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-correlation-request-id": [ "695093c7-60de-42ed-a54a-c5083eafaa8b" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T013747Z:695093c7-60de-42ed-a54a-c5083eafaa8b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:37:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "435" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"peerAsn\": 65001,\r\n \"peerContactDetail\": [\r\n {\r\n \"role\": \"Noc\",\r\n \"email\": \"abc@xyz.com\",\r\n \"phone\": \"1234567890\"\r\n }\r\n ],\r\n \"peerName\": \"DemoPeering\",\r\n \"validationState\": \"Pending\"\r\n },\r\n \"name\": \"PsTestAsn\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/PsTestAsn\",\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/New-AzPeeringAsn.Tests.ps1 b/src/Peering/test/New-AzPeeringAsn.Tests.ps1 new file mode 100644 index 000000000000..125e46e4fcec --- /dev/null +++ b/src/Peering/test/New-AzPeeringAsn.Tests.ps1 @@ -0,0 +1,26 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringAsn')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringAsn.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringAsn' { + It 'CreateExpanded' { + { + $contactDetail = New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" + $PeerContactList = ,$contactDetail + $newAsn = New-AzPeeringAsn -Name PsTestAsn -PeerAsn 65001 -PeerContactDetail $PeerContactList -PeerName DemoPeering + $newAsn.Name | Should -Be "PsTestAsn" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringCheckServiceProviderAvailabilityInputObject.Tests.ps1 b/src/Peering/test/New-AzPeeringCheckServiceProviderAvailabilityInputObject.Tests.ps1 new file mode 100644 index 000000000000..1a65d779b1c6 --- /dev/null +++ b/src/Peering/test/New-AzPeeringCheckServiceProviderAvailabilityInputObject.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringCheckServiceProviderAvailabilityInputObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringCheckServiceProviderAvailabilityInputObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringCheckServiceProviderAvailabilityInputObject' { + It '__AllParameterSets' { + { + $providerAvailability = New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ + $providerAvailability.PeeringServiceLocation | Should -Be "Osaka" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringConnectionMonitorTest.Tests.ps1 b/src/Peering/test/New-AzPeeringConnectionMonitorTest.Tests.ps1 new file mode 100644 index 000000000000..522a3e690674 --- /dev/null +++ b/src/Peering/test/New-AzPeeringConnectionMonitorTest.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringConnectionMonitorTest')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringConnectionMonitorTest.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringConnectionMonitorTest' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringContactDetailObject.Tests.ps1 b/src/Peering/test/New-AzPeeringContactDetailObject.Tests.ps1 new file mode 100644 index 000000000000..6b916bfebd8a --- /dev/null +++ b/src/Peering/test/New-AzPeeringContactDetailObject.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringContactDetailObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringContactDetailObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringContactDetailObject' { + It '__AllParameterSets' { + { + $contactDetail = New-AzPeeringContactDetailObject -Email "abc@xyz.com" -Phone 1234567890 -Role "Noc" + $contactDetail.Email | Should -Be "abc@xyz.com" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringDirectConnectionObject.Tests.ps1 b/src/Peering/test/New-AzPeeringDirectConnectionObject.Tests.ps1 new file mode 100644 index 000000000000..9f0b67a1ce65 --- /dev/null +++ b/src/Peering/test/New-AzPeeringDirectConnectionObject.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringDirectConnectionObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringDirectConnectionObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringDirectConnectionObject' { + It '__AllParameterSets' { + { + $connection = New-AzPeeringDirectConnectionObject -BandwidthInMbps 10000 -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 12.90.152.62 -BgpSessionPeerSessionIPv4Address 12.90.152.61 -BgpSessionPrefixV4 12.90.152.60/30 -PeeringDbFacilityId 86 -SessionAddressProvider Peer -ConnectionIdentifier d1111111111111111111111111111111 + $connection.ConnectionIdentifier | Should -Be "d1111111111111111111111111111111" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringExchangeConnectionObject.Tests.ps1 b/src/Peering/test/New-AzPeeringExchangeConnectionObject.Tests.ps1 new file mode 100644 index 000000000000..3ec99eb42623 --- /dev/null +++ b/src/Peering/test/New-AzPeeringExchangeConnectionObject.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringExchangeConnectionObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringExchangeConnectionObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringExchangeConnectionObject' { + It '__AllParameterSets' { + { + $exchangeConnection = New-AzPeeringExchangeConnectionObject -BgpSessionMaxPrefixesAdvertisedV4 20000 -BgpSessionMaxPrefixesAdvertisedV6 0 -BgpSessionMd5AuthenticationKey $md5Key -BgpSessionMicrosoftSessionIPv4Address 1.1.1.1 -BgpSessionPeerSessionIPv4Address 1.1.1.0 -BgpSessionPrefixV4 1.1.1.1/31 -PeeringDbFacilityId 82 -ConnectionIdentifier c111111111111 + $exchangeConnection.ConnectionIdentifier | Should -Be "c111111111111" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringRegisteredAsn.Recording.json b/src/Peering/test/New-AzPeeringRegisteredAsn.Recording.json new file mode 100644 index 000000000000..a9a750bd6080 --- /dev/null +++ b/src/Peering/test/New-AzPeeringRegisteredAsn.Recording.json @@ -0,0 +1,37 @@ +{ + "New-AzPeeringRegisteredAsn+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/TestAsn?api-version=2022-10-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/TestAsn?api-version=2022-10-01", + "Content": "{\n \"properties\": {\n \"asn\": 65001\n }\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "42" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "8b1aeaa3-3b09-43d6-aec8-0f01766791cc" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-correlation-request-id": [ "ea29bfdf-0fdb-436f-8575-f81209cf5107" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012526Z:ea29bfdf-0fdb-436f-8575-f81209cf5107" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "392" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"asn\": 65001,\r\n \"peeringServicePrefixKey\": \"9aa88d64-fd78-47b7-8f4a-854dbc76b8a5\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"TestAsn\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/TestAsn\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredAsns\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/New-AzPeeringRegisteredAsn.Tests.ps1 b/src/Peering/test/New-AzPeeringRegisteredAsn.Tests.ps1 new file mode 100644 index 000000000000..7fefd639ff0e --- /dev/null +++ b/src/Peering/test/New-AzPeeringRegisteredAsn.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringRegisteredAsn')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringRegisteredAsn.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringRegisteredAsn' { + It 'CreateExpanded' { + { + $newAsn = New-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo -Asn 65001 + $newAsn.Name | Should -Be "TestAsn" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringRegisteredPrefix.Tests.ps1 b/src/Peering/test/New-AzPeeringRegisteredPrefix.Tests.ps1 new file mode 100644 index 000000000000..126b441f2aff --- /dev/null +++ b/src/Peering/test/New-AzPeeringRegisteredPrefix.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringRegisteredPrefix')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringRegisteredPrefix.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringRegisteredPrefix' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringService.Recording.json b/src/Peering/test/New-AzPeeringService.Recording.json new file mode 100644 index 000000000000..f47fef5ff689 --- /dev/null +++ b/src/Peering/test/New-AzPeeringService.Recording.json @@ -0,0 +1,37 @@ +{ + "New-AzPeeringService+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestPeeringService?api-version=2022-10-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestPeeringService?api-version=2022-10-01", + "Content": "{\n \"properties\": {\n \"peeringServiceLocation\": \"Georgia\",\n \"peeringServiceProvider\": \"MicrosoftEdge\",\n \"providerPrimaryPeeringLocation\": \"Atlanta\"\n },\n \"location\": \"East US 2\"\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "188" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "3d8aeaf1-5247-4554-b34e-2732edcf0f4f" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-correlation-request-id": [ "6f7c9691-62a2-41f5-82c7-e68f4d7578ed" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012528Z:6f7c9691-62a2-41f5-82c7-e68f4d7578ed" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "464" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"peeringServiceLocation\": \"Georgia\",\r\n \"peeringServiceProvider\": \"MicrosoftEdge\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"providerPrimaryPeeringLocation\": \"Atlanta\"\r\n },\r\n \"location\": \"East US 2\",\r\n \"name\": \"TestPeeringService\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestPeeringService\",\r\n \"type\": \"Microsoft.Peering/peeringServices\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/New-AzPeeringService.Tests.ps1 b/src/Peering/test/New-AzPeeringService.Tests.ps1 new file mode 100644 index 000000000000..85268c72e5c2 --- /dev/null +++ b/src/Peering/test/New-AzPeeringService.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringService')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringService.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringService' { + It 'CreateExpanded' { + { + $peeringService = New-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG -Location "East US 2" -PeeringServiceLocation Georgia -PeeringServiceProvider MicrosoftEdge -ProviderPrimaryPeeringLocation Atlanta + $peeringService.Name | Should -Be "TestPeeringService" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/New-AzPeeringServicePrefix.Tests.ps1 b/src/Peering/test/New-AzPeeringServicePrefix.Tests.ps1 new file mode 100644 index 000000000000..191417b87c15 --- /dev/null +++ b/src/Peering/test/New-AzPeeringServicePrefix.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzPeeringServicePrefix')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzPeeringServicePrefix.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzPeeringServicePrefix' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Peering/test/README.md b/src/Peering/test/README.md new file mode 100644 index 000000000000..7c752b4c8c43 --- /dev/null +++ b/src/Peering/test/README.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/Peering/test/Remove-AzPeering.Recording.json b/src/Peering/test/Remove-AzPeering.Recording.json new file mode 100644 index 000000000000..a8122edc7c73 --- /dev/null +++ b/src/Peering/test/Remove-AzPeering.Recording.json @@ -0,0 +1,41 @@ +{ + "Remove-AzPeering+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/TestPeeringPs?api-version=2022-10-01+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/TestPeeringPs?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "95746a52-0c35-4b20-9ee3-cf7f930b578e" ], + "CommandName": [ "Remove-AzPeering" ], + "FullCommandName": [ "Remove-AzPeering_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "c8c9ebd8-b9d7-498b-8894-bcdc433161e2" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-correlation-request-id": [ "445f1f06-65ab-4bed-98ad-ab6ba3024952" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T014944Z:445f1f06-65ab-4bed-98ad-ab6ba3024952" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:49:44 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Remove-AzPeering.Tests.ps1 b/src/Peering/test/Remove-AzPeering.Tests.ps1 new file mode 100644 index 000000000000..b189ca8c4385 --- /dev/null +++ b/src/Peering/test/Remove-AzPeering.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzPeering')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzPeering.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzPeering' { + It 'Delete' { + { + Remove-AzPeering -Name TestPeeringPs -ResourceGroupName DemoRG + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Remove-AzPeeringAsn.Recording.json b/src/Peering/test/Remove-AzPeeringAsn.Recording.json new file mode 100644 index 000000000000..0562472c4495 --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringAsn.Recording.json @@ -0,0 +1,41 @@ +{ + "Remove-AzPeeringAsn+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/PsTestAsn?api-version=2022-10-01+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/PsTestAsn?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "5af600f3-2222-4d1f-ad4f-6ac74eb1ac63" ], + "CommandName": [ "Remove-AzPeeringAsn" ], + "FullCommandName": [ "Remove-AzPeeringAsn_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "da16be78-b2a1-407c-b581-1e3d7b91c442" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-correlation-request-id": [ "7b3fe07d-c749-4016-9b3f-e10383da6112" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T013758Z:7b3fe07d-c749-4016-9b3f-e10383da6112" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:37:58 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Remove-AzPeeringAsn.Tests.ps1 b/src/Peering/test/Remove-AzPeeringAsn.Tests.ps1 new file mode 100644 index 000000000000..c5b6e525932b --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringAsn.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzPeeringAsn')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzPeeringAsn.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzPeeringAsn' { + It 'Delete' { + { + Remove-AzPeeringAsn -Name PsTestAsn + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Remove-AzPeeringConnectionMonitorTest.Tests.ps1 b/src/Peering/test/Remove-AzPeeringConnectionMonitorTest.Tests.ps1 new file mode 100644 index 000000000000..cb91828829ec --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringConnectionMonitorTest.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzPeeringConnectionMonitorTest')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzPeeringConnectionMonitorTest.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzPeeringConnectionMonitorTest' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Remove-AzPeeringRegisteredAsn.Recording.json b/src/Peering/test/Remove-AzPeeringRegisteredAsn.Recording.json new file mode 100644 index 000000000000..ca6ec1969e0b --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringRegisteredAsn.Recording.json @@ -0,0 +1,41 @@ +{ + "Remove-AzPeeringRegisteredAsn+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/TestAsn?api-version=2022-10-01+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/MAPSDemo/providers/Microsoft.Peering/peerings/MapsIxRs/registeredAsns/TestAsn?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "29" ], + "x-ms-client-request-id": [ "83519f6d-20cd-4e0d-a0ae-3d91b480694f" ], + "CommandName": [ "Remove-AzPeeringRegisteredAsn" ], + "FullCommandName": [ "Remove-AzPeeringRegisteredAsn_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "4b7a704a-8a9a-45f1-91fa-4987ed5f283d" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14998" ], + "x-ms-correlation-request-id": [ "235b1ccc-b668-4da6-939f-650e7e143422" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012530Z:235b1ccc-b668-4da6-939f-650e7e143422" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:29 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Remove-AzPeeringRegisteredAsn.Tests.ps1 b/src/Peering/test/Remove-AzPeeringRegisteredAsn.Tests.ps1 new file mode 100644 index 000000000000..4d1f9c8d0d11 --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringRegisteredAsn.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzPeeringRegisteredAsn')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzPeeringRegisteredAsn.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzPeeringRegisteredAsn' { + It 'Delete' { + { + Remove-AzPeeringRegisteredAsn -Name TestAsn -PeeringName MapsIxRs -ResourceGroupName MAPSDemo + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Remove-AzPeeringRegisteredPrefix.Recording.json b/src/Peering/test/Remove-AzPeeringRegisteredPrefix.Recording.json new file mode 100644 index 000000000000..0000da229172 --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringRegisteredPrefix.Recording.json @@ -0,0 +1,40 @@ +{ + "Remove-AzPeeringRegisteredPrefix+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting6?api-version=2022-10-01+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting6?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "30" ], + "x-ms-client-request-id": [ "7d523f5e-7d57-4e6c-9a8e-736aab460064" ], + "CommandName": [ "Remove-AzPeeringRegisteredPrefix" ], + "FullCommandName": [ "Remove-AzPeeringRegisteredPrefix_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "9801a08b-fce8-4f74-8182-5ec9ff24718e" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14997" ], + "x-ms-correlation-request-id": [ "0b2cb703-98fd-43f9-a3f8-b59602012c4a" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T012530Z:0b2cb703-98fd-43f9-a3f8-b59602012c4a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:25:30 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Remove-AzPeeringRegisteredPrefix.Tests.ps1 b/src/Peering/test/Remove-AzPeeringRegisteredPrefix.Tests.ps1 new file mode 100644 index 000000000000..a5ca4404c6c4 --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringRegisteredPrefix.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzPeeringRegisteredPrefix')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzPeeringRegisteredPrefix.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzPeeringRegisteredPrefix' { + It 'Delete' { + { + Remove-AzPeeringRegisteredPrefix -Name accessibilityTesting6 -PeeringName DemoPeering -ResourceGroupName DemoRG + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Remove-AzPeeringService.Recording.json b/src/Peering/test/Remove-AzPeeringService.Recording.json new file mode 100644 index 000000000000..5f4f0600f550 --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringService.Recording.json @@ -0,0 +1,41 @@ +{ + "Remove-AzPeeringService+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestPeeringService?api-version=2022-10-01+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestPeeringService?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "20bf54b5-be9f-4e15-b977-bebaef6e9a26" ], + "CommandName": [ "Remove-AzPeeringService" ], + "FullCommandName": [ "Remove-AzPeeringService_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "a298c3ba-a11f-4a4b-a83f-1285baebeb8c" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-correlation-request-id": [ "cd139c91-11e3-4278-93a1-133e884f0dcf" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T013042Z:cd139c91-11e3-4278-93a1-133e884f0dcf" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:30:41 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Remove-AzPeeringService.Tests.ps1 b/src/Peering/test/Remove-AzPeeringService.Tests.ps1 new file mode 100644 index 000000000000..1716ce0c633a --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringService.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzPeeringService')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzPeeringService.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzPeeringService' { + It 'Delete' { + { + Remove-AzPeeringService -Name TestPeeringService -ResourceGroupName DemoRG + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Remove-AzPeeringServicePrefix.Recording.json b/src/Peering/test/Remove-AzPeeringServicePrefix.Recording.json new file mode 100644 index 000000000000..7f9509149bad --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringServicePrefix.Recording.json @@ -0,0 +1,40 @@ +{ + "Remove-AzPeeringServicePrefix+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestPrefixForAtlanta/prefixes/TestPrefix2?api-version=2022-10-01+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/TestPrefixForAtlanta/prefixes/TestPrefix2?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "b9a04c41-603b-4e9f-bbb4-f63eaf8ab585" ], + "CommandName": [ "Remove-AzPeeringServicePrefix" ], + "FullCommandName": [ "Remove-AzPeeringServicePrefix_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "95862dda-bd94-46ae-b53d-a1e081457291" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-correlation-request-id": [ "f1c38a13-b1d2-49af-b946-e3556c0abdc9" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T013244Z:f1c38a13-b1d2-49af-b946-e3556c0abdc9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:32:44 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Remove-AzPeeringServicePrefix.Tests.ps1 b/src/Peering/test/Remove-AzPeeringServicePrefix.Tests.ps1 new file mode 100644 index 000000000000..01f526b25d4a --- /dev/null +++ b/src/Peering/test/Remove-AzPeeringServicePrefix.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzPeeringServicePrefix')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzPeeringServicePrefix.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzPeeringServicePrefix' { + It 'Delete' { + { + Remove-AzPeeringServicePrefix -Name TestPrefix2 -PeeringServiceName TestPrefixForAtlanta -ResourceGroup DemoRG + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Start-AzPeeringInvokeLookingGlass.Recording.json b/src/Peering/test/Start-AzPeeringInvokeLookingGlass.Recording.json new file mode 100644 index 000000000000..ed47cf8bc8a4 --- /dev/null +++ b/src/Peering/test/Start-AzPeeringInvokeLookingGlass.Recording.json @@ -0,0 +1,42 @@ +{ + "Start-AzPeeringInvokeLookingGlass+[NoContext]+Invoke+$POST+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/lookingGlass?command=Ping\u0026sourceType=EdgeSite\u0026sourceLocation=Seattle\u0026destinationIP=1.1.1.1\u0026api-version=2022-10-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/lookingGlass?command=Ping\u0026sourceType=EdgeSite\u0026sourceLocation=Seattle\u0026destinationIP=1.1.1.1\u0026api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "faca17b1-fba6-4e23-9f80-9aae8cfdbf51" ], + "CommandName": [ "Start-AzPeeringInvokeLookingGlass" ], + "FullCommandName": [ "Start-AzPeeringInvokeLookingGlass_Invoke" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "787b7552-e343-4f81-a87b-956ac1ec8709" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-correlation-request-id": [ "bfecfad5-b03e-4b39-8cf0-8cf53ad384bf" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T015706Z:bfecfad5-b03e-4b39-8cf0-8cf53ad384bf" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:57:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "415" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"command\": \"Ping\",\r\n \"output\": \"PING 1.1.1.1 (1.1.1.1): 56 data bytes\\r\\n64 bytes from 1.1.1.1: icmp_seq=0 ttl=60 time=7.298 ms\\r\\n64 bytes from 1.1.1.1: icmp_seq=1 ttl=60 time=7.355 ms\\r\\n64 bytes from 1.1.1.1: icmp_seq=2 ttl=60 time=9.880 ms\\r\\n\\r\\n--- 1.1.1.1 ping statistics ---\\r\\n3 packets transmitted, 3 packets received, 0% packet loss\\r\\nround-trip min/avg/max/stddev = 7.298/8.178/9.880/1.204 ms\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Start-AzPeeringInvokeLookingGlass.Tests.ps1 b/src/Peering/test/Start-AzPeeringInvokeLookingGlass.Tests.ps1 new file mode 100644 index 000000000000..82667a3d5f41 --- /dev/null +++ b/src/Peering/test/Start-AzPeeringInvokeLookingGlass.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Start-AzPeeringInvokeLookingGlass')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Start-AzPeeringInvokeLookingGlass.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Start-AzPeeringInvokeLookingGlass' { + It 'Invoke' { + { + $command = Start-AzPeeringInvokeLookingGlass -Command Ping -DestinationIp 1.1.1.1 -SourceLocation Seattle -SourceType EdgeSite + $command.Command | Should -Be "Ping" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Test-AzPeeringRegisteredPrefix.Recording.json b/src/Peering/test/Test-AzPeeringRegisteredPrefix.Recording.json new file mode 100644 index 000000000000..50d7606344ef --- /dev/null +++ b/src/Peering/test/Test-AzPeeringRegisteredPrefix.Recording.json @@ -0,0 +1,42 @@ +{ + "Test-AzPeeringRegisteredPrefix+[NoContext]+Validate+$POST+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting2/validate?api-version=2022-10-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting2/validate?api-version=2022-10-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "aa270764-29ff-4d9d-8630-64e7aeb89a6b" ], + "CommandName": [ "Test-AzPeeringRegisteredPrefix" ], + "FullCommandName": [ "Test-AzPeeringRegisteredPrefix_Validate" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.1.3", "Az.Peering/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "238d7391-5835-4632-81d4-56dc15b7d99b" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "x-ms-correlation-request-id": [ "b9308f43-ab16-48da-9e71-b94896657799" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T015707Z:b9308f43-ab16-48da-9e71-b94896657799" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 01:57:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "528" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"prefix\": \"240.0.1.0/24\",\r\n \"prefixValidationState\": \"Pending\",\r\n \"peeringServicePrefixKey\": \"249aa0dd-6177-4105-94fe-dfefcbf5ab48\",\r\n \"errorMessage\": \"Internal server error\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"accessibilityTesting2\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering/registeredPrefixes/accessibilityTesting2\",\r\n \"type\": \"Microsoft.Peering/peerings/registeredPrefixes\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Test-AzPeeringRegisteredPrefix.Tests.ps1 b/src/Peering/test/Test-AzPeeringRegisteredPrefix.Tests.ps1 new file mode 100644 index 000000000000..036d6a189878 --- /dev/null +++ b/src/Peering/test/Test-AzPeeringRegisteredPrefix.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzPeeringRegisteredPrefix')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzPeeringRegisteredPrefix.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Test-AzPeeringRegisteredPrefix' { + It 'Validate' { + { + $test = Test-AzPeeringRegisteredPrefix -Name accessibilityTesting2 -PeeringName DemoPeering -ResourceGroupName DemoRG + $test.Name | Should -Be "accessibilityTesting2" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Test-AzPeeringServiceProviderAvailability.Recording.json b/src/Peering/test/Test-AzPeeringServiceProviderAvailability.Recording.json new file mode 100644 index 000000000000..81a58445cdaf --- /dev/null +++ b/src/Peering/test/Test-AzPeeringServiceProviderAvailability.Recording.json @@ -0,0 +1,37 @@ +{ + "Test-AzPeeringServiceProviderAvailability+[NoContext]+Check+$POST+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/checkServiceProviderAvailability?api-version=2022-10-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/checkServiceProviderAvailability?api-version=2022-10-01", + "Content": "{\n \"peeringServiceLocation\": \"Osaka\",\n \"peeringServiceProvider\": \"IIJ\"\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "74" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "31bd50ed-0748-42ae-8ae4-80536d8e1c3a" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-correlation-request-id": [ "5a9db759-edda-4940-aa21-4ec705d4c614" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T020038Z:5a9db759-edda-4940-aa21-4ec705d4c614" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 02:00:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "11" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "\"Available\"", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Test-AzPeeringServiceProviderAvailability.Tests.ps1 b/src/Peering/test/Test-AzPeeringServiceProviderAvailability.Tests.ps1 new file mode 100644 index 000000000000..8cd9b8fd448f --- /dev/null +++ b/src/Peering/test/Test-AzPeeringServiceProviderAvailability.Tests.ps1 @@ -0,0 +1,26 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzPeeringServiceProviderAvailability')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzPeeringServiceProviderAvailability.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Test-AzPeeringServiceProviderAvailability' { + It 'Check' { + { + $providerAvailability = New-AzPeeringCheckServiceProviderAvailabilityInputObject -PeeringServiceLocation Osaka -PeeringServiceProvider IIJ + $available = Test-AzPeeringServiceProviderAvailability -CheckServiceProviderAvailabilityInput $providerAvailability + $available | Should -Be '"Available"' + } | Should -Not -Throw + } + +} diff --git a/src/Peering/test/Update-AzPeering.Recording.json b/src/Peering/test/Update-AzPeering.Recording.json new file mode 100644 index 000000000000..5a68f2e71a26 --- /dev/null +++ b/src/Peering/test/Update-AzPeering.Recording.json @@ -0,0 +1,37 @@ +{ + "Update-AzPeering+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering?api-version=2022-10-01+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering?api-version=2022-10-01", + "Content": "{\n \"tags\": {\n \"hello\": \"world\"\n }\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "40" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "6f10dba0-a482-474d-ae9f-74c0b965cb2b" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-correlation-request-id": [ "2176849c-db5d-47f7-afe5-f5f96bc9369d" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T021001Z:2176849c-db5d-47f7-afe5-f5f96bc9369d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 02:10:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2412" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"sku\": {\r\n \"name\": \"Premium_Direct_Free\",\r\n \"tier\": \"Premium\",\r\n \"family\": \"Direct\",\r\n \"size\": \"Free\"\r\n },\r\n \"kind\": \"Direct\",\r\n \"properties\": {\r\n \"direct\": {\r\n \"connections\": [\r\n {\r\n \"billableBandwidthInMbps\": 0,\r\n \"bandwidthInMbps\": 200000,\r\n \"provisionedBandwidthInMbps\": 200000,\r\n \"sessionAddressProvider\": \"Peer\",\r\n \"useForPeeringService\": true,\r\n \"peeringDBFacilityId\": 69,\r\n \"connectionState\": \"Active\",\r\n \"bgpSession\": {\r\n \"sessionPrefixV4\": \"12.90.152.68/30\",\r\n \"sessionPrefixV6\": \"\",\r\n \"microsoftSessionIPv4Address\": \"12.90.152.70\",\r\n \"peerSessionIPv4Address\": \"12.90.152.69\",\r\n \"sessionStateV4\": \"Established\",\r\n \"sessionStateV6\": \"None\",\r\n \"maxPrefixesAdvertisedV4\": 200000,\r\n \"maxPrefixesAdvertisedV6\": 0\r\n },\r\n \"connectionIdentifier\": \"815870d0-938d-4355-b6b9-dd007999b8f5\"\r\n },\r\n {\r\n \"billableBandwidthInMbps\": 0,\r\n \"bandwidthInMbps\": 200000,\r\n \"provisionedBandwidthInMbps\": 200000,\r\n \"sessionAddressProvider\": \"Peer\",\r\n \"useForPeeringService\": true,\r\n \"peeringDBFacilityId\": 69,\r\n \"connectionState\": \"Active\",\r\n \"bgpSession\": {\r\n \"sessionPrefixV4\": \"12.125.145.32/30\",\r\n \"sessionPrefixV6\": \"\",\r\n \"microsoftSessionIPv4Address\": \"12.125.145.34\",\r\n \"peerSessionIPv4Address\": \"12.125.145.33\",\r\n \"sessionStateV4\": \"Established\",\r\n \"sessionStateV6\": \"None\",\r\n \"maxPrefixesAdvertisedV4\": 200000,\r\n \"maxPrefixesAdvertisedV6\": 0\r\n },\r\n \"connectionIdentifier\": \"0720b596-dca1-4d58-8628-58191be00cc3\"\r\n }\r\n ],\r\n \"useForPeeringService\": true,\r\n \"peerAsn\": {\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/providers/Microsoft.Peering/peerAsns/AS7018\"\r\n },\r\n \"directPeeringType\": \"Edge\"\r\n },\r\n \"peeringLocation\": \"Dallas\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"South Central US\",\r\n \"tags\": {\r\n \"hello\": \"world\"\r\n },\r\n \"name\": \"DemoPeering\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peerings/DemoPeering\",\r\n \"type\": \"Microsoft.Peering/peerings\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Update-AzPeering.Tests.ps1 b/src/Peering/test/Update-AzPeering.Tests.ps1 new file mode 100644 index 000000000000..96175889a5c1 --- /dev/null +++ b/src/Peering/test/Update-AzPeering.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzPeering')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzPeering.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzPeering' { + It 'UpdateExpanded' { + { + $tags=@{hello='world'} + $peering = Update-AzPeering -Name DemoPeering -ResourceGroupName DemoRG -Tag $tags + $peering.Name | Should -Be "DemoPeering" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/Update-AzPeeringService.Recording.json b/src/Peering/test/Update-AzPeeringService.Recording.json new file mode 100644 index 000000000000..2e2f0b7a2903 --- /dev/null +++ b/src/Peering/test/Update-AzPeeringService.Recording.json @@ -0,0 +1,37 @@ +{ + "Update-AzPeeringService+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/DRTestInterCloud?api-version=2022-10-01+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/DRTestInterCloud?api-version=2022-10-01", + "Content": "{\n \"tags\": {\n \"hello\": \"world\"\n }\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "40" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "4418e086-7979-49b2-9972-6a9a882c6f12" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "99" ], + "x-ms-correlation-request-id": [ "9922e95d-6431-4c26-a77a-e83c95d6a857" ], + "x-ms-routing-request-id": [ "WESTUS:20230113T021003Z:9922e95d-6431-4c26-a77a-e83c95d6a857" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 13 Jan 2023 02:10:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "453" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\r\n \"properties\": {\r\n \"peeringServiceLocation\": \"Ile-de-France\",\r\n \"peeringServiceProvider\": \"InterCloud\",\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"location\": \"UK South\",\r\n \"tags\": {\r\n \"hello\": \"world\"\r\n },\r\n \"name\": \"DRTestInterCloud\",\r\n \"id\": \"/subscriptions/e815e305-b43a-49c4-8b1a-4e61f1aec1e8/resourceGroups/DemoRG/providers/Microsoft.Peering/peeringServices/DRTestInterCloud\",\r\n \"type\": \"Microsoft.Peering/peeringServices\"\r\n}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Peering/test/Update-AzPeeringService.Tests.ps1 b/src/Peering/test/Update-AzPeeringService.Tests.ps1 new file mode 100644 index 000000000000..1a62a8ce65a5 --- /dev/null +++ b/src/Peering/test/Update-AzPeeringService.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzPeeringService')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzPeeringService.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzPeeringService' { + It 'UpdateExpanded' { + { + $tags=@{hello='world'} + $peeringService = Update-AzPeeringService -Name DRTestInterCloud -ResourceGroupName DemoRG -Tag $tags + $peeringService.Name | Should -Be "DRTestInterCloud" + } | Should -Not -Throw + } +} diff --git a/src/Peering/test/env.json b/src/Peering/test/env.json new file mode 100644 index 000000000000..d182e842c463 --- /dev/null +++ b/src/Peering/test/env.json @@ -0,0 +1,4 @@ +{ + "SubscriptionId": "e815e305-b43a-49c4-8b1a-4e61f1aec1e8", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47" +} diff --git a/src/Peering/test/envDogfood.json b/src/Peering/test/envDogfood.json new file mode 100644 index 000000000000..6553a7c06fc4 --- /dev/null +++ b/src/Peering/test/envDogfood.json @@ -0,0 +1,4 @@ +{ + "SubscriptionId": "4445bf11-61c4-436f-a940-60194f8aca57", + "Tenant": "f686d426-8d16-42db-81b7-ab578e110ccd" +} diff --git a/src/Peering/test/loadEnv.ps1 b/src/Peering/test/loadEnv.ps1 new file mode 100644 index 000000000000..5f079e89615e --- /dev/null +++ b/src/Peering/test/loadEnv.ps1 @@ -0,0 +1,29 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/Peering/test/loadEnvDogfood.ps1 b/src/Peering/test/loadEnvDogfood.ps1 new file mode 100644 index 000000000000..2c6682515800 --- /dev/null +++ b/src/Peering/test/loadEnvDogfood.ps1 @@ -0,0 +1,29 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +$envFile = 'envDogfood.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/Peering/test/utils.ps1 b/src/Peering/test/utils.ps1 new file mode 100644 index 000000000000..1990edd45299 --- /dev/null +++ b/src/Peering/test/utils.ps1 @@ -0,0 +1,31 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} + diff --git a/src/Peering/utils/Unprotect-SecureString.ps1 b/src/Peering/utils/Unprotect-SecureString.ps1 new file mode 100644 index 000000000000..cb05b51a6220 --- /dev/null +++ b/src/Peering/utils/Unprotect-SecureString.ps1 @@ -0,0 +1,16 @@ +#This script converts securestring to plaintext + +param( + [Parameter(Mandatory, ValueFromPipeline)] + [System.Security.SecureString] + ${SecureString} +) + +$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) +try { + $plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr) +} finally { + [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr) +} + +return $plaintext \ No newline at end of file From f83853c813faa72c73b2c61e86ae77d059e680ca Mon Sep 17 00:00:00 2001 From: "Jinpei Li (Wicresoft North America Ltd)" Date: Mon, 30 Jan 2023 15:55:41 +0800 Subject: [PATCH 2/2] create exampleIssues.csv and SignatureIssues.csv update changelog --- src/Peering/Az.Peering.psd1 | 2 +- src/Peering/Changelog.md | 60 ++++++++++++++++++- .../Exceptions/Az.Peering/ExampleIssues.csv | 6 ++ .../Exceptions/Az.Peering/SignatureIssues.csv | 6 ++ 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 tools/StaticAnalysis/Exceptions/Az.Peering/ExampleIssues.csv create mode 100644 tools/StaticAnalysis/Exceptions/Az.Peering/SignatureIssues.csv diff --git a/src/Peering/Az.Peering.psd1 b/src/Peering/Az.Peering.psd1 index 3024d5d46938..d072e353438d 100644 --- a/src/Peering/Az.Peering.psd1 +++ b/src/Peering/Az.Peering.psd1 @@ -12,7 +12,7 @@ RootModule = './Az.Peering.psm1' # Version number of this module. -ModuleVersion = '0.1.0' +ModuleVersion = '0.3.1' # Supported PSEditions CompatiblePSEditions = 'Core', 'Desktop' diff --git a/src/Peering/Changelog.md b/src/Peering/Changelog.md index a5bb0f5ac385..231948bc71b7 100644 --- a/src/Peering/Changelog.md +++ b/src/Peering/Changelog.md @@ -18,7 +18,63 @@ - Additional information about change #1 --> ## Upcoming Release +* Supports API Version 2022-10-01 stable -## Version 0.1.0 -* First preview release for module Az.Peering +## Version 0.3.1 +* Upgraded AutoMapper to Microsoft.Azure.PowerShell.AutoMapper 6.2.2 with fix [#18721] + +## Version 0.3.0 +* Added support for cdn peering prefixes + +## Version 0.2.0 +* Adding support for Received routes + +## Version 0.1.9 +* Adding support for Received routes + +## Version 0.1.8 +* Adding support for Peering Registered Prefix +* Adding support for Peering Registered ASN +* Adding filter to Legacy Peering +* Adding filter to Peering Service Countries +* Adding contact details to peer asn +* Bug fixes + +## Version 0.1.7 +* Update references in .psd1 to use relative path +## Version 0.1.6 +* Fixed bug in Peering location +* Added tests to direct connection + +## Version 0.1.5 +* Added Peering Service events +* Removed UseForPeeringService at the Peering level +* Updated to SDK 1.0.1-preview +* Supports API Version 2019-09-01-preview + +## Version 0.1.4 +* Added Peering Service Operations +* Updated Documentation +* Updated to SDK 1.0.0-preview +* Supports API Version 2019-08-01-preview + +## Version 0.1.3 +* Bug fix in set connection for exchange that caused CDIR notation +* Allowed adding connections during legacy convert +* Added tests for set Exchange operations +* Bug fix in set connection +* Added Connection Identifier to Connection object. +* Updated to SDK 0.10.0-preview +* Supports api-version 06-01-2019-preview for Microsoft.Peering +* Fixed miscellaneous typos across module + +## Version 0.1.2 +* Bug fix in IP Prefix validation to allow 0/30 for DirectConnection +* Bug fix to handle error messages from ARM and ERM +* Added Verbose comments for debugging +## Version 0.1.1 +* Update version of AutoMapper library used +* Fix case sensitivity bug in `Get-AzPeeringLocation` for `-Kind` parameter +## Version 0.1.0 +* Preview release for Microsoft Peering Service module \ No newline at end of file diff --git a/tools/StaticAnalysis/Exceptions/Az.Peering/ExampleIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Peering/ExampleIssues.csv new file mode 100644 index 000000000000..3ffbf23992f3 --- /dev/null +++ b/tools/StaticAnalysis/Exceptions/Az.Peering/ExampleIssues.csv @@ -0,0 +1,6 @@ +"Module","Cmdlet","Example","Line","RuleName","ProblemId","Severity","Description","Extent","Remediation" +"Az.Peering","New-AzPeering","1","1","Unbinded_Expression","5014","1","New-AzPeeringDirectConnectionObject ... is not explicitly assigned to a parameter.","...","Assign ... explicitly to the parameter." +"Az.Peering","Remove-AzPeeringServicePrefix","1","1","Invalid_Parameter_Name","5011","1","Remove-AzPeeringServicePrefix -ResourceGroup is not a valid parameter name.","-ResourceGroup","Check validity of the parameter -ResourceGroup." +"Az.Peering","New-AzPeering","1","3","Unassigned_Variable","5110","2","New-AzPeering -DirectPeerAsnId $peerAsnId is a null-valued parameter value.","-DirectPeerAsnId","Assign value for $peerAsnId." +"Az.Peering","New-AzPeeringDirectConnectionObject","1","1","Unassigned_Variable","5110","2","New-AzPeeringDirectConnectionObject -BgpSessionMd5AuthenticationKey $md5Key is a null-valued parameter value.","-BgpSessionMd5AuthenticationKey","Assign value for $md5Key." +"Az.Peering","New-AzPeeringExchangeConnectionObject","1","1","Unassigned_Variable","5110","2","New-AzPeeringExchangeConnectionObject -BgpSessionMd5AuthenticationKey $md5Key is a null-valued parameter value.","-BgpSessionMd5AuthenticationKey","Assign value for $md5Key." \ No newline at end of file diff --git a/tools/StaticAnalysis/Exceptions/Az.Peering/SignatureIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Peering/SignatureIssues.csv new file mode 100644 index 000000000000..468c3aa7ddc3 --- /dev/null +++ b/tools/StaticAnalysis/Exceptions/Az.Peering/SignatureIssues.csv @@ -0,0 +1,6 @@ +"Module","ClassName","Target","Severity","ProblemId","Description","Remediation" +"Az.Peering","New-AzPeeringCheckServiceProviderAvailabilityInputObject","New-AzPeeringCheckServiceProviderAvailabilityInputObject","1","8100","New-AzPeeringCheckServiceProviderAvailabilityInputObject Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue" +"Az.Peering","New-AzPeeringContactDetailObject","New-AzPeeringContactDetailObject","1","8100","New-AzPeeringContactDetailObject Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue" +"Az.Peering","New-AzPeeringDirectConnectionObject","New-AzPeeringDirectConnectionObject","1","8100","New-AzPeeringDirectConnectionObject Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue" +"Az.Peering","New-AzPeeringExchangeConnectionObject","New-AzPeeringExchangeConnectionObject","1","8100","New-AzPeeringExchangeConnectionObject Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue" +"Az.Peering","Start-AzPeeringInvokeLookingGlass","Start-AzPeeringInvokeLookingGlass","1","8400","Start-AzPeeringInvokeLookingGlass uses the noun 'AzPeeringInvokeLookingGlass', which does not follow the enforced naming convention of using a singular noun for a cmdlet name.","Consider using a singular noun for the cmdlet name." \ No newline at end of file