Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e71e750
Initial code changes
rjaini Apr 13, 2021
e953c3d
ACR auto-generating cmdlets.
larisaborodina Jun 8, 2021
d40995a
Merge pull request #1 from larisaborodina/release/acrchanges
rjaini Jun 9, 2021
8bc4b41
ACR auto-generating cmdlets. - #2
larisaborodina Jun 14, 2021
579d76f
Merge pull request #2 from larisaborodina/release/acrchanges
rjaini Jun 14, 2021
d16c156
Add pester tests for all the cmdlets.
larisaborodina Aug 5, 2021
d62418c
Merge branch 'release/acrchanges' of https://github.com/larisaborodin…
larisaborodina Aug 5, 2021
f4aaa5e
Merge pull request #3 from larisaborodina/release/acrchanges
rjaini Aug 5, 2021
ada05b3
Merge branch 'dev' into release/acrchanges
larisaborodina Aug 10, 2021
5f81725
Add examples for all the cmdlets.
larisaborodina Aug 17, 2021
31a2056
Merge pull request #4 from larisaborodina/release/acrchanges
larisaborodina Aug 17, 2021
55ea749
Increase vertion to 0.2.0 to avoid clashing with manually released 0.…
larisaborodina Aug 17, 2021
5c1e28b
Merge pull request #5 from larisaborodina/release/acrchanges
larisaborodina Aug 17, 2021
dba2afd
Merge branch 'Azure:dev' into release/acrchanges
larisaborodina Aug 19, 2021
be23ddd
Merge branch 'Azure:dev' into release/acrchanges
larisaborodina Aug 19, 2021
10211aa
Replace Read-AzsContainerRegistry to Get-AzsContainerRegistry.
larisaborodina Aug 19, 2021
e983df3
Merge pull request #6 from larisaborodina/release/acrchanges
larisaborodina Aug 19, 2021
b97a244
Add missed Get-AzsContainerRegistry.Recording.json
larisaborodina Aug 19, 2021
d3ffb18
Merge pull request #7 from larisaborodina/release/acrchanges
larisaborodina Aug 19, 2021
ec31d3b
Add docs for all cmdlets
larisaborodina Aug 20, 2021
53a98cf
Merge branch 'release/acrchanges' of https://github.com/larisaborodin…
larisaborodina Aug 20, 2021
4a22f44
Merge pull request #8 from larisaborodina/release/acrchanges
larisaborodina Aug 20, 2021
26b3572
Initial code changes
rjaini Apr 13, 2021
ea79435
ACR auto-generating cmdlets.
larisaborodina Jun 8, 2021
4181db5
ACR auto-generating cmdlets. - #2
larisaborodina Jun 14, 2021
0e02a3f
Add pester tests for all the cmdlets.
larisaborodina Aug 5, 2021
fe2ac98
Add examples for all the cmdlets.
larisaborodina Aug 17, 2021
5f361ca
Increase vertion to 0.2.0 to avoid clashing with manually released 0.…
larisaborodina Aug 17, 2021
617f1f0
Replace Read-AzsContainerRegistry to Get-AzsContainerRegistry.
larisaborodina Aug 19, 2021
34bf575
Add missed Get-AzsContainerRegistry.Recording.json
larisaborodina Aug 19, 2021
b78246c
Add docs for all cmdlets
larisaborodina Aug 20, 2021
7b24676
Merge branch 'release/acrchanges' of https://github.com/larisaborodin…
larisaborodina Aug 23, 2021
7a689a8
Merge pull request #9 from larisaborodina/release/acrchanges
larisaborodina Aug 23, 2021
c641788
Merge branch 'Azure:dev' into release/acrchanges
larisaborodina Aug 27, 2021
f81437a
Fixed tests running locally, updated docs.
larisaborodina Aug 30, 2021
36f9520
Merge pull request #10 from larisaborodina/release/acrchanges
larisaborodina Aug 30, 2021
cfa1ba7
adding loadEnvJson file for tests
bganapa Aug 31, 2021
c30c4d8
Pester Test fixes.
larisaborodina Aug 31, 2021
810898c
Merge pull request #11 from larisaborodina/release/acrchanges
larisaborodina Aug 31, 2021
28ef012
Merge branch 'Azure:dev' into release/acrchanges
larisaborodina Sep 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Example 1: Get Azs ContainerRegistry Capacity
```powershell
PS C:\> Get-AzsContainerRegistryCapacity

{
"AllowPush": true,
"Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/capacities/Default",
"MaximumCapacityInGiB": 2000,
"Name": "redmond/Default",
"RegistriesConsumptionInGiB": 0,
"Type": "Microsoft.ContainerRegistry.Admin/locations/capacities"
}
```

Returns container registry capacity property.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Example 1: Get AzsContainerRegistry Configuration
```powershell
PS C:\> Get-AzsContainerRegistryConfiguration

{{
"Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/configurations/Default",
"MaximumCapacityInGiB": 2000,
"Name": "redmond/Default",
"Type": "Microsoft.ContainerRegistry.Admin/locations/configurations"
}
```

Returns the specified configuration details.


Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
### Example 1: Get List Azs ContainerRegistry Quotas
```powershell
PS C:\> Get-AzsContainerRegistryQuota

[
{
"CapacityPerRegistryInGiB": 20,
"Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/quotas/Default quota",
"Name": "redmond/Default quota",
"NumberOfRegistry": 20,
"Type": "Microsoft.ContainerRegistry.Admin/locations/quotas"
},
{
"CapacityPerRegistryInGiB": 30,
"Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/quotas/testquota",
"Name": "redmond/testquota",
"NumberOfRegistry": 30,
"Type": "Microsoft.ContainerRegistry.Admin/locations/quotas"
}
]
```

Returns a list of container registry quotas at the given location.

### Example 2: Get Azs ContainerRegistry Quota by Name
```powershell
PS C:\> Get-AzsContainerRegistryQuota -Name "Default quota"

{
"CapacityPerRegistryInGiB": 20,
"Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/quotas/Default quota",
"Name": "redmond/Default quota",
"NumberOfRegistry": 20,
"Type": "Microsoft.ContainerRegistry.Admin/locations/quotas"
}
```

Returns the specified container registry quota.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Example 1: Get Azs ContainerRegistry Setup Status
```powershell
PS C:\> Get-AzsContainerRegistrySetupStatus

{
"id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Setup/locations/redmond/setup/value",
"name": "redmond/value",
"type": "Microsoft.ContainerRegistry.Setup/locations/setup",
"properties": {
"status": "Completed"
}
}
```

Returns the status of the container registry setup.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Example 1: New Azs ContainerRegistry Quota
```powershell
PS C:\> New-AzsContainerRegistryQuota -QuotaName testquota -CapacityPerRegistryInGib 20 -NumberOfRegistry 20

{
"CapacityPerRegistryInGiB": 20,
"Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/quotas/testquota",
"Name": "redmond/testquota",
"NumberOfRegistry": 20,
"Type": "Microsoft.ContainerRegistry.Admin/locations/quotas"
}
```

Create or update an existing container registry quota.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Example 1: Read List Azs Container Registries
```powershell
PS C:\> Read-AzsContainerRegistry

{
"CreationDate": "\/Date(1629160842681)\/",
"Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/registries/testregistry01",
"Location": "redmond",
"Name": "redmond/testregistry01",
"PropertiesName": "testregistry01",
"RegistryId": "/subscriptions/72b77b1b-3e43-4d00-8b5b-be6beceb7f3a/resourceGroups/acrtenanttestrg/providers/Microsoft.ContainerRegistry/registries/testregistry01",
"RegistrySizeInByte": 3011,
"ResourceGroup": "acrtenanttestrg",
"SubscriptionId": "72b77b1b-3e43-4d00-8b5b-be6beceb7f3a",
"Type": "Microsoft.ContainerRegistry.Admin/locations/registries"
}
```

Returns a list of container registries present in all tenant location.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Example 1: Remove Azs ContainerRegistry Configuration
```powershell
PS C:\> Remove-AzsContainerRegistryConfiguration -ConfigurationName default

```

Delete an existing container registry configuration.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Example 1: Remove Azs ContainerRegistry Configuration
```powershell
PS C:\> Remove-AzsContainerRegistryConfiguration -ConfigurationName default

```

Delete an existing container registry configuration.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Example 1: Set Azs ContainerRegistry Configuration
```powershell
PS C:\> Set-AzsContainerRegistryConfiguration -MaximumCapacityInGib 30 -ConfigurationName default

{
"Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/configurations/Default",
"MaximumCapacityInGiB": 30,
"Name": "redmond/Default",
"Type": "Microsoft.ContainerRegistry.Admin/locations/configurations"
}
```

Configure container registry overall configuration properties.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Example 1: Set Azs ContainerRegistry Quota
```powershell
PS C:\> Set-AzsContainerRegistryQuota -QuotaName testquota -CapacityPerRegistryInGib 30 -NumberOfRegistry 30

{
"CapacityPerRegistryInGiB": 30,
"Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/quotas/testquota",
"Name": "redmond/testquota",
"NumberOfRegistry": 30,
"Type": "Microsoft.ContainerRegistry.Admin/locations/quotas"
}
```

Update an existing container registry quota.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Example 1: Start Azs ContainerRegistry Setup
```powershell
PS C:\> Start-AzsContainerRegistrySetup -Password $password -SslCertInputFile $pfx_cert_path

```

Invokes container registry certificate uploading and service deployment.

111 changes: 111 additions & 0 deletions src/Azs.ContainerRegistry.Admin/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<!-- region Generated -->
# Azs.ContainerRegistry.Admin
This directory contains the PowerShell module for the ContainerRegistryAdmin service.

---
## Status
[![Azs.ContainerRegistry.Admin](https://img.shields.io/powershellgallery/v/Azs.ContainerRegistry.Admin.svg?style=flat-square&label=Azs.ContainerRegistry.Admin "Azs.ContainerRegistry.Admin")](https://www.powershellgallery.com/packages/Azs.ContainerRegistry.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.ContainerRegistry.Admin`, see [how-to.md](how-to.md).
<!-- endregion -->

## 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 <br>`npm install -g autorest@beta`<br>&nbsp;
- PowerShell 6.0 or greater
- If you don't have it installed, you can use the cross-platform npm package <br>`npm install -g pwsh`<br>&nbsp;
- .NET Core SDK 2.0 or greater
- If you don't have it installed, you can use the cross-platform npm package <br>`npm install -g dotnet-sdk-2.2`<br>&nbsp;

## 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/containerregistry/readme.azsautogen.md

metadata:
description: 'Microsoft AzureStack PowerShell: ContainerRegistry Admin cmdlets'

### PSD1 metadata changes
subject-prefix: ''
module-version: 0.2.0
service-name: ContainerRegistryAdmin

### File Renames
### IMPORTANT - Note that the following settings are case sensitive ###
module-name: Azs.ContainerRegistry.Admin
csproj: Azs.ContainerRegistry.Admin.csproj
psd1: Azs.ContainerRegistry.Admin.psd1
psm1: Azs.ContainerRegistry.Admin.psm1
```

### Parameter default values
``` yaml
directive:
# Prepend ContainerRegistry for the Quota cmdlets
- where:
subject: Quota
set:
subject-prefix: ContainerRegistry

# Rename Get-AzsContainerRegistry to Read-AzsContainerRegistry
- where:
verb: Get
subject: ContainerRegistry
set:
verb: Read

# Rename cmdlet parameter name in ContainerRegistrySetup
- where:
subject: ContainerRegistrySetup
parameter-name: SslCertBase64
set:
parameter-name: SslCert

# Add release notes
- from: Azs.ContainerRegistry.Admin.nuspec
where: $
transform: $ = $.replace('<releaseNotes></releaseNotes>', '<releaseNotes>AzureStack Hub Admin module generated with https://github.com/Azure/autorest.powershell.</releaseNotes>');

# Add Az.Accounts/Az.Resources as dependencies
- from: Azs.ContainerRegistry.Admin.nuspec
where: $
transform: $ = $.replace('<dependency id=\"Az.Accounts\" version=\"1.6.0\" />', '<dependency id="Az.Accounts" version="2.2.8" />\n <dependency id="Az.Resources" version="[0.11.0]" />');

# PSD1 changes for RequiredModules
- from: source-file-csharp
where: $
transform: $ = $.replace('sb.AppendLine\(\$@\"\{Indent\}RequiredAssemblies = \'\{\"./bin/Azs.ContainerRegistry.Admin.private.dll\"\}\'\"\);', 'sb.AppendLine\(\$@\"\{Indent\}RequiredAssemblies = \'\{\"./bin/Azs.ContainerRegistry.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\'\"\);' );
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"Get-AzsContainerRegistryCapacity+[NoContext]+TestGetContainerRegistryCapacity+$GET+https://management.azure.com/subscriptions/80cc99fb-a34a-449e-a880-24f85d73cb04/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/capacities?api-version=2019-11-01-preview+1": {
"Request": {
"Method": "GET",
"RequestUri": "https://adminmanagement.redmond.ext-n25r1308.masd.stbtest.microsoft.com/subscriptions/80cc99fb-a34a-449e-a880-24f85d73cb04/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/capacities?api-version=2019-11-01-preview",
"Content": null,
"isContentBase64": false,
"Headers": {
"x-ms-unique-id": [ "1" ],
"x-ms-client-request-id": [ "6d2216ce-c1ed-4d4a-9e76-537a99939cd9" ],
"CommandName": [ "Get-AzsContainerRegistryCapacity" ],
"FullCommandName": [ "Get-AzsContainerRegistryCapacity_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": [ "4ae3898e-ce0f-4628-bd90-fc05b695bd2e" ],
"Server": [ "Microsoft-HTTPAPI/2.0" ],
"x-ms-ratelimit-remaining-subscription-reads": [ "14816" ],
"x-ms-correlation-request-id": [ "f8851610-9220-4e6e-aeda-1fd1e000d471" ],
"x-ms-routing-request-id": [ "REDMOND:20210805T012053Z:f8851610-9220-4e6e-aeda-1fd1e000d471" ],
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
"X-Content-Type-Options": [ "nosniff" ],
"Date": [ "Thu, 05 Aug 2021 01:20:52 GMT" ]
},
"ContentHeaders": {
"Content-Length": [ "334" ],
"Content-Type": [ "application/json; charset=utf-8" ],
"Expires": [ "-1" ]
},
"Content": "{\"value\":[{\"id\":\"/subscriptions/80cc99fb-a34a-449e-a880-24f85d73cb04/providers/Microsoft.ContainerRegistry.Admin/locations/redmond/capacities/Default\",\"name\":\"redmond/Default\",\"type\":\"Microsoft.ContainerRegistry.Admin/locations/capacities\",\"properties\":{\"maximumCapacityInGiB\":0,\"registriesConsumptionInGiB\":0.00,\"allowPush\":false}}]}",
"isContentBase64": false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
if (-Not (Test-Path -Path $loadEnvPath)) {
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
}
. ($loadEnvPath)
$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzsContainerRegistryCapacity.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-AzsContainerRegistryCapacity' {
BeforeEach {

function ValidateCapacity {
param(
[Parameter(Mandatory = $true)]
$Capacity
)
$capacity | Should Not Be $null
$capacity.MaximumCapacityInGiB | Should Not Be $null
$capacity.RegistriesConsumptionInGiB | Should Not Be $null
}
}

AfterEach {
$global:Client = $null
}

It "TestGetContainerRegistryCapacity" -Skip:$('TestGetContainerRegistryCapacity' -in $global:SkippedTests) {
$global:TestName = 'TestGetContainerRegistryCapacity'

$result = Get-AzsContainerRegistryCapacity
$result | Should Not Be $null
ValidateCapacity -Capacity $result
}
}
Loading