diff --git a/src/Azs.ContainerService.Admin/docs/Azs.ContainerService.Admin.md b/src/Azs.ContainerService.Admin/docs/Azs.ContainerService.Admin.md new file mode 100644 index 00000000..cb958534 --- /dev/null +++ b/src/Azs.ContainerService.Admin/docs/Azs.ContainerService.Admin.md @@ -0,0 +1,19 @@ +--- +Module Name: Azs.ContainerService.Admin +Module Guid: ceb3fb10-8099-4398-b7a0-1b613eb62bc2 +Download Help Link: https://docs.microsoft.com/en-us/powershell/module/azs.containerservice.admin +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Azs.ContainerService.Admin Module +## Description +Microsoft AzureStack PowerShell: ContainerService Admin cmdlets + +## Azs.ContainerService.Admin Cmdlets +### [Get-AzsContainerService](Get-AzsContainerService.md) +Returns a list of managed clusters present in all tenant location. + +### [Get-AzsContainerServiceQuota](Get-AzsContainerServiceQuota.md) +Returns a list of container service quotas at the given location. + diff --git a/src/Azs.ContainerService.Admin/docs/Get-AzsContainerService.md b/src/Azs.ContainerService.Admin/docs/Get-AzsContainerService.md new file mode 100644 index 00000000..6b26d434 --- /dev/null +++ b/src/Azs.ContainerService.Admin/docs/Get-AzsContainerService.md @@ -0,0 +1,119 @@ +--- +external help file: +Module Name: Azs.ContainerService.Admin +online version: https://docs.microsoft.com/en-us/powershell/module/azs.containerservice.admin/get-azscontainerservice +schema: 2.0.0 +--- + +# Get-AzsContainerService + +## SYNOPSIS +Returns a list of managed clusters present in all tenant location. + +## SYNTAX + +``` +Get-AzsContainerService [-Location ] [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a list of managed clusters present in all tenant location. + +## EXAMPLES + +### Example 1: Get list of managed clusters +```powershell +PS C:\> Get-AzsContainerService -Location "redmond" | ConvertTo-Json +[ + { + "CreationDate": "2021-08-24T21:33:46Z", + "Id": "/subscriptions/f9712d12-aa4d-4d37-8f46-fabf3c07c836/providers/Microsoft.ContainerService.Admin/locations/redmond/managedclusters/testaksux", + "Location": "redmond", + "Name": "redmond/testaksux", + "OrchestratorVersion": "1.19.11", + "PropertiesId": "/subscriptions/16661f04-6eca-4ccb-acef-3624fc128005/resourcegroups/testaksuxrg/providers/Microsoft.ContainerService/managedClusters/testaksux", + "PropertiesName": "testaksux", + "ProvisioningState": "Succeeded", + "SubscriptionId": "16661f04-6eca-4ccb-acef-3624fc128005", + "Type": "Microsoft.ContainerService.Admin/locations/managedclusters" + }, + { + "CreationDate": "2021-08-25T20:02:38Z", + "Id": "/subscriptions/f9712d12-aa4d-4d37-8f46-fabf3c07c836/providers/Microsoft.ContainerService.Admin/locations/redmond/managedclusters/testaksaddon", + "Location": "redmond", + "Name": "redmond/testaksaddon", + "OrchestratorVersion": "1.19.11", + "PropertiesId": "/subscriptions/a174daa5-4b9c-4745-8d80-ca8a6c1e2279/resourcegroups/testaksaddonrg/providers/Microsoft.ContainerService/managedClusters/testaksaddon", + "PropertiesName": "testaksaddon", + "ProvisioningState": "Succeeded", + "SubscriptionId": "a174daa5-4b9c-4745-8d80-ca8a6c1e2279", + "Type": "Microsoft.ContainerService.Admin/locations/managedclusters" + } +] +``` + +Returns a list of all tenant container service clusters. + +## 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 name of Azure region. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzLocation)[0].Location +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```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.ContainerServiceAdmin.Models.Api20191101.IContainerServicesListValueItem + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Azs.ContainerService.Admin/docs/Get-AzsContainerServiceQuota.md b/src/Azs.ContainerService.Admin/docs/Get-AzsContainerServiceQuota.md new file mode 100644 index 00000000..787b4db9 --- /dev/null +++ b/src/Azs.ContainerService.Admin/docs/Get-AzsContainerServiceQuota.md @@ -0,0 +1,99 @@ +--- +external help file: +Module Name: Azs.ContainerService.Admin +online version: https://docs.microsoft.com/en-us/powershell/module/azs.containerservice.admin/get-azscontainerservicequota +schema: 2.0.0 +--- + +# Get-AzsContainerServiceQuota + +## SYNOPSIS +Returns a list of container service quotas at the given location. + +## SYNTAX + +``` +Get-AzsContainerServiceQuota [-Location ] [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Returns a list of container service quotas at the given location. + +## EXAMPLES + +### Example 1: Get Quota for Container Service +```powershell +PS C:\> Get-AzsContainerServiceQuota -Location "redmond" | ConvertTo-Json +{ + "Id": "/subscriptions/f9712d12-aa4d-4d37-8f46-fabf3c07c836/providers/Microsoft.ContainerService.Admin/locations/redmond/quotas/Unlimited", + "Name": "redmond/Unlimited", + "PropertiesName": "Unlimited", + "Type": "Microsoft.ContainerService.Admin/locations/quotas" +} +``` + +Returns a quota for container 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 +``` + +### -Location +The name of Azure region. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzLocation)[0].Location +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```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.ContainerServiceAdmin.Models.Api20191101.IContainerServiceQuotaListValueItem + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Azs.ContainerService.Admin/docs/readme.md b/src/Azs.ContainerService.Admin/docs/readme.md new file mode 100644 index 00000000..c5081e18 --- /dev/null +++ b/src/Azs.ContainerService.Admin/docs/readme.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Azs.ContainerService.Admin` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overriden on regeneration*. To update documentation examples, please use the `..\examples` folder. + +## Info +- Modifiable: no +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Azs.ContainerService.Admin` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder. \ No newline at end of file diff --git a/src/Azs.ContainerService.Admin/examples/Get-AzsContainerService.md b/src/Azs.ContainerService.Admin/examples/Get-AzsContainerService.md new file mode 100644 index 00000000..2905fa60 --- /dev/null +++ b/src/Azs.ContainerService.Admin/examples/Get-AzsContainerService.md @@ -0,0 +1,32 @@ +### Example 1: Get list of managed clusters +```powershell +PS C:\> Get-AzsContainerService -Location "redmond" | ConvertTo-Json +[ + { + "CreationDate": "2021-08-24T21:33:46Z", + "Id": "/subscriptions/f9712d12-aa4d-4d37-8f46-fabf3c07c836/providers/Microsoft.ContainerService.Admin/locations/redmond/managedclusters/testaksux", + "Location": "redmond", + "Name": "redmond/testaksux", + "OrchestratorVersion": "1.19.11", + "PropertiesId": "/subscriptions/16661f04-6eca-4ccb-acef-3624fc128005/resourcegroups/testaksuxrg/providers/Microsoft.ContainerService/managedClusters/testaksux", + "PropertiesName": "testaksux", + "ProvisioningState": "Succeeded", + "SubscriptionId": "16661f04-6eca-4ccb-acef-3624fc128005", + "Type": "Microsoft.ContainerService.Admin/locations/managedclusters" + }, + { + "CreationDate": "2021-08-25T20:02:38Z", + "Id": "/subscriptions/f9712d12-aa4d-4d37-8f46-fabf3c07c836/providers/Microsoft.ContainerService.Admin/locations/redmond/managedclusters/testaksaddon", + "Location": "redmond", + "Name": "redmond/testaksaddon", + "OrchestratorVersion": "1.19.11", + "PropertiesId": "/subscriptions/a174daa5-4b9c-4745-8d80-ca8a6c1e2279/resourcegroups/testaksaddonrg/providers/Microsoft.ContainerService/managedClusters/testaksaddon", + "PropertiesName": "testaksaddon", + "ProvisioningState": "Succeeded", + "SubscriptionId": "a174daa5-4b9c-4745-8d80-ca8a6c1e2279", + "Type": "Microsoft.ContainerService.Admin/locations/managedclusters" + } +] +``` + +Returns a list of all tenant container service clusters diff --git a/src/Azs.ContainerService.Admin/examples/Get-AzsContainerServiceQuota.md b/src/Azs.ContainerService.Admin/examples/Get-AzsContainerServiceQuota.md new file mode 100644 index 00000000..ab08784e --- /dev/null +++ b/src/Azs.ContainerService.Admin/examples/Get-AzsContainerServiceQuota.md @@ -0,0 +1,12 @@ +### Example 1: Get Quota for Container Service +```powershell +PS C:\> Get-AzsContainerServiceQuota -Location "redmond" | ConvertTo-Json +{ + "Id": "/subscriptions/f9712d12-aa4d-4d37-8f46-fabf3c07c836/providers/Microsoft.ContainerService.Admin/locations/redmond/quotas/Unlimited", + "Name": "redmond/Unlimited", + "PropertiesName": "Unlimited", + "Type": "Microsoft.ContainerService.Admin/locations/quotas" +} +``` + +Returns a quota for container service diff --git a/src/Azs.ContainerService.Admin/readme.md b/src/Azs.ContainerService.Admin/readme.md new file mode 100644 index 00000000..62275f01 --- /dev/null +++ b/src/Azs.ContainerService.Admin/readme.md @@ -0,0 +1,92 @@ + +# Azs.ContainerService.Admin +This directory contains the PowerShell module for the ContainerServiceAdmin service. + +--- +## Status +[![Azs.ContainerService.Admin](https://img.shields.io/powershellgallery/v/Azs.ContainerService.Admin.svg?style=flat-square&label=Azs.ContainerService.Admin "Azs.ContainerService.Admin")](https://www.powershellgallery.com/packages/Azs.ContainerService.Admin/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Azs.ContainerService.Admin`, see [how-to.md](how-to.md). + + +## Generation Requirements +Use of the beta version of `autorest.powershell` generator requires the following: +- [NodeJS LTS](https://nodejs.org) (10.15.x LTS preferred) + - **Note**: It *will not work* with Node < 10.x. Using 11.x builds may cause issues as they may introduce instability or breaking changes. +> If you want an easy way to install and update Node, [NVS - Node Version Switcher](../nodejs/installing-via-nvs.md) or [NVM - Node Version Manager](../nodejs/installing-via-nvm.md) is recommended. +- [AutoRest](https://aka.ms/autorest) v3 beta
`npm install -g autorest@beta`
  +- PowerShell 6.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g pwsh`
  +- .NET Core SDK 2.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g dotnet-sdk-2.2`
  + +## Run Generation +In this directory, run AutoRest: +> `autorest` + +--- +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azurestack.md + - $(repo)/specification/azsadmin/resource-manager/containerservice/readme.azsautogen.md + +metadata: + description: 'Microsoft AzureStack PowerShell: ContainerService Admin cmdlets' + +### PSD1 metadata changes +subject-prefix: '' +module-version: 0.1.0 +service-name: ContainerServiceAdmin + +### File Renames +### IMPORTANT - Note that the following settings are case sensitive ### +module-name: Azs.ContainerService.Admin +csproj: Azs.ContainerService.Admin.csproj +psd1: Azs.ContainerService.Admin.psd1 +psm1: Azs.ContainerService.Admin.psm1 +``` + +### Parameter default values +``` yaml +directive: + +# Add release notes + - from: Azs.ContainerService.Admin.nuspec + where: $ + transform: $ = $.replace('', 'AzureStack Hub Admin module generated with https://github.com/Azure/autorest.powershell.'); + +# Add Az.Accounts/Az.Resources as dependencies + - from: Azs.ContainerService.Admin.nuspec + where: $ + transform: $ = $.replace('', '\n '); + +# PSD1 changes for RequiredModules + - from: source-file-csharp + where: $ + transform: $ = $.replace('sb.AppendLine\(\$@\"\{Indent\}RequiredAssemblies = \'\{\"./bin/Azs.ContainerService.Admin.private.dll\"\}\'\"\);', 'sb.AppendLine\(\$@\"\{Indent\}RequiredAssemblies = \'\{\"./bin/Azs.ContainerService.Admin.private.dll\"\}\'\"\);\n sb.AppendLine\(\$@\"\{Indent\}RequiredModules = @\(@\{\{ModuleName = \'Az.Accounts\'; ModuleVersion = \'2.2.8\'; \}\}, @\{\{ModuleName = \'Az.Resources\'; RequiredVersion = \'0.11.0\'; \}\}\)\"\);'); + +# PSD1 changes for ReleaseNotes + - from: source-file-csharp + where: $ + transform: $ = $.replace('sb.AppendLine\(\$@\"\{Indent\}\{Indent\}\{Indent\}ReleaseNotes = \'\'\"\);', 'sb.AppendLine\(\$@\"\{Indent\}\{Indent\}\{Indent\}ReleaseNotes = \'AzureStack Hub Admin module generated with https://github.com/Azure/autorest.powershell\'\"\);' ); +``` diff --git a/src/Azs.ContainerService.Admin/test/Get-AzsContainerService.Recording.json b/src/Azs.ContainerService.Admin/test/Get-AzsContainerService.Recording.json new file mode 100644 index 00000000..12026a6e --- /dev/null +++ b/src/Azs.ContainerService.Admin/test/Get-AzsContainerService.Recording.json @@ -0,0 +1,43 @@ +{ + "Get-AzsContainerService+[NoContext]+TestGetContainerService+$GET+https://management.azure.com/subscriptions/40a8de27-eef0-47f4-b4e1-4168820581b8/providers/Microsoft.ContainerService.Admin/locations/redmond/managedClusters?api-version=2019-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://adminmanagement.redmond.ext-n31r1201.masd.stbtest.microsoft.com/subscriptions/40a8de27-eef0-47f4-b4e1-4168820581b8/providers/Microsoft.ContainerService.Admin/locations/redmond/managedClusters?api-version=2019-11-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "68b5e6e1-3d73-404d-8677-7a5bc94d2197" ], + "CommandName": [ "Get-AzsContainerService" ], + "FullCommandName": [ "Get-AzsContainerService_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "2b39b838-c46d-4ae4-9518-91903936a705" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "14990" ], + "x-ms-correlation-request-id": [ "50c0dbbe-bd7c-4ecb-9dfc-3ea57077d1d7" ], + "x-ms-routing-request-id": [ "REDMOND:20210816T232443Z:50c0dbbe-bd7c-4ecb-9dfc-3ea57077d1d7" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 16 Aug 2021 23:24:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2491" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/40a8de27-eef0-47f4-b4e1-4168820581b8/providers/Microsoft.ContainerService.Admin/locations/redmond/managedclusters/demok8s\",\"name\":\"redmond/demok8s\",\"type\":\"Microsoft.ContainerService.Admin/locations/managedclusters\",\"properties\":{\"id\":\"/subscriptions/650c424d-9945-4897-98ff-d33c9222be8b/resourcegroups/demok8s/providers/Microsoft.ContainerService/managedClusters/demok8s\",\"name\":\"demok8s\",\"location\":\"redmond\",\"creationDate\":\"2021-08-05T20:49:51+00:00\",\"subscriptionId\":\"650c424d-9945-4897-98ff-d33c9222be8b\",\"orchestratorVersion\":\"1.20.7\",\"provisioningState\":\"Succeeded\"}},{\"id\":\"/subscriptions/40a8de27-eef0-47f4-b4e1-4168820581b8/providers/Microsoft.ContainerService.Admin/locations/redmond/managedclusters/moassafakscni\",\"name\":\"redmond/moassafakscni\",\"type\":\"Microsoft.ContainerService.Admin/locations/managedclusters\",\"properties\":{\"id\":\"/subscriptions/650c424d-9945-4897-98ff-d33c9222be8b/resourcegroups/moassafRG/providers/Microsoft.ContainerService/managedClusters/moassafakscni\",\"name\":\"moassafakscni\",\"location\":\"redmond\",\"creationDate\":\"2021-08-11T18:21:30+00:00\",\"subscriptionId\":\"650c424d-9945-4897-98ff-d33c9222be8b\",\"orchestratorVersion\":\"1.20.7\",\"provisioningState\":\"Failed\"}},{\"id\":\"/subscriptions/40a8de27-eef0-47f4-b4e1-4168820581b8/providers/Microsoft.ContainerService.Admin/locations/redmond/managedclusters/moassafclustercni\",\"name\":\"redmond/moassafclustercni\",\"type\":\"Microsoft.ContainerService.Admin/locations/managedclusters\",\"properties\":{\"id\":\"/subscriptions/650c424d-9945-4897-98ff-d33c9222be8b/resourcegroups/moassafRG/providers/Microsoft.ContainerService/managedClusters/moassafclustercni\",\"name\":\"moassafclustercni\",\"location\":\"redmond\",\"creationDate\":\"2021-08-03T17:39:40+00:00\",\"subscriptionId\":\"650c424d-9945-4897-98ff-d33c9222be8b\",\"orchestratorVersion\":\"1.20.7\",\"provisioningState\":\"Failed\"}},{\"id\":\"/subscriptions/40a8de27-eef0-47f4-b4e1-4168820581b8/providers/Microsoft.ContainerService.Admin/locations/redmond/managedclusters/testdnscluster\",\"name\":\"redmond/testdnscluster\",\"type\":\"Microsoft.ContainerService.Admin/locations/managedclusters\",\"properties\":{\"id\":\"/subscriptions/650c424d-9945-4897-98ff-d33c9222be8b/resourcegroups/testdnsrg/providers/Microsoft.ContainerService/managedClusters/testdnscluster\",\"name\":\"testdnscluster\",\"location\":\"redmond\",\"creationDate\":\"2021-08-03T21:31:41+00:00\",\"subscriptionId\":\"650c424d-9945-4897-98ff-d33c9222be8b\",\"orchestratorVersion\":\"1.20.7\",\"provisioningState\":\"Succeeded\"}}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Azs.ContainerService.Admin/test/Get-AzsContainerService.Tests.ps1 b/src/Azs.ContainerService.Admin/test/Get-AzsContainerService.Tests.ps1 new file mode 100644 index 00000000..0eae5a20 --- /dev/null +++ b/src/Azs.ContainerService.Admin/test/Get-AzsContainerService.Tests.ps1 @@ -0,0 +1,38 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzsContainerService.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-AzsContainerService' { + BeforeEach { + function ValidateContainerService { + param( + [Parameter(Mandatory = $true)] + $ManagedClusters + ) + $managedClusters | Should Not Be $null + $managedClusters.orchestratorVersion | Should Not Be $null + $managedClusters.provisioningState | Should Not Be $null + } + } + + AfterEach { + $global:Client = $null + } + + It "TestGetContainerService" -Skip:$('TestGetContainerService' -in $global:SkippedTests) { + $global:TestName = 'TestGetContainerService' + + $result = Get-AzsContainerService -Location $env.Location + $result | Should Not Be $null + ValidateContainerService -ManagedClusters $result + } +} diff --git a/src/Azs.ContainerService.Admin/test/Get-AzsContainerServiceQuota.Recording.json b/src/Azs.ContainerService.Admin/test/Get-AzsContainerServiceQuota.Recording.json new file mode 100644 index 00000000..1fe3f89c --- /dev/null +++ b/src/Azs.ContainerService.Admin/test/Get-AzsContainerServiceQuota.Recording.json @@ -0,0 +1,43 @@ +{ + "Get-AzsContainerServiceQuota+[NoContext]+TestGetContainerServiceQuota+$GET+https://management.azure.com/subscriptions/40a8de27-eef0-47f4-b4e1-4168820581b8/providers/Microsoft.ContainerService.Admin/locations/redmond/quotas?api-version=2019-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://adminmanagement.redmond.ext-n31r1201.masd.stbtest.microsoft.com/subscriptions/40a8de27-eef0-47f4-b4e1-4168820581b8/providers/Microsoft.ContainerService.Admin/locations/redmond/quotas?api-version=2019-11-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "9e7a786d-e8f4-479d-97d6-e859e405c608" ], + "CommandName": [ "Get-AzsContainerServiceQuota" ], + "FullCommandName": [ "Get-AzsContainerServiceQuota_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "a2a8094b-52bc-4bab-9460-792473abbc0d" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "14988" ], + "x-ms-correlation-request-id": [ "f95c8f63-d22c-463b-b899-b24811dd70aa" ], + "x-ms-routing-request-id": [ "REDMOND:20210816T232445Z:f95c8f63-d22c-463b-b899-b24811dd70aa" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 16 Aug 2021 23:24:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "270" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/40a8de27-eef0-47f4-b4e1-4168820581b8/providers/Microsoft.ContainerService.Admin/locations/redmond/quotas/Unlimited\",\"name\":\"redmond/Unlimited\",\"type\":\"Microsoft.ContainerService.Admin/locations/quotas\",\"properties\":{\"name\":\"Unlimited\"}}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Azs.ContainerService.Admin/test/Get-AzsContainerServiceQuota.Tests.ps1 b/src/Azs.ContainerService.Admin/test/Get-AzsContainerServiceQuota.Tests.ps1 new file mode 100644 index 00000000..0bf7a972 --- /dev/null +++ b/src/Azs.ContainerService.Admin/test/Get-AzsContainerServiceQuota.Tests.ps1 @@ -0,0 +1,37 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzsContainerServiceQuota.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-AzsContainerServiceQuota' { + BeforeEach { + function ValidateContainerServiceQuota { + param( + [Parameter(Mandatory = $true)] + $ManagedClustersQuota + ) + $managedClustersQuota | Should Not Be $null + $managedClustersQuota.name | Should Not Be $null + } + } + + AfterEach { + $global:Client = $null + } + + It "TestGetContainerServiceQuota" -Skip:$('TestGetContainerServiceQuota' -in $global:SkippedTests) { + $global:TestName = 'TestGetContainerServiceQuota' + + $result = Get-AzsContainerServiceQuota -Location $env.Location + $result | Should Not Be $null + ValidateContainerServiceQuota -ManagedClustersQuota $result + } +} diff --git a/src/Azs.ContainerService.Admin/test/env.json b/src/Azs.ContainerService.Admin/test/env.json new file mode 100644 index 00000000..ced1635d --- /dev/null +++ b/src/Azs.ContainerService.Admin/test/env.json @@ -0,0 +1,4 @@ +{ + "SubscriptionId": "40a8de27-eef0-47f4-b4e1-4168820581b8", + "Location": "redmond" +} \ No newline at end of file