Source code for sdkms.v1.models.object_type

# 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 ObjectType(BaseEnumObject): """ Type of security object. Enumeration values:: ObjectType.AES = "AES" ObjectType.DES = "DES" ObjectType.DES3 = "DES3" ObjectType.RSA = "RSA" ObjectType.DSA = "DSA" ObjectType.EC = "EC" ObjectType.BLS = "BLS" ObjectType.OPAQUE = "OPAQUE" ObjectType.HMAC = "HMAC" ObjectType.SECRET = "SECRET" ObjectType.CERTIFICATE = "CERTIFICATE" ObjectType.ROUND5BETA = "ROUND5BETA" ObjectType.LEDABETA = "LEDABETA" 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: ObjectType.FOO or ObjectType("FOO") Get non standard instance of enum: ObjectType("BAR") Enum instance to String value: ObjectType.FOO.value , ObjectType.FOO.name (Gives "FOO") Equality: ObjectType.FOO == ObjectType("FOO") , ObjectType.FOO != ObjectType.BAR Provides str func: str(ObjectType.FOO) == "ObjectType.FOO" Also the class maintains a static dict of values. hence ObjectType.FOO and ObjectType("FOO") are really backed by same data. """ """ Inner class that stores the actual value """ class __ObjectType(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 "ObjectType." + self.__value """ allowed enum values """ AES = __ObjectType("AES") DES = __ObjectType("DES") DES3 = __ObjectType("DES3") RSA = __ObjectType("RSA") DSA = __ObjectType("DSA") EC = __ObjectType("EC") BLS = __ObjectType("BLS") OPAQUE = __ObjectType("OPAQUE") HMAC = __ObjectType("HMAC") SECRET = __ObjectType("SECRET") CERTIFICATE = __ObjectType("CERTIFICATE") ROUND5BETA = __ObjectType("ROUND5BETA") LEDABETA = __ObjectType("LEDABETA") """ dictionary that keeps the enum value mapping for static access """ __VALUES = dict() __VALUES["AES"] = AES __VALUES["DES"] = DES __VALUES["DES3"] = DES3 __VALUES["RSA"] = RSA __VALUES["DSA"] = DSA __VALUES["EC"] = EC __VALUES["BLS"] = BLS __VALUES["OPAQUE"] = OPAQUE __VALUES["HMAC"] = HMAC __VALUES["SECRET"] = SECRET __VALUES["CERTIFICATE"] = CERTIFICATE __VALUES["ROUND5BETA"] = ROUND5BETA __VALUES["LEDABETA"] = LEDABETA
[docs] def __init__(self, name): if name in ObjectType.__VALUES: self.__instance = ObjectType.__VALUES[name] else: new_value = ObjectType.__ObjectType(name) ObjectType.__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 "ObjectType." + 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, ObjectType) or isinstance(self, ObjectType.__ObjectType)) and \ (isinstance(other, ObjectType) or isinstance(other, ObjectType.__ObjectType)): return self.value == other.value return False def __ne__(self, other): if (isinstance(self, ObjectType) or isinstance(self, ObjectType.__ObjectType)) and \ (isinstance(other, ObjectType) or isinstance(other, ObjectType.__ObjectType)): return self.value != other.value return True