-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update arm response types to match current Azure.Core pattern (#20738)
* WIP * wip * Change the accessbility to virtual for Resource.Id * update strawman for operation changes * finalize changes before testing * update ph overloads * move pipeline creation into armoperation * wip * updates based on new OperationInternals * address PR comments * update test classes to use new pattern * final fixes for arm core tests * use mock response instead of null * updates to proto code * add null check around basetype Co-authored-by: YalinLi0312 <yall@microsoft.com> Co-authored-by: m-nash <prognash@microsoft.com>
- Loading branch information
1 parent
72930a1
commit a31bb43
Showing
38 changed files
with
835 additions
and
532 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
31 changes: 29 additions & 2 deletions
31
sdk/core/Azure.Core/tests/TestClients/PhArmOperationTest.cs
This file contains 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 |
---|---|---|
@@ -1,17 +1,44 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Azure.Core.TestFramework; | ||
using Azure.ResourceManager.Core; | ||
|
||
namespace Azure.Core.Tests | ||
{ | ||
public class PhArmOperationTest<T> : ArmOperationTest<T> | ||
public class PhArmOperationTest<T> : ArmOperation<T> | ||
where T : class | ||
{ | ||
private OperationOrResponseInternals<T> _operationHelper; | ||
|
||
public override T Value => _operationHelper.Value; | ||
|
||
public override bool HasValue => _operationHelper.HasValue; | ||
|
||
public override string Id => "MyId"; | ||
|
||
public override bool HasCompleted => _operationHelper.HasCompleted; | ||
|
||
protected PhArmOperationTest() | ||
{ | ||
} | ||
|
||
public PhArmOperationTest(T value) : base(value) | ||
public PhArmOperationTest(T value) | ||
{ | ||
_operationHelper = new OperationOrResponseInternals<T>(Response.FromValue(value, new MockResponse(200))); | ||
} | ||
|
||
public override ValueTask<Response<T>> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operationHelper.WaitForCompletionAsync(cancellationToken); | ||
|
||
public override ValueTask<Response<T>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => _operationHelper.WaitForCompletionAsync(pollingInterval, cancellationToken); | ||
|
||
public override Response GetRawResponse() => _operationHelper.GetRawResponse(); | ||
|
||
public override ValueTask<Response> UpdateStatusAsync(CancellationToken cancellationToken = default) => _operationHelper.UpdateStatusAsync(cancellationToken); | ||
|
||
public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operationHelper.UpdateStatus(cancellationToken); | ||
} | ||
} |
This file contains 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
83 changes: 0 additions & 83 deletions
83
sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmOperation.cs
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmResponse.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.