# Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 3.3.0


from . import AWSObject
from . import AWSProperty
from troposphere import Tags


VALID_HOMEDIRECTORY_TYPE = ('LOGICAL', 'PATH')


def validate_homedirectory_type(homedirectory_type):
    """Validate HomeDirectoryType for User"""

    if homedirectory_type not in VALID_HOMEDIRECTORY_TYPE:  # NOQA
        raise ValueError("User HomeDirectoryType must be one of: %s" %  # NOQA
                         ", ".join(VALID_HOMEDIRECTORY_TYPE))
    return homedirectory_type


class EndpointDetails(AWSProperty):
    props = {
        'AddressAllocationIds': ([basestring], False),
        'SubnetIds': ([basestring], False),
        'VpcEndpointId': (basestring, False),
        'VpcId': (basestring, False),
    }


class IdentityProviderDetails(AWSProperty):
    props = {
        'InvocationRole': (basestring, True),
        'Url': (basestring, True),
    }


class Server(AWSObject):
    resource_type = "AWS::Transfer::Server"

    props = {
        'Certificate': (basestring, False),
        'EndpointDetails': (EndpointDetails, False),
        'EndpointType': (basestring, False),
        'IdentityProviderDetails': (IdentityProviderDetails, False),
        'IdentityProviderType': (basestring, False),
        'LoggingRole': (basestring, False),
        'Protocols': ([basestring], False),
        'Tags': (Tags, False),
    }


class HomeDirectoryMapEntry(AWSProperty):
    props = {
        'Entry': (basestring, True),
        'Target': (basestring, True),
    }


class User(AWSObject):
    resource_type = "AWS::Transfer::User"

    props = {
        'HomeDirectory': (basestring, False),
        'HomeDirectoryMappings': ([HomeDirectoryMapEntry], False),
        'HomeDirectoryType': (validate_homedirectory_type, False),
        'Policy': (basestring, False),
        'Role': (basestring, True),
        'ServerId': (basestring, True),
        'SshPublicKeys': ([basestring], False),
        'Tags': (Tags, False),
        'UserName': (basestring, True),
    }
