Source code for sdkms.v1.models.fpe_date_part

# coding: utf-8

"""
    Fortanix DSM REST API

    This is a set of REST APIs for accessing the Fortanix Data Security Manager. This includes APIs for managing accounts, and for performing cryptographic and key management operations. 

    OpenAPI spec version: 1.0.0-20200608
    Contact: support@fortanix.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    
        http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""


from pprint import pformat
from six import iteritems
import re

from .base_enum_object import BaseEnumObject

# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
[docs]class FpeDatePart(BaseEnumObject): """ Possible date-related constraint types that do not form a complete date (by themselves) for a complex tokenization data type. The part should be a numeric encrypted part that is guaranteed to either preserve all of its digits or preserve none of them, and cannot be involved in any Luhn-check constraints. Day and Month parts must have their `min_length` fields be at least 1 and their `max_length` field be exactly 2. Additionally, any leading zeros should be removed (unless required due to length restrictions). Year parts must be two to five digits long. Enumeration values:: FpeDatePart.MONTH = "month" FpeDatePart.DAY = "day" FpeDatePart.YEAR = "year" This class doesnt use python standard enumeration since they dont support unknown values. This is an object of type BaseEnumObject and provides similar functionality as a String Enumeration:: Get a standard instance of enum: FpeDatePart.FOO or FpeDatePart("FOO") Get non standard instance of enum: FpeDatePart("BAR") Enum instance to String value: FpeDatePart.FOO.value , FpeDatePart.FOO.name (Gives "FOO") Equality: FpeDatePart.FOO == FpeDatePart("FOO") , FpeDatePart.FOO != FpeDatePart.BAR Provides str func: str(FpeDatePart.FOO) == "FpeDatePart.FOO" Also the class maintains a static dict of values. hence FpeDatePart.FOO and FpeDatePart("FOO") are really backed by same data. """ """ Inner class that stores the actual value """ class __FpeDatePart(BaseEnumObject): def __init__(self, value): self.__value = value @property def value(self): return self.__value @property def name(self): return self.__value def __str__(self): return "FpeDatePart." + self.__value """ allowed enum values """ MONTH = __FpeDatePart("month") DAY = __FpeDatePart("day") YEAR = __FpeDatePart("year") """ dictionary that keeps the enum value mapping for static access """ __VALUES = dict() __VALUES["month"] = MONTH __VALUES["day"] = DAY __VALUES["year"] = YEAR
[docs] def __init__(self, name): if name in FpeDatePart.__VALUES: self.__instance = FpeDatePart.__VALUES[name] else: new_value = FpeDatePart.__FpeDatePart(name) FpeDatePart.__VALUES[name] = new_value self.__instance = new_value
@property def value(self): return self.__instance.value @property def name(self): return self.__instance.name def __str__(self): return "FpeDatePart." + self.__instance.name """ This is to ensure equals work for both static defined values and client defined ones. """ def __eq__(self, other): if (isinstance(self, FpeDatePart) or isinstance(self, FpeDatePart.__FpeDatePart)) and \ (isinstance(other, FpeDatePart) or isinstance(other, FpeDatePart.__FpeDatePart)): return self.value == other.value return False def __ne__(self, other): if (isinstance(self, FpeDatePart) or isinstance(self, FpeDatePart.__FpeDatePart)) and \ (isinstance(other, FpeDatePart) or isinstance(other, FpeDatePart.__FpeDatePart)): return self.value != other.value return True