File: consistency_policy.py

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (50 lines) | stat: -rwxr-xr-x 2,465 bytes parent folder | download | duplicates (3)
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
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ConsistencyPolicy(Model):
    """The consistency policy for the DocumentDB database account.

    :param default_consistency_level: The default consistency level and
     configuration settings of the DocumentDB account. Possible values include:
     'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix'
    :type default_consistency_level: str or :class:`DefaultConsistencyLevel
     <azure.mgmt.documentdb.models.DefaultConsistencyLevel>`
    :param max_staleness_prefix: When used with the Bounded Staleness
     consistency level, this value represents the number of stale requests
     tolerated. Accepted range for this value is 1 – 2,147,483,647. Required
     when defaultConsistencyPolicy is set to 'BoundedStaleness'.
    :type max_staleness_prefix: long
    :param max_interval_in_seconds: When used with the Bounded Staleness
     consistency level, this value represents the time amount of staleness (in
     seconds) tolerated. Accepted range for this value is 1 - 100. Required
     when defaultConsistencyPolicy is set to 'BoundedStaleness'.
    :type max_interval_in_seconds: int
    """

    _validation = {
        'default_consistency_level': {'required': True},
        'max_staleness_prefix': {'maximum': 2147483647, 'minimum': 1},
        'max_interval_in_seconds': {'maximum': 100, 'minimum': 1},
    }

    _attribute_map = {
        'default_consistency_level': {'key': 'defaultConsistencyLevel', 'type': 'DefaultConsistencyLevel'},
        'max_staleness_prefix': {'key': 'maxStalenessPrefix', 'type': 'long'},
        'max_interval_in_seconds': {'key': 'maxIntervalInSeconds', 'type': 'int'},
    }

    def __init__(self, default_consistency_level, max_staleness_prefix=None, max_interval_in_seconds=None):
        self.default_consistency_level = default_consistency_level
        self.max_staleness_prefix = max_staleness_prefix
        self.max_interval_in_seconds = max_interval_in_seconds