-
Notifications
You must be signed in to change notification settings - Fork 533
Expand file tree
/
Copy pathChangeFeedPolicyDefinition.cs
More file actions
43 lines (38 loc) · 1.45 KB
/
ChangeFeedPolicyDefinition.cs
File metadata and controls
43 lines (38 loc) · 1.45 KB
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
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace Microsoft.Azure.Cosmos.Fluent
{
using System;
/// <summary>
/// <see cref="ChangeFeedPolicy"/> fluent definition.
/// </summary>
public class ChangeFeedPolicyDefinition
{
private readonly ContainerBuilder parent;
private readonly Action<ChangeFeedPolicy> attachCallback;
private TimeSpan changeFeedPolicyRetention;
internal ChangeFeedPolicyDefinition(
ContainerBuilder parent,
TimeSpan retention,
Action<ChangeFeedPolicy> attachCallback)
{
this.parent = parent ?? throw new ArgumentNullException(nameof(parent));
this.attachCallback = attachCallback ?? throw new ArgumentNullException(nameof(attachCallback));
this.changeFeedPolicyRetention = retention;
}
/// <summary>
/// Applies the current definition to the parent.
/// </summary>
/// <returns>An instance of the parent.</returns>
public ContainerBuilder Attach()
{
ChangeFeedPolicy resolutionPolicy = new ChangeFeedPolicy
{
FullFidelityRetention = this.changeFeedPolicyRetention
};
this.attachCallback(resolutionPolicy);
return this.parent;
}
}
}