Source code for sdkms.v1.models.key_object

# 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




# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
[docs]class KeyObject(object): """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'name': 'str', 'description': 'str', 'key_size': 'int', 'elliptic_curve': 'EllipticCurve', 'acct_id': 'str', 'group_id': 'str', 'creator': 'CreatorType', 'kid': 'str', 'obj_type': 'ObjectType', 'key_ops': 'list[KeyOperations]', 'custom_metadata': 'dict(str, str)', 'origin': 'ObjectOrigin', 'pub_key': 'bytearray', 'value': 'bytearray', 'enabled': 'bool', 'compliant_with_policies': 'bool', 'created_at': 'str', 'lastused_at': 'str', 'transient_key': 'str', 'never_exportable': 'bool', 'rsa': 'RsaOptions', 'bls': 'BlsOptions', 'kcv': 'str', 'state': 'KeyObjectState', 'history': 'list[HistoryItem]' } attribute_map = { 'name': 'name', 'description': 'description', 'key_size': 'key_size', 'elliptic_curve': 'elliptic_curve', 'acct_id': 'acct_id', 'group_id': 'group_id', 'creator': 'creator', 'kid': 'kid', 'obj_type': 'obj_type', 'key_ops': 'key_ops', 'custom_metadata': 'custom_metadata', 'origin': 'origin', 'pub_key': 'pub_key', 'value': 'value', 'enabled': 'enabled', 'compliant_with_policies': 'compliant_with_policies', 'created_at': 'created_at', 'lastused_at': 'lastused_at', 'transient_key': 'transient_key', 'never_exportable': 'never_exportable', 'rsa': 'rsa', 'bls': 'bls', 'kcv': 'kcv', 'state': 'state', 'history': 'history' }
[docs] def __init__(self, name=None, description=None, key_size=None, elliptic_curve=None, acct_id=None, group_id=None, creator=None, kid=None, obj_type=None, key_ops=None, custom_metadata=None, origin=None, pub_key=None, value=None, enabled=None, compliant_with_policies=None, created_at=None, lastused_at=None, transient_key=None, never_exportable=None, rsa=None, bls=None, kcv=None, state=None, history=None): """ KeyObject - a model defined in Swagger """ self._name = None self._description = None self._key_size = None self._elliptic_curve = None self._acct_id = None self._group_id = None self._creator = None self._kid = None self._obj_type = None self._key_ops = None self._custom_metadata = None self._origin = None self._pub_key = None self._value = None self._enabled = None self._compliant_with_policies = None self._created_at = None self._lastused_at = None self._transient_key = None self._never_exportable = None self._rsa = None self._bls = None self._kcv = None self._state = None self._history = None self.name = name if description is not None: self.description = description if key_size is not None: self.key_size = key_size if elliptic_curve is not None: self.elliptic_curve = elliptic_curve self.acct_id = acct_id if group_id is not None: self.group_id = group_id self.creator = creator if kid is not None: self.kid = kid self.obj_type = obj_type if key_ops is not None: self.key_ops = key_ops if custom_metadata is not None: self.custom_metadata = custom_metadata self.origin = origin if pub_key is not None: self.pub_key = pub_key if value is not None: self.value = value self.enabled = enabled if compliant_with_policies is not None: self.compliant_with_policies = compliant_with_policies self.created_at = created_at self.lastused_at = lastused_at if transient_key is not None: self.transient_key = transient_key self.never_exportable = never_exportable if rsa is not None: self.rsa = rsa if bls is not None: self.bls = bls if kcv is not None: self.kcv = kcv if state is not None: self.state = state if history is not None: self.history = history
@property def name(self): """ Gets the name of this KeyObject. Name of the security object. Type: `str` :setter: Sets the name of this KeyObject. """ return self._name @name.setter def name(self, name): """ Sets the name of this KeyObject. Name of the security object. """ self._name = name @property def description(self): """ Gets the description of this KeyObject. Description of the security object. Type: `str` :setter: Sets the description of this KeyObject. """ return self._description @description.setter def description(self, description): """ Sets the description of this KeyObject. Description of the security object. """ self._description = description @property def key_size(self): """ Gets the key_size of this KeyObject. For objects which are not elliptic curves, this is the size in bits (not bytes) of the object. This field is not returned for elliptic curves. Type: `int` :setter: Sets the key_size of this KeyObject. """ return self._key_size @key_size.setter def key_size(self, key_size): """ Sets the key_size of this KeyObject. For objects which are not elliptic curves, this is the size in bits (not bytes) of the object. This field is not returned for elliptic curves. """ self._key_size = key_size @property def elliptic_curve(self): """ Gets the elliptic_curve of this KeyObject. Type: `EllipticCurve` :setter: Sets the elliptic_curve of this KeyObject. """ return self._elliptic_curve @elliptic_curve.setter def elliptic_curve(self, elliptic_curve): """ Sets the elliptic_curve of this KeyObject. """ self._elliptic_curve = elliptic_curve @property def acct_id(self): """ Gets the acct_id of this KeyObject. Account ID of the account this security object belongs to. Type: `str` :setter: Sets the acct_id of this KeyObject. """ return self._acct_id @acct_id.setter def acct_id(self, acct_id): """ Sets the acct_id of this KeyObject. Account ID of the account this security object belongs to. """ self._acct_id = acct_id @property def group_id(self): """ Gets the group_id of this KeyObject. Group ID of the security group that this security object belongs to. Type: `str` :setter: Sets the group_id of this KeyObject. """ return self._group_id @group_id.setter def group_id(self, group_id): """ Sets the group_id of this KeyObject. Group ID of the security group that this security object belongs to. """ self._group_id = group_id @property def creator(self): """ Gets the creator of this KeyObject. Type: `CreatorType` :setter: Sets the creator of this KeyObject. """ return self._creator @creator.setter def creator(self, creator): """ Sets the creator of this KeyObject. """ self._creator = creator @property def kid(self): """ Gets the kid of this KeyObject. Key ID uniquely identifying this security object. Type: `str` :setter: Sets the kid of this KeyObject. """ return self._kid @kid.setter def kid(self, kid): """ Sets the kid of this KeyObject. Key ID uniquely identifying this security object. """ self._kid = kid @property def obj_type(self): """ Gets the obj_type of this KeyObject. Type: `ObjectType` :setter: Sets the obj_type of this KeyObject. """ return self._obj_type @obj_type.setter def obj_type(self, obj_type): """ Sets the obj_type of this KeyObject. """ self._obj_type = obj_type @property def key_ops(self): """ Gets the key_ops of this KeyObject. Array of key operations enabled for this security object. Type: list[`KeyOperations`] :setter: Sets the key_ops of this KeyObject. """ return self._key_ops @key_ops.setter def key_ops(self, key_ops): """ Sets the key_ops of this KeyObject. Array of key operations enabled for this security object. """ self._key_ops = key_ops @property def custom_metadata(self): """ Gets the custom_metadata of this KeyObject. User-defined metadata for this key. Stored as key-value pairs. Type: map[`str`] :setter: Sets the custom_metadata of this KeyObject. """ return self._custom_metadata @custom_metadata.setter def custom_metadata(self, custom_metadata): """ Sets the custom_metadata of this KeyObject. User-defined metadata for this key. Stored as key-value pairs. """ self._custom_metadata = custom_metadata @property def origin(self): """ Gets the origin of this KeyObject. Type: `ObjectOrigin` :setter: Sets the origin of this KeyObject. """ return self._origin @origin.setter def origin(self, origin): """ Sets the origin of this KeyObject. """ self._origin = origin @property def pub_key(self): """ Gets the pub_key of this KeyObject. This field is returned only for asymmetric keys. It contains the public key. Type: `bytearray` :setter: Sets the pub_key of this KeyObject. """ return self._pub_key @pub_key.setter def pub_key(self, pub_key): """ Sets the pub_key of this KeyObject. This field is returned only for asymmetric keys. It contains the public key. """ if not isinstance(pub_key, bytearray): raise ValueError("Invalid value for `pub_key`, `pub_key` must be a bytearray") self._pub_key = pub_key @property def value(self): """ Gets the value of this KeyObject. This field is returned only for opaque and secret objects. It contains the contents of the object. Type: `bytearray` :setter: Sets the value of this KeyObject. """ return self._value @value.setter def value(self, value): """ Sets the value of this KeyObject. This field is returned only for opaque and secret objects. It contains the contents of the object. """ if not isinstance(value, bytearray): raise ValueError("Invalid value for `value`, `value` must be a bytearray") self._value = value @property def enabled(self): """ Gets the enabled of this KeyObject. Whether this security object has cryptographic operations enabled. Type: `bool` :setter: Sets the enabled of this KeyObject. """ return self._enabled @enabled.setter def enabled(self, enabled): """ Sets the enabled of this KeyObject. Whether this security object has cryptographic operations enabled. """ self._enabled = enabled @property def compliant_with_policies(self): """ Gets the compliant_with_policies of this KeyObject. Whether this security object is compliant with cryptographic policies or not. Type: `bool` :setter: Sets the compliant_with_policies of this KeyObject. """ return self._compliant_with_policies @compliant_with_policies.setter def compliant_with_policies(self, compliant_with_policies): """ Sets the compliant_with_policies of this KeyObject. Whether this security object is compliant with cryptographic policies or not. """ self._compliant_with_policies = compliant_with_policies @property def created_at(self): """ Gets the created_at of this KeyObject. When this security object was created. Type: `str` :setter: Sets the created_at of this KeyObject. """ return self._created_at @created_at.setter def created_at(self, created_at): """ Sets the created_at of this KeyObject. When this security object was created. """ self._created_at = created_at @property def lastused_at(self): """ Gets the lastused_at of this KeyObject. When this security object was last used. Type: `str` :setter: Sets the lastused_at of this KeyObject. """ return self._lastused_at @lastused_at.setter def lastused_at(self, lastused_at): """ Sets the lastused_at of this KeyObject. When this security object was last used. """ self._lastused_at = lastused_at @property def transient_key(self): """ Gets the transient_key of this KeyObject. Transient key blob. Type: `str` :setter: Sets the transient_key of this KeyObject. """ return self._transient_key @transient_key.setter def transient_key(self, transient_key): """ Sets the transient_key of this KeyObject. Transient key blob. """ self._transient_key = transient_key @property def never_exportable(self): """ Gets the never_exportable of this KeyObject. True if this key's operations have never contained EXPORT. Type: `bool` :setter: Sets the never_exportable of this KeyObject. """ return self._never_exportable @never_exportable.setter def never_exportable(self, never_exportable): """ Sets the never_exportable of this KeyObject. True if this key's operations have never contained EXPORT. """ self._never_exportable = never_exportable @property def rsa(self): """ Gets the rsa of this KeyObject. Type: `RsaOptions` :setter: Sets the rsa of this KeyObject. """ return self._rsa @rsa.setter def rsa(self, rsa): """ Sets the rsa of this KeyObject. """ self._rsa = rsa @property def bls(self): """ Gets the bls of this KeyObject. Type: `BlsOptions` :setter: Sets the bls of this KeyObject. """ return self._bls @bls.setter def bls(self, bls): """ Sets the bls of this KeyObject. """ self._bls = bls @property def kcv(self): """ Gets the kcv of this KeyObject. KCV for the Security Object Type: `str` :setter: Sets the kcv of this KeyObject. """ return self._kcv @kcv.setter def kcv(self, kcv): """ Sets the kcv of this KeyObject. KCV for the Security Object """ self._kcv = kcv @property def state(self): """ Gets the state of this KeyObject. Type: `KeyObjectState` :setter: Sets the state of this KeyObject. """ return self._state @state.setter def state(self, state): """ Sets the state of this KeyObject. """ self._state = state @property def history(self): """ Gets the history of this KeyObject. When a Key Undo Policy is in place, a list of (non-expired) history items is returned. Each history item represents a passed key state that can be reverted to. Type: list[`HistoryItem`] :setter: Sets the history of this KeyObject. """ return self._history @history.setter def history(self, history): """ Sets the history of this KeyObject. When a Key Undo Policy is in place, a list of (non-expired) history items is returned. Each history item represents a passed key state that can be reverted to. """ self._history = history def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, KeyObject): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other