Skip to content
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

Implement mgmt resource #47944

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
f041f24
wip
live1206 Jan 16, 2025
badf1a5
wip
live1206 Jan 20, 2025
69fa28a
wip
live1206 Jan 21, 2025
615fec1
Merge remote-tracking branch 'origin/main' into implement-mgmt-resource
live1206 Jan 21, 2025
d136be2
wip
live1206 Jan 23, 2025
a040627
wip
live1206 Jan 26, 2025
0296a71
Merge remote-tracking branch 'origin/main' into implement-mgmt-resource
live1206 Jan 26, 2025
fda752a
generate operation methods for Resource
live1206 Jan 27, 2025
580508a
add package back
live1206 Jan 27, 2025
ba12225
Merge remote-tracking branch 'origin/main' into implement-mgmt-resource
live1206 Feb 6, 2025
ef83882
update to latest MGC
live1206 Feb 6, 2025
120e164
fix test
live1206 Feb 6, 2025
e4bbde0
Merge branch 'main' into implement-mgmt-resource
live1206 Feb 7, 2025
b2842c4
Add test for ResourceProvider
live1206 Feb 8, 2025
5f5cee9
Merge remote-tracking branch 'origin/main' into implement-mgmt-resource
live1206 Feb 8, 2025
41cf53c
Add RequestPath
live1206 Feb 8, 2025
7bba967
remove unused property
live1206 Feb 10, 2025
5d3a879
address comments
live1206 Feb 11, 2025
2fe508f
Include custom code for convenience methods
live1206 Feb 11, 2025
d9fd368
add TODO
live1206 Feb 11, 2025
17b2a0f
merge from main
live1206 Feb 13, 2025
45a10a7
implement resource LRO
live1206 Feb 13, 2025
b06fb59
implement LRO for resource
live1206 Feb 14, 2025
c98e231
Implement IOperationSouce and generated MgmtTypeSpec can build now
live1206 Feb 14, 2025
848e6d7
update test data
live1206 Feb 14, 2025
0db68cb
Add test for OperationSourceProvider
live1206 Feb 14, 2025
2b15650
update tests
live1206 Feb 14, 2025
51bd7f3
cleanup
live1206 Feb 14, 2025
a8b2b8f
update
live1206 Feb 14, 2025
dc2b83d
cleanup
live1206 Feb 14, 2025
adbcc1c
Address comments
live1206 Feb 15, 2025
bb92673
Add Mgmt-TypeSpec generation to Generate.ps1
live1206 Feb 15, 2025
af9bd9c
Merge remote-tracking branch 'origin/main' into implement-mgmt-resource
live1206 Feb 18, 2025
c5ca437
Update eng/packages/http-client-csharp/generator/Azure.Generator/src/…
live1206 Feb 19, 2025
3ed339d
update
live1206 Feb 19, 2025
d800d35
Merge branch 'main' into implement-mgmt-resource
live1206 Feb 24, 2025
8d78f7f
fix build
live1206 Feb 24, 2025
8fbc8aa
update to use CanonicalView
live1206 Feb 24, 2025
081696d
update test
live1206 Feb 24, 2025
f9e8afd
Use ModelSerializationExtensions.WireOptions instead of new instance
live1206 Feb 24, 2025
8d7b831
update test
live1206 Feb 24, 2025
4dcccc7
Address comments
live1206 Feb 25, 2025
d00ee3a
typo
live1206 Feb 25, 2025
0086b11
Merge remote-tracking branch 'origin/main' into implement-mgmt-resource
live1206 Feb 25, 2025
e34db7b
resolve comments
live1206 Feb 26, 2025
417af63
fix build
live1206 Feb 26, 2025
965e951
update test
live1206 Feb 27, 2025
579dd9b
separate tests for ResourceClientProvider
live1206 Feb 27, 2025
682e704
Add TODO
live1206 Feb 27, 2025
22e08c6
fix tests
live1206 Feb 28, 2025
541193c
Move resource related logic to ResourceBuilder
live1206 Feb 28, 2025
20cdaaf
Remove clientProvider and implement client methods in Resource directly
live1206 Mar 1, 2025
78b5cb5
update
live1206 Mar 1, 2025
ff44b6b
simplify resource detection
live1206 Mar 3, 2025
33c30fa
Merge branch 'main' into implement-mgmt-resource
live1206 Mar 4, 2025
ca43fe6
replace resource detection with decorators
live1206 Mar 6, 2025
7ff96ba
cleanup
live1206 Mar 6, 2025
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
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
</ItemGroup>

<ItemGroup Condition="'$(IsGeneratorLibrary)' == 'true'">
<PackageReference Update="Microsoft.Generator.CSharp.ClientModel" Version="1.0.0-alpha.20250205.1" />
<PackageReference Update="Microsoft.Generator.CSharp.ClientModel" Version="1.0.0-alpha.20250206.1" />
</ItemGroup>

<!--
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.ResourceManager;
using Azure.Generator.Utilities;
using Microsoft.CodeAnalysis;
using Microsoft.Generator.CSharp;
Expand Down Expand Up @@ -31,6 +32,9 @@ public class AzureClientPlugin : ClientModelPlugin
public override AzureOutputLibrary OutputLibrary => _azureOutputLibrary ??= new();

internal ResourceDetection ResourceDetection { get; } = new();
internal ParentDetection ParentDetection { get; } = new();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't your parent just a property on the client from typespec?

Copy link
Member Author

@live1206 live1206 Feb 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For TypeSpec, we should be able to get the resource hierarchy directly via #48281.
The resource detection logic is mainly for swagger input.
For now, given getArmResources API is not ready for integration. We use it as a temporary workaround.

Eventually, when we have the native way ready, we should get rid of them. And the resource detection should be part of the M4 output conversion to tspCodeModel.json in autorest.csharp.
Added TODO to remove them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As offline discussed, we need to clarify the contract of input types containing the resource hierarchy. And it should be an extensible way of holding it in Azure plugin only.
Then, we can put the temp workaround of resource detection close to the input instead of output.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isolated Resource related logic in ResourceBuilder, so we have separated the temp workaround to a central place.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will need to have resource related logic in MPG emitter, such as call getArmResources API to get the resource hierarchy. MGC doesn't need to provide any extension for this. MPG can have additional input models to hold them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is only needed for swagger input, have we considered having this in autorest.csharp only?

We can make it part of the codemodel -> input type conversion before we serialize out to the new plugin. That way the new plugin only has 1 way to do things which is to read the information directly from the codemodel.json file and it doesn't care how the data got there.

internal ScopeDetection ScopeDetection { get; } = new();
internal SingletonDetection SingletonDetection { get; } = new();

/// <summary>
/// The Azure client plugin to generate the Azure client SDK.
Expand All @@ -55,6 +59,8 @@ public override void Configure()
AddSharedSourceDirectory(sharedSourceDirectory);
if (IsAzureArm.Value)
{
// Include Azure.ResourceManager
AddMetadataReference(MetadataReference.CreateFromFile(typeof(ArmClient).Assembly.Location));
AddVisitor(new AzureArmVisitor());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,49 @@
using Azure.Generator.Providers;
using Azure.Generator.Utilities;
using Microsoft.Generator.CSharp.ClientModel;
using Microsoft.Generator.CSharp.Input;
using Microsoft.Generator.CSharp.Providers;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Azure.Generator
{
/// <inheritdoc/>
public class AzureOutputLibrary : ScmOutputLibrary
{
// TODO: categorize clients into operationSets, which contains operations sharing the same Path
private Dictionary<string, OperationSet> _pathToOperationSetMap;
private Dictionary<string, HashSet<OperationSet>> _resourceDataBySpecNameMap;
private Dictionary<string, HashSet<OperationSet>> _specNameToOperationSetsMap;
private Dictionary<string, InputModelType> _inputTypeMap;

/// <inheritdoc/>
public AzureOutputLibrary()
{
_pathToOperationSetMap = CategorizeClients();
_resourceDataBySpecNameMap = EnsureResourceDataMap();
_specNameToOperationSetsMap = EnsureOperationsetMap();
_inputTypeMap = AzureClientPlugin.Instance.InputLibrary.InputNamespace.Models.OfType<InputModelType>().ToDictionary(model => model.Name);
}

private Dictionary<string, HashSet<OperationSet>> EnsureResourceDataMap()
private IReadOnlyList<ResourceProvider> BuildResources()
{
var result = new List<ResourceProvider>();
foreach ((var schemaName, var operationSets) in _specNameToOperationSetsMap)
{
var model = _inputTypeMap[schemaName];
var resourceData = (ResourceDataProvider)AzureClientPlugin.Instance.TypeFactory.CreateModel(model)!;
foreach (var operationSet in operationSets)
{
var requestPath = operationSet.RequestPath;
var resourceType = ResourceDetection.GetResourceTypeFromPath(requestPath);
var resource = new ResourceProvider(operationSet, schemaName, resourceData, resourceType);
AzureClientPlugin.Instance.AddTypeToKeep(resource.Name);
result.Add(resource);
}
}
return result;
}

private Dictionary<string, HashSet<OperationSet>> EnsureOperationsetMap()
{
var result = new Dictionary<string, HashSet<OperationSet>>();
foreach (var operationSet in _pathToOperationSetMap.Values)
Expand All @@ -49,11 +72,9 @@ private Dictionary<string, OperationSet> CategorizeClients()
var result = new Dictionary<string, OperationSet>();
foreach (var inputClient in AzureClientPlugin.Instance.InputLibrary.InputNamespace.Clients)
{
var requestPathList = new HashSet<string>();
foreach (var operation in inputClient.Operations)
{
var path = operation.GetHttpPath();
requestPathList.Add(path);
if (result.TryGetValue(path, out var operationSet))
{
operationSet.Add(operation);
Expand All @@ -75,22 +96,30 @@ private Dictionary<string, OperationSet> CategorizeClients()
}

/// <inheritdoc/>
// TODO: generate resources and collections
// TODO: generate collections
protected override TypeProvider[] BuildTypeProviders()
{
if (AzureClientPlugin.Instance.IsAzureArm.Value == true)
{
var armOperation = new MgmtLongRunningOperationProvider(false);
var genericArmOperation = new MgmtLongRunningOperationProvider(true);

// TODO: remove them once they are referenced in Resource operation implementation
AzureClientPlugin.Instance.AddTypeToKeep(armOperation.Name);
AzureClientPlugin.Instance.AddTypeToKeep(genericArmOperation.Name);
return [.. base.BuildTypeProviders(), new RequestContextExtensionsDefinition(), armOperation, genericArmOperation];
return [.. base.BuildTypeProviders(), new RequestContextExtensionsDefinition(), .. BuildLROProviders(), .. BuildResources()];
}
return [.. base.BuildTypeProviders(), new RequestContextExtensionsDefinition()];
}

internal bool IsResource(string name) => _resourceDataBySpecNameMap.ContainsKey(name);
private static TypeProvider[] BuildLROProviders()
{
var armOperation = new MgmtLongRunningOperationProvider(false);
var genericArmOperation = new MgmtLongRunningOperationProvider(true);

// TODO: remove them once they are referenced in Resource operation implementation
AzureClientPlugin.Instance.AddTypeToKeep(armOperation.Name);
AzureClientPlugin.Instance.AddTypeToKeep(genericArmOperation.Name);

return [armOperation, genericArmOperation];
}

internal bool IsResource(string name) => _specNameToOperationSetsMap.ContainsKey(name);

internal Lazy<IEnumerable<OperationSet>> ResourceOperationSets => new(() => _specNameToOperationSetsMap.Values.SelectMany(x => x));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ namespace Azure.Generator.Mgmt.Models
/// </summary>
internal class OperationSet : IReadOnlyCollection<InputOperation>, IEquatable<OperationSet>
{
private readonly InputClient? _inputClient;

/// <summary>
/// The raw request path of string of the operations in this <see cref="OperationSet"/>
/// </summary>
public string RequestPath { get; }

public InputClient InputClient { get; }

/// <summary>
/// The operation set
/// </summary>
private HashSet<InputOperation> _operations;

public int Count => _operations.Count;

public OperationSet(string requestPath, InputClient? inputClient)
public OperationSet(string requestPath, InputClient inputClient)
{
_inputClient = inputClient;
InputClient = inputClient;
RequestPath = requestPath;
_operations = new HashSet<InputOperation>();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Collections.Generic;

namespace Azure.Generator.Mgmt.Models
{
internal class SingletonResourceSuffix
{
public static SingletonResourceSuffix Parse(string[] segments)
{
// put the segments in pairs
var pairs = new List<(string Key, string Value)>();
for (int i = 0; i < segments.Length; i += 2)
{
pairs.Add((segments[i], segments[i + 1]));
}

return new SingletonResourceSuffix(pairs);
}

private IReadOnlyList<(string Key, string Value)> _pairs;

private SingletonResourceSuffix(IReadOnlyList<(string Key, string Value)> pairs)
{
_pairs = pairs;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.Generator.CSharp.Expressions;
using Microsoft.Generator.CSharp.Input;
using Microsoft.Generator.CSharp.Primitives;
using Microsoft.Generator.CSharp.Providers;
using Microsoft.Generator.CSharp.Snippets;
using Microsoft.Generator.CSharp.Statements;
using System;
Expand All @@ -20,6 +21,8 @@ namespace Azure.Generator.Primitives
{
internal static class KnownAzureTypes
{
public static readonly ParameterProvider WaitUntil = new("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>.", new CSharpType(typeof(WaitUntil)));

public delegate MethodBodyStatement SerializationExpression(ValueExpression value, ScopedApi<Utf8JsonWriter> writer, ScopedApi<ModelReaderWriterOptions> options, SerializationFormat format);
public delegate ValueExpression DeserializationExpression(CSharpType valueType, ScopedApi<JsonElement> element, SerializationFormat format);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private class Template<T> { }
public MgmtLongRunningOperationProvider(bool isGeneric)
{
_isGeneric = isGeneric;
_operationField = new FieldProvider(FieldModifiers.Private | FieldModifiers.ReadOnly, isGeneric ? new CSharpType(typeof(OperationInternal), _t) : typeof(OperationInternal), "_operation", this);
_operationField = new FieldProvider(FieldModifiers.Private | FieldModifiers.ReadOnly, isGeneric ? new CSharpType(typeof(OperationInternal<>), _t) : typeof(OperationInternal), "_operation", this);
_rehydrationTokenField = new FieldProvider(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(RehydrationToken), true), "_completeRehydrationToken", this);
_nextLinkOperationField = new FieldProvider(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(NextLinkOperationImplementation), true), "_nextLinkOperation", this);
_operationIdField = new FieldProvider(FieldModifiers.Private | FieldModifiers.ReadOnly, typeof(string), "_operationId", this);
Expand All @@ -52,7 +52,7 @@ protected override string BuildRelativeFilePath()
string GetFileName() => _isGeneric ? $"{_serviceName}ArmOperationOfT.cs" : $"{Name}.cs";
}

protected override CSharpType[] BuildImplements() => [_isGeneric ? new CSharpType(typeof(ArmOperation), _t) : typeof(ArmOperation)];
protected override CSharpType[] BuildImplements() => [_isGeneric ? new CSharpType(typeof(ArmOperation<>), _t) : typeof(ArmOperation)];

protected override FieldProvider[] BuildFields()
=> [_operationField, _rehydrationTokenField, _nextLinkOperationField, _operationIdField];
Expand All @@ -75,13 +75,13 @@ protected override MethodProvider[] BuildMethods()
this, XmlDocProvider.InheritDocs);

var updateStatusAsyncMethod = new MethodProvider(
new MethodSignature("UpdateStatusAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask), typeof(Response)), null, [KnownParameters.CancellationTokenParameter]),
new MethodSignature("UpdateStatusAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask<>), typeof(Response)), null, [KnownParameters.CancellationTokenParameter]),
_operationField.Invoke("UpdateStatusAsync", [KnownParameters.CancellationTokenParameter]),
this, XmlDocProvider.InheritDocs);

var waitForCompletionResponseMethod = _isGeneric
? new MethodProvider(
new MethodSignature("WaitForCompletion", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(Response), _t), null, [KnownParameters.CancellationTokenParameter]),
new MethodSignature("WaitForCompletion", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(Response<>), _t), null, [KnownParameters.CancellationTokenParameter]),
_operationField.Invoke("WaitForCompletion", [KnownParameters.CancellationTokenParameter]),
this, XmlDocProvider.InheritDocs)
: new MethodProvider(
Expand All @@ -92,7 +92,7 @@ protected override MethodProvider[] BuildMethods()
var timeSpanParameter = new ParameterProvider("pollingInterval", $"The interval between pollings", typeof(TimeSpan));
var waitForCompletionResponseWithPolingMethod = _isGeneric
? new MethodProvider(
new MethodSignature("WaitForCompletion", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(Response), _t), null, [timeSpanParameter, KnownParameters.CancellationTokenParameter]),
new MethodSignature("WaitForCompletion", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(Response<>), _t), null, [timeSpanParameter, KnownParameters.CancellationTokenParameter]),
_operationField.Invoke("WaitForCompletion", [timeSpanParameter, KnownParameters.CancellationTokenParameter]),
this, XmlDocProvider.InheritDocs)
: new MethodProvider(
Expand All @@ -102,21 +102,21 @@ protected override MethodProvider[] BuildMethods()

var waitForCompletionResponseAsyncMethod = _isGeneric
? new MethodProvider(
new MethodSignature("WaitForCompletionAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask), new CSharpType(typeof(Response), _t)), null, [KnownParameters.CancellationTokenParameter]),
new MethodSignature("WaitForCompletionAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask<>), new CSharpType(typeof(Response<>), _t)), null, [KnownParameters.CancellationTokenParameter]),
_operationField.Invoke("WaitForCompletionAsync", [KnownParameters.CancellationTokenParameter]),
this, XmlDocProvider.InheritDocs)
: new MethodProvider(
new MethodSignature("WaitForCompletionResponseAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask), typeof(Response)), null, [KnownParameters.CancellationTokenParameter]),
new MethodSignature("WaitForCompletionResponseAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask<>), typeof(Response)), null, [KnownParameters.CancellationTokenParameter]),
_operationField.Invoke("WaitForCompletionResponseAsync", [KnownParameters.CancellationTokenParameter]),
this, XmlDocProvider.InheritDocs);

var waitForCompletionResponseWithPollingAsyncMethod = _isGeneric
? new MethodProvider(
new MethodSignature("WaitForCompletionAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask), new CSharpType(typeof(Response), _t)), null, [timeSpanParameter, KnownParameters.CancellationTokenParameter]),
new MethodSignature("WaitForCompletionAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask<>), new CSharpType(typeof(Response<>), _t)), null, [timeSpanParameter, KnownParameters.CancellationTokenParameter]),
_operationField.Invoke("WaitForCompletionAsync", [timeSpanParameter, KnownParameters.CancellationTokenParameter]),
this, XmlDocProvider.InheritDocs)
: new MethodProvider(
new MethodSignature("WaitForCompletionResponseAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask), typeof(Response)), null, [timeSpanParameter, KnownParameters.CancellationTokenParameter]),
new MethodSignature("WaitForCompletionResponseAsync", null, MethodSignatureModifiers.Public | MethodSignatureModifiers.Override, new CSharpType(typeof(ValueTask<>), typeof(Response)), null, [timeSpanParameter, KnownParameters.CancellationTokenParameter]),
_operationField.Invoke("WaitForCompletionResponseAsync", [timeSpanParameter, KnownParameters.CancellationTokenParameter]),
this, XmlDocProvider.InheritDocs);

Expand Down Expand Up @@ -192,21 +192,21 @@ private ConstructorProvider BuildInitializationConstructor()
_operationIdField.Assign(This.Invoke(GetOperationIdName, _rehydrationTokenField)).Terminate(),
])),
_operationField.Assign(_isGeneric
? New.Instance(new CSharpType(typeof(OperationInternal), _t), [Static<NextLinkOperationImplementation>().Invoke("Create", sourceParameter, nextLinkOperationVariable), clientDiagnosticsParameter, responseParameter, Literal(Name), Null, New.Instance(typeof(SequentialDelayStrategy))])
? New.Instance(new CSharpType(typeof(OperationInternal<>), _t), [Static<NextLinkOperationImplementation>().Invoke("Create", sourceParameter, nextLinkOperationVariable), clientDiagnosticsParameter, responseParameter, Literal(Name), Null, New.Instance(typeof(SequentialDelayStrategy))])
: New.Instance(typeof(OperationInternal), [nextLinkOperationVariable, clientDiagnosticsParameter, responseParameter, Literal(Name), Null, New.Instance(typeof(SequentialDelayStrategy))])).Terminate(),
};
return new ConstructorProvider(signature, body, this);
}

private ConstructorProvider BuildRehydrationConstructor()
{
var responseParameter = new ParameterProvider("response", $"The operation response", _isGeneric ? new CSharpType(typeof(Response), _t) : typeof(Response));
var responseParameter = new ParameterProvider("response", $"The operation response", _isGeneric ? new CSharpType(typeof(Response<>), _t) : typeof(Response));
var rehydrationTokenParameter = new ParameterProvider("rehydrationToken", $"The token to rehydrate the operation", new CSharpType(typeof(RehydrationToken), true), Null);
var signature = new ConstructorSignature(Type, $"", MethodSignatureModifiers.Internal, [responseParameter, rehydrationTokenParameter], null);
var body = new MethodBodyStatement[]
{
_operationField.Assign(_isGeneric
? Static(new CSharpType(typeof(OperationInternal), _t)).Invoke(nameof(OperationInternal.Succeeded), [responseParameter.Invoke("GetRawResponse"), responseParameter.Property("Value")])
? Static(new CSharpType(typeof(OperationInternal<>), _t)).Invoke(nameof(OperationInternal.Succeeded), [responseParameter.Invoke("GetRawResponse"), responseParameter.Property("Value")])
: Static(typeof(OperationInternal)).Invoke(nameof(OperationInternal.Succeeded), [responseParameter])
).Terminate(),
_rehydrationTokenField.Assign(rehydrationTokenParameter).Terminate(),
Expand Down
Loading
Loading