-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[ContainerRegistry] SDK validation for TypeSpec #53318
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
c592fec
aa85845
3f5bc96
d80fec7
3ade6aa
aa14806
ef6e0de
dc6325f
dc208fa
9587fc1
7c40230
54a1b4e
1495516
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System.Collections.Generic; | ||
| using System.ComponentModel; | ||
|
|
||
| namespace Azure.ResourceManager.ContainerRegistry | ||
| { | ||
| public partial class ContainerRegistryPrivateLinkResourceData | ||
| { | ||
| // This is a usage change in api version 2025-11-01, add this property back for compatibility reason. | ||
| /// <summary> The private link resource Private link DNS zone name. </summary> | ||
| [WirePath("properties.requiredZoneNames")] | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public IReadOnlyList<string> RequiredZoneNames { get => (IReadOnlyList<string>)RequiredZoneNamesList; } | ||
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System; | ||
| using System.ComponentModel; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Azure.Core; | ||
| using Azure.ResourceManager.ContainerRegistry.Models; | ||
|
|
||
| namespace Azure.ResourceManager.ContainerRegistry | ||
| { | ||
| // The `ScheduleRun` operation is no longer LRO, add these method back for compatibility reason. | ||
ArcturusZhang marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public partial class ContainerRegistryResource | ||
| { | ||
| /// <summary> | ||
| /// Schedules a new run based on the request parameters and add it to the run queue. | ||
| /// <list type="bullet"> | ||
| /// <item> | ||
| /// <term>Request Path</term> | ||
| /// <description>/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun</description> | ||
| /// </item> | ||
| /// <item> | ||
| /// <term>Operation Id</term> | ||
| /// <description>Schedules_ScheduleRun</description> | ||
| /// </item> | ||
| /// <item> | ||
| /// <term>Default Api Version</term> | ||
| /// <description>2019-06-01-preview</description> | ||
| /// </item> | ||
| /// </list> | ||
| /// </summary> | ||
| /// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param> | ||
| /// <param name="content"> The parameters of a run that needs to scheduled. </param> | ||
| /// <param name="cancellationToken"> The cancellation token to use. </param> | ||
| /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception> | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public virtual async Task<ArmOperation<ContainerRegistryRunResource>> ScheduleRunAsync(WaitUntil waitUntil, ContainerRegistryRunContent content, CancellationToken cancellationToken = default) | ||
| { | ||
| Argument.AssertNotNull(content, nameof(content)); | ||
|
|
||
| using var scope = _schedulesClientDiagnostics.CreateScope("ContainerRegistryResource.ScheduleRun"); | ||
| scope.Start(); | ||
| try | ||
| { | ||
| var response = await _schedulesRestClient.ScheduleRunAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); | ||
| var uri = _schedulesRestClient.CreateScheduleRunRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content); | ||
| var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Post, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); | ||
| var operation = new ContainerRegistryArmOperation<ContainerRegistryRunResource>(Response.FromValue(new ContainerRegistryRunResource(Client, response), response.GetRawResponse()), rehydrationToken); | ||
| if (waitUntil == WaitUntil.Completed) | ||
| await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); | ||
| return operation; | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| scope.Failed(e); | ||
| throw; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Schedules a new run based on the request parameters and add it to the run queue. | ||
| /// <list type="bullet"> | ||
| /// <item> | ||
| /// <term>Request Path</term> | ||
| /// <description>/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun</description> | ||
| /// </item> | ||
| /// <item> | ||
| /// <term>Operation Id</term> | ||
| /// <description>Schedules_ScheduleRun</description> | ||
| /// </item> | ||
| /// <item> | ||
| /// <term>Default Api Version</term> | ||
| /// <description>2019-06-01-preview</description> | ||
| /// </item> | ||
| /// </list> | ||
| /// </summary> | ||
| /// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param> | ||
| /// <param name="content"> The parameters of a run that needs to scheduled. </param> | ||
| /// <param name="cancellationToken"> The cancellation token to use. </param> | ||
| /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception> | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public virtual ArmOperation<ContainerRegistryRunResource> ScheduleRun(WaitUntil waitUntil, ContainerRegistryRunContent content, CancellationToken cancellationToken = default) | ||
| { | ||
| Argument.AssertNotNull(content, nameof(content)); | ||
|
|
||
| using var scope = _schedulesClientDiagnostics.CreateScope("ContainerRegistryResource.ScheduleRun"); | ||
| scope.Start(); | ||
| try | ||
| { | ||
| var response = _schedulesRestClient.ScheduleRun(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); | ||
| var uri = _schedulesRestClient.CreateScheduleRunRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content); | ||
| var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Post, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); | ||
| var operation = new ContainerRegistryArmOperation<ContainerRegistryRunResource>(Response.FromValue(new ContainerRegistryRunResource(Client, response), response.GetRawResponse()), rehydrationToken); | ||
| if (waitUntil == WaitUntil.Completed) | ||
| operation.WaitForCompletion(cancellationToken); | ||
| return operation; | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| scope.Failed(e); | ||
| throw; | ||
| } | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.