-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
RehydrationToken.cs
55 lines (46 loc) · 2.21 KB
/
RehydrationToken.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
namespace Azure.Core
{
/// <summary>
/// Represents a token that can be used to rehydrate a long-running operation.
/// </summary>
public readonly partial struct RehydrationToken
{
/// <summary>
/// Gets an ID representing the operation that can be used to poll for
/// the status of the long-running operation.
/// There are cases that operation id is not available, we return "NOT_SET" for unavailable operation id.
/// </summary>
public string Id { get; } = NextLinkOperationImplementation.NotSet;
// Version for this contract itself since we might change the members in the future.
internal string Version { get; } = NextLinkOperationImplementation.RehydrationTokenVersion;
// The below members are used to re-construct <cref="NextLinkOperationImplemenation">.
// Value of <cref="NextLinkOperationImplemenration.HeaderSrouce">.
internal string HeaderSource { get; }
// The polling Uri of the operation.
internal string NextRequestUri { get; }
// The initial Uri of the operation.
internal string InitialUri { get; }
// The Http request method of the operation.
internal RequestMethod RequestMethod { get; }
// The last known location of the operation.
internal string? LastKnownLocation { get; }
// The final state of the operation, could be azure-async-operation, location, original-uri or operation-location.
internal string FinalStateVia { get; }
internal RehydrationToken(string id, string? version, string headerSource, string nextRequestUri, string initialUri, RequestMethod requestMethod, string? lastKnownLocation, string finalStateVia)
{
Id = id;
if (version is not null)
{
Version = version;
}
HeaderSource = headerSource;
NextRequestUri = nextRequestUri;
InitialUri = initialUri;
RequestMethod = requestMethod;
LastKnownLocation = lastKnownLocation;
FinalStateVia = finalStateVia;
}
}
}