-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding container registry dataplane sdk #4856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Deepak Shankargouda (dsgouda)
merged 5 commits into
Azure:psSdkJson6
from
Jinhuafei:acr_dataplane
Oct 16, 2018
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file--> | ||
| <PropertyGroup> | ||
| <AzureApiTag>2018-08-10-preview</AzureApiTag> | ||
| <PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags> | ||
| </PropertyGroup> | ||
| </Project> |
29 changes: 29 additions & 0 deletions
29
src/SDKs/ContainerRegistry/dataplane/ContainerRegistry.Tests/ContainerRegistry.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <Import Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.test.reference.props'))" /> | ||
| <PropertyGroup> | ||
| <PackageId>ContainerRegistry.Tests</PackageId> | ||
| <Description>Microsoft.Azure.ContainerRegistry tests Library</Description> | ||
| <AssemblyName>ContainerRegistry.Tests</AssemblyName> | ||
| <Version>0.9.0-preview</Version> | ||
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Compile Remove="Tests\ACRTestUtil.cs" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <Compile Include="..\..\ContainerRegistry.Tests\Helpers\RecordedDelegatingHandler.cs" Link="Helpers\RecordedDelegatingHandler.cs" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <None Update="SessionRecords\**\*.json"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| </None> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.Azure.Management.ContainerRegistry" Version="2.0.0" /> | ||
| <PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="[1.6.0-preview, 2.0.0)" /> | ||
| <ProjectReference Include="..\Microsoft.Azure.ContainerRegistry\Microsoft.Azure.ContainerRegistry.csproj" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <None Include="Helpers\ACRTestUtil.cs" /> | ||
| </ItemGroup> | ||
| </Project> | ||
48 changes: 48 additions & 0 deletions
48
src/SDKs/ContainerRegistry/dataplane/ContainerRegistry.Tests/Helpers/ACRTestUtil.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for | ||
| // license information. | ||
|
|
||
| namespace ContainerRegistry.Tests | ||
| { | ||
| using System; | ||
| using System.Net; | ||
| using System.Threading.Tasks; | ||
| using global::ContainerRegistry.Tests; | ||
| using Microsoft.Azure.Management.ContainerRegistry; | ||
| using Microsoft.Rest; | ||
| using Microsoft.Rest.ClientRuntime.Azure.TestFramework; | ||
| using Microsoft.Azure.ContainerRegistry; | ||
|
|
||
| public static class ACRTestUtil | ||
| { | ||
| private static readonly string _testResourceGroup = "matttest"; | ||
|
|
||
| public static readonly string ProdRepository = "prod/bash"; | ||
| public static readonly string TestRepository = "test/bash"; | ||
|
|
||
| public static readonly string ManagedTestRegistry = "managedtestregistry"; | ||
| public static readonly string ManagedTestRegistryFullName = "managedtestregistry.azurecr.io"; | ||
| public static readonly string ManagedTestRegistryForDeleting = "managedtestregistryfordel"; | ||
|
|
||
| public static readonly string ClassicTestRegistry = "classictestregistry"; | ||
| public static readonly string ClassicTestRegistryNameFullName = "classictestregistry.azurecr.io"; | ||
| public static readonly string ClassicTestRegistryForDeleting = "classictestregistryfordel"; | ||
|
|
||
| public static async Task<AzureContainerRegistryClient> GetACRClientAsync(MockContext context, string registryName) | ||
| { | ||
| var registryManagementClient = context.GetServiceClient<ContainerRegistryManagementClient>(handlers: CreateNewRecordedDelegatingHandler()); | ||
| var registry = await registryManagementClient.Registries.GetAsync(_testResourceGroup, registryName); | ||
| var registryCredentials = await registryManagementClient.Registries.ListCredentialsAsync(_testResourceGroup, registryName); | ||
| var credential = new BasicAuthenticationCredentials() { UserName= registryCredentials.Username, Password = registryCredentials.Passwords[0].Value }; | ||
| var acrClient = context.GetServiceClientWithCredentials<AzureContainerRegistryClient>(credential, handlers: CreateNewRecordedDelegatingHandler()); | ||
| acrClient.BaseUri = new Uri($"https://{registry.LoginServer}"); | ||
|
|
||
| return acrClient; | ||
| } | ||
|
|
||
| private static RecordedDelegatingHandler CreateNewRecordedDelegatingHandler() | ||
| { | ||
| return new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK, IsPassThrough = true }; | ||
| } | ||
| } | ||
| } |
186 changes: 186 additions & 0 deletions
186
...nRecords/ContainerRegistry.Tests.ManifestTests/GetAcrManifestAttributesCRReturnsNull.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| { | ||
| "Entries": [ | ||
| { | ||
| "RequestUri": "/subscriptions/dfb63c8c-7c89-4ef8-af13-75c1d873c895/resourceGroups/matttest/providers/Microsoft.ContainerRegistry/registries/classictestregistry?api-version=2017-10-01", | ||
| "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZGZiNjNjOGMtN2M4OS00ZWY4LWFmMTMtNzVjMWQ4NzNjODk1L3Jlc291cmNlR3JvdXBzL21hdHR0ZXN0L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29udGFpbmVyUmVnaXN0cnkvcmVnaXN0cmllcy9jbGFzc2ljdGVzdHJlZ2lzdHJ5P2FwaS12ZXJzaW9uPTIwMTctMTAtMDE=", | ||
| "RequestMethod": "GET", | ||
| "RequestBody": "", | ||
| "RequestHeaders": { | ||
| "x-ms-client-request-id": [ | ||
| "9849e2e6-fe8d-44a1-baf1-b3f07f48b6c7" | ||
| ], | ||
| "accept-language": [ | ||
| "en-US" | ||
| ], | ||
| "User-Agent": [ | ||
| "FxVersion/4.6.26614.01", | ||
| "Microsoft.Azure.Management.ContainerRegistry.ContainerRegistryManagementClient/2.0.0.0" | ||
| ] | ||
| }, | ||
| "ResponseHeaders": { | ||
| "Cache-Control": [ | ||
| "no-cache" | ||
| ], | ||
| "Date": [ | ||
| "Mon, 08 Oct 2018 18:11:48 GMT" | ||
| ], | ||
| "Pragma": [ | ||
| "no-cache" | ||
| ], | ||
| "Server": [ | ||
| "Microsoft-HTTPAPI/2.0" | ||
| ], | ||
| "Strict-Transport-Security": [ | ||
| "max-age=31536000; includeSubDomains" | ||
| ], | ||
| "x-ms-ratelimit-remaining-subscription-reads": [ | ||
| "11999" | ||
| ], | ||
| "x-ms-request-id": [ | ||
| "4f2b5c8d-610a-4756-9951-24aec97926cd" | ||
| ], | ||
| "x-ms-correlation-request-id": [ | ||
| "4f2b5c8d-610a-4756-9951-24aec97926cd" | ||
| ], | ||
| "x-ms-routing-request-id": [ | ||
| "WESTUS2:20181008T181148Z:4f2b5c8d-610a-4756-9951-24aec97926cd" | ||
| ], | ||
| "X-Content-Type-Options": [ | ||
| "nosniff" | ||
| ], | ||
| "Content-Length": [ | ||
| "685" | ||
| ], | ||
| "Content-Type": [ | ||
| "application/json; charset=utf-8" | ||
| ], | ||
| "Expires": [ | ||
| "-1" | ||
| ] | ||
| }, | ||
| "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"Classic\",\r\n \"tier\": \"Classic\"\r\n },\r\n \"type\": \"Microsoft.ContainerRegistry/registries\",\r\n \"id\": \"/subscriptions/dfb63c8c-7c89-4ef8-af13-75c1d873c895/resourceGroups/matttest/providers/Microsoft.ContainerRegistry/registries/classictestregistry\",\r\n \"name\": \"classictestregistry\",\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"loginServer\": \"classictestregistry.azurecr.io\",\r\n \"creationDate\": \"2018-10-04T17:20:54.3121147Z\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"adminUserEnabled\": true,\r\n \"storageAccount\": {\r\n \"id\": \"/subscriptions/dfb63c8c-7c89-4ef8-af13-75c1d873c895/resourceGroups/matttest/providers/Microsoft.Storage/storageAccounts/classictestregistr172020\"\r\n },\r\n \"firewallRulesEnabled\": false,\r\n \"firewallRules\": []\r\n }\r\n}", | ||
| "StatusCode": 200 | ||
| }, | ||
| { | ||
| "RequestUri": "/subscriptions/dfb63c8c-7c89-4ef8-af13-75c1d873c895/resourceGroups/matttest/providers/Microsoft.ContainerRegistry/registries/classictestregistry/listCredentials?api-version=2017-10-01", | ||
| "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZGZiNjNjOGMtN2M4OS00ZWY4LWFmMTMtNzVjMWQ4NzNjODk1L3Jlc291cmNlR3JvdXBzL21hdHR0ZXN0L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29udGFpbmVyUmVnaXN0cnkvcmVnaXN0cmllcy9jbGFzc2ljdGVzdHJlZ2lzdHJ5L2xpc3RDcmVkZW50aWFscz9hcGktdmVyc2lvbj0yMDE3LTEwLTAx", | ||
| "RequestMethod": "POST", | ||
| "RequestBody": "", | ||
| "RequestHeaders": { | ||
| "x-ms-client-request-id": [ | ||
| "cfda6493-776b-4753-b587-3914d53b07ef" | ||
| ], | ||
| "accept-language": [ | ||
| "en-US" | ||
| ], | ||
| "User-Agent": [ | ||
| "FxVersion/4.6.26614.01", | ||
| "Microsoft.Azure.Management.ContainerRegistry.ContainerRegistryManagementClient/2.0.0.0" | ||
| ] | ||
| }, | ||
| "ResponseHeaders": { | ||
| "Cache-Control": [ | ||
| "no-cache" | ||
| ], | ||
| "Date": [ | ||
| "Mon, 08 Oct 2018 18:11:48 GMT" | ||
| ], | ||
| "Pragma": [ | ||
| "no-cache" | ||
| ], | ||
| "Server": [ | ||
| "Microsoft-HTTPAPI/2.0" | ||
| ], | ||
| "Strict-Transport-Security": [ | ||
| "max-age=31536000; includeSubDomains" | ||
| ], | ||
| "x-ms-ratelimit-remaining-subscription-writes": [ | ||
| "1199" | ||
| ], | ||
| "x-ms-request-id": [ | ||
| "d5a0fe2a-460c-495c-8aef-c505da22f8c0" | ||
| ], | ||
| "x-ms-correlation-request-id": [ | ||
| "d5a0fe2a-460c-495c-8aef-c505da22f8c0" | ||
| ], | ||
| "x-ms-routing-request-id": [ | ||
| "WESTUS2:20181008T181148Z:d5a0fe2a-460c-495c-8aef-c505da22f8c0" | ||
| ], | ||
| "X-Content-Type-Options": [ | ||
| "nosniff" | ||
| ], | ||
| "Content-Length": [ | ||
| "175" | ||
| ], | ||
| "Content-Type": [ | ||
| "application/json; charset=utf-8" | ||
| ], | ||
| "Expires": [ | ||
| "-1" | ||
| ] | ||
| }, | ||
| "ResponseBody": "{\r\n \"username\": \"classictestregistry\",\r\n \"passwords\": [\r\n {\r\n \"name\": \"password\",\r\n \"value\": \"YttZqPE=197fuiZ3Cf7YJIW010OxJvoO\"\r\n },\r\n {\r\n \"name\": \"password2\",\r\n \"value\": \"/cTqNKa2Mp3TrZakL2BBYVcOEIS5OG4i\"\r\n }\r\n ]\r\n}", | ||
| "StatusCode": 200 | ||
| }, | ||
| { | ||
| "RequestUri": "/acr/v1/prod%2Fbash/_manifests/sha256:eabe547f78d4c18c708dd97ec3166cf7464cc651f1cbb67e70d407405b7ad7b6", | ||
| "EncodedRequestUri": "L2Fjci92MS9wcm9kJTJGYmFzaC9fbWFuaWZlc3RzL3NoYTI1NiUzQWVhYmU1NDdmNzhkNGMxOGM3MDhkZDk3ZWMzMTY2Y2Y3NDY0Y2M2NTFmMWNiYjY3ZTcwZDQwNzQwNWI3YWQ3YjY=", | ||
| "RequestMethod": "GET", | ||
| "RequestBody": "", | ||
| "RequestHeaders": { | ||
| "x-ms-client-request-id": [ | ||
| "95eeee59-3126-43ac-9e85-88d70d36ad65" | ||
| ], | ||
| "accept-language": [ | ||
| "en-US" | ||
| ], | ||
| "User-Agent": [ | ||
| "FxVersion/4.6.26614.01", | ||
| "Microsoft.Azure.ContainerRegistry.AzureContainerRegistryClient/1.0.0-preview" | ||
| ] | ||
| }, | ||
| "ResponseHeaders": { | ||
| "Connection": [ | ||
| "keep-alive" | ||
| ], | ||
| "Date": [ | ||
| "Mon, 08 Oct 2018 18:11:50 GMT" | ||
| ], | ||
| "Server": [ | ||
| "nginx" | ||
| ], | ||
| "Access-Control-Expose-Headers": [ | ||
| "Docker-Content-Digest", | ||
| "WWW-Authenticate", | ||
| "Link", | ||
| "X-Ms-Correlation-Request-Id" | ||
| ], | ||
| "Docker-Distribution-Api-Version": [ | ||
| "registry/2.0" | ||
| ], | ||
| "Strict-Transport-Security": [ | ||
| "max-age=31536000; includeSubDomains", | ||
| "max-age=31536000; includeSubDomains" | ||
| ], | ||
| "X-Content-Type-Options": [ | ||
| "nosniff" | ||
| ], | ||
| "X-Ms-Correlation-Request-Id": [ | ||
| "9d7817dc-7f91-4985-bb39-99129e2e8e84" | ||
| ], | ||
| "Content-Length": [ | ||
| "70" | ||
| ], | ||
| "Content-Type": [ | ||
| "application/json; charset=utf-8" | ||
| ] | ||
| }, | ||
| "ResponseBody": "{\r\n \"errors\": [\r\n {\r\n \"code\": \"MANIFEST_UNKNOWN\",\r\n \"message\": \"manifest unknown\"\r\n }\r\n ]\r\n}", | ||
| "StatusCode": 404 | ||
| } | ||
| ], | ||
| "Names": {}, | ||
| "Variables": { | ||
| "SubscriptionId": "dfb63c8c-7c89-4ef8-af13-75c1d873c895" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.