# coding: utf-8


"""
IGNORE:
    Nutanix Security APIs

    Manage security features, such as encryption, certificates, or platform hardening.  # noqa: E501

    OpenAPI spec version: 4.0.1
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
IGNORE
"""
import pprint
import json
import ast
import re  # noqa: F401

import six
from pathlib import Path
from ntnx_security_py_client.models.common.v1.response.ApiLink import ApiLink  # noqa: F401,E501
from ntnx_security_py_client.models.common.v1.response.ExternalizableAbstractModel import ExternalizableAbstractModel  # noqa: F401,E501
from ntnx_security_py_client.models.iam.v4.authn.BucketsAccessKeyStatusType import BucketsAccessKeyStatusType  # noqa: F401,E501
from ntnx_security_py_client.models.iam.v4.authn.CreationType import CreationType  # noqa: F401,E501

class BucketsAccessKey(ExternalizableAbstractModel):

    """Information of bucket access key.

    :param access_key_name: (:attr:`access_key_name`) Name of the bucket access key.
    :type access_key_name: required
     min=1 chars, max=255 chars
    
    :param secret_access_key: (:attr:`secret_access_key`) This represents secret access key, which will be returned only during access key creation.
    :type secret_access_key: 
    
    
    :param user_id: (:attr:`user_id`) User identifier who owns the bucket access key.
    :type user_id: 
    
    
    :param created_time: (:attr:`created_time`) Creation time for the bucket access key.
    :type created_time: 
    
    
    :param last_updated_by: (:attr:`last_updated_by`) Entity that updated the buckets access key.
    :type last_updated_by: 
    
    
    :param assigned_to: (:attr:`assigned_to`) External client to whom this key is allocated.
    :type assigned_to: 
     min=3 chars, max=255 chars
    
    :param creation_type: (:attr:`creation_type`) 
    :type creation_type: 
    
    
    :param expiry_time: (:attr:`expiry_time`) The expiry time of the buckets access Key.
    :type expiry_time: 
    
    
    :param status: (:attr:`status`) 
    :type status: 
    
    
    :param created_by: (:attr:`created_by`) Service account user who created the buckets access key.
    :type created_by: 
    
    
    :param last_updated_time: (:attr:`last_updated_time`) Creation time for the bucket access key.
    :type last_updated_time: 
    
    

    """
    """
    IGNORE:
    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.
    IGNORE
    """  # noqa: E501
    swagger_types = {
        'access_key_name': 'str',
        'secret_access_key': 'str',
        'user_id': 'str',
        'created_time': 'datetime',
        'last_updated_by': 'str',
        'assigned_to': 'str',
        'creation_type': 'iam.v4.authn.CreationType',
        'expiry_time': 'datetime',
        'status': 'iam.v4.authn.BucketsAccessKeyStatusType',
        'created_by': 'str',
        'last_updated_time': 'datetime',
        'ext_id': 'str',
        'links': 'list[common.v1.response.ApiLink]',
        'tenant_id': 'str',
        '_reserved': 'dict(str, object)',
        '_object_type': 'str',
        '_unknown_fields': 'dict(str, object)',
    }

    attribute_map = {
        'access_key_name': 'accessKeyName',
        'secret_access_key': 'secretAccessKey',
        'user_id': 'userId',
        'created_time': 'createdTime',
        'last_updated_by': 'lastUpdatedBy',
        'assigned_to': 'assignedTo',
        'creation_type': 'creationType',
        'expiry_time': 'expiryTime',
        'status': 'status',
        'created_by': 'createdBy',
        'last_updated_time': 'lastUpdatedTime',
        'ext_id': 'extId',
        'links': 'links',
        'tenant_id': 'tenantId',
        '_reserved': '$reserved',
        '_object_type': '$objectType',
        '_unknown_fields': '$unknownFields',
    }



    def __init__(self, access_key_name=None, secret_access_key=None, user_id=None, created_time=None, last_updated_by=None, assigned_to=None, creation_type=None, expiry_time=None, status=None, created_by=None, last_updated_time=None, ext_id=None, links=None, tenant_id=None, *args, **kwargs):  # noqa: E501
        ExternalizableAbstractModel.__init__(self, ext_id, links, tenant_id, *args, **kwargs)
        self.__access_key_name = None
        self.__secret_access_key = None
        self.__user_id = None
        self.__created_time = None
        self.__last_updated_by = None
        self.__assigned_to = None
        self.__creation_type = None
        self.__expiry_time = None
        self.__status = None
        self.__created_by = None
        self.__last_updated_time = None
        self.discriminator = None
        self.__access_key_name = access_key_name
        if secret_access_key is not None:
            self.__secret_access_key = secret_access_key
        if user_id is not None:
            self.__user_id = user_id
        if created_time is not None:
            self.__created_time = created_time
        if last_updated_by is not None:
            self.__last_updated_by = last_updated_by
        if assigned_to is not None:
            self.__assigned_to = assigned_to
        if creation_type is not None:
            self.__creation_type = creation_type
        if expiry_time is not None:
            self.__expiry_time = expiry_time
        if status is not None:
            self.__status = status
        if created_by is not None:
            self.__created_by = created_by
        if last_updated_time is not None:
            self.__last_updated_time = last_updated_time

    def _initialize_object_type(self):
        return 'iam.v4.authn.BucketsAccessKey'

    def _initialize_object_version(self):
        return 'v4.r1.b1'


    @property
    def access_key_name(self):
        """
        Name of the bucket access key.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__access_key_name

    @access_key_name.setter
    def access_key_name(self, access_key_name):
        if access_key_name is None:
            raise ValueError("Invalid value for `access_key_name`, must not be `None`")  # noqa: E501
        if access_key_name is not None and len(access_key_name) > 255:
            raise ValueError("Invalid value for `access_key_name`, length must be less than or equal to `255`")  # noqa: E501
        if access_key_name is not None and len(access_key_name) < 1:
            raise ValueError("Invalid value for `access_key_name`, length must be greater than or equal to `1`")  # noqa: E501
        if access_key_name is not None and not re.search('^[^<>;\'()&+%\/\\\\\"`]*$', access_key_name):  # noqa: E501
            raise ValueError(r"Invalid value for `access_key_name`, must be a follow pattern or equal to `/^[^<>;'()&+%\/\\\\\"`]*$/`")  # noqa: E501

        self.__access_key_name = access_key_name

    @property
    def secret_access_key(self):
        """
        This represents secret access key, which will be returned only during access key creation.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__secret_access_key

    @secret_access_key.setter
    def secret_access_key(self, secret_access_key):

        self.__secret_access_key = secret_access_key

    @property
    def user_id(self):
        """
        User identifier who owns the bucket access key.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__user_id

    @user_id.setter
    def user_id(self, user_id):
        if user_id is not None and not re.search('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$', user_id):  # noqa: E501
            raise ValueError(r"Invalid value for `user_id`, must be a follow pattern or equal to `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/`")  # noqa: E501

        self.__user_id = user_id

    @property
    def created_time(self):
        """
        Creation time for the bucket access key.

        :type:
                :class:`~datetime`
        """  # noqa: E501
        return self.__created_time

    @created_time.setter
    def created_time(self, created_time):

        self.__created_time = created_time

    @property
    def last_updated_by(self):
        """
        Entity that updated the buckets access key.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__last_updated_by

    @last_updated_by.setter
    def last_updated_by(self, last_updated_by):
        if last_updated_by is not None and not re.search('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$', last_updated_by):  # noqa: E501
            raise ValueError(r"Invalid value for `last_updated_by`, must be a follow pattern or equal to `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/`")  # noqa: E501

        self.__last_updated_by = last_updated_by

    @property
    def assigned_to(self):
        """
        External client to whom this key is allocated.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__assigned_to

    @assigned_to.setter
    def assigned_to(self, assigned_to):
        if assigned_to is not None and len(assigned_to) > 255:
            raise ValueError("Invalid value for `assigned_to`, length must be less than or equal to `255`")  # noqa: E501
        if assigned_to is not None and len(assigned_to) < 3:
            raise ValueError("Invalid value for `assigned_to`, length must be greater than or equal to `3`")  # noqa: E501

        self.__assigned_to = assigned_to

    @property
    def creation_type(self):
        """
        

        :type:
            :class:`~ntnx_security_py_client.models.iam.v4.authn.CreationType`
        """  # noqa: E501
        return self.__creation_type

    @creation_type.setter
    def creation_type(self, creation_type):

        self.__creation_type = creation_type

    @property
    def expiry_time(self):
        """
        The expiry time of the buckets access Key.

        :type:
                :class:`~datetime`
        """  # noqa: E501
        return self.__expiry_time

    @expiry_time.setter
    def expiry_time(self, expiry_time):

        self.__expiry_time = expiry_time

    @property
    def status(self):
        """
        

        :type:
            :class:`~ntnx_security_py_client.models.iam.v4.authn.BucketsAccessKeyStatusType`
        """  # noqa: E501
        return self.__status

    @status.setter
    def status(self, status):

        self.__status = status

    @property
    def created_by(self):
        """
        Service account user who created the buckets access key.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__created_by

    @created_by.setter
    def created_by(self, created_by):
        if created_by is not None and not re.search('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$', created_by):  # noqa: E501
            raise ValueError(r"Invalid value for `created_by`, must be a follow pattern or equal to `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/`")  # noqa: E501

        self.__created_by = created_by

    @property
    def last_updated_time(self):
        """
        Creation time for the bucket access key.

        :type:
                :class:`~datetime`
        """  # noqa: E501
        return self.__last_updated_time

    @last_updated_time.setter
    def last_updated_time(self, last_updated_time):

        self.__last_updated_time = last_updated_time

    def _to_dict(self, sanitize):
        """Returns the model properties as a dict. Omits None properties based on the provided "sanitize" parameter.

        :param sanitize: A flag to omit None properties if set to True
        :type sanitize: bool
        """

        result = {}
        for attr, attr_type in six.iteritems(self.swagger_types):

            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x._to_dict(sanitize) if hasattr(x, "_to_dict") else x,
                    value
                ))
            elif hasattr(value, "_to_dict"):
                result[attr] = value._to_dict(sanitize)
            elif isinstance(value, Path):
                result[attr] = str(value)
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1]._to_dict(sanitize)) if hasattr(item[1], "_to_dict")
                    else (
                        (item[0], str(item[1])) if item[0] == 'path' and '$objectType' in value and value['$objectType'] == 'pathlib.Path'
                        else item
                    ),
                    six.iteritems(value)
                ))
            else:
                if sanitize:
                    if value is not None:
                        result[attr] = value
                else:
                    result[attr] = value
        if issubclass(BucketsAccessKey, dict):
            for key, value in six.iteritems(self):
                result[key] = value

        return result

    def to_dict(self):
        """Returns the model properties as a dictionary"""
        return self._to_dict(False)

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self._to_dict(True))

    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, BucketsAccessKey):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        return not self == other

