Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么可以';CDK找到这个堆栈了吗?_Python_Amazon Web Services - Fatal编程技术网

Python 为什么可以';CDK找到这个堆栈了吗?

Python 为什么可以';CDK找到这个堆栈了吗?,python,amazon-web-services,Python,Amazon Web Services,我试图在CDK中创建一个用于AWS传输的用户创建堆栈,但出现了一个错误。我没有在CDK中创建传输实例,因此这可能是一个因素 以下是错误: 以下是我如何调用堆栈创建: def make_user(user_name, server_id, ssh_public_key): if "_" in user_name: raise ValueError("user name must be letters, numbers, or -")

我试图在CDK中创建一个用于AWS传输的用户创建堆栈,但出现了一个错误。我没有在CDK中创建传输实例,因此这可能是一个因素

以下是错误:

以下是我如何调用堆栈创建:

def make_user(user_name, server_id, ssh_public_key):
    if "_" in user_name:
        raise ValueError("user name must be letters, numbers, or -")
    app = core.App()
    UserStack(scope=app,
              id='sftp-transfer-user-' + user_name,
              description='SFTP Transfer User for ' + user_name,
              settings=settings,
              env=env,
              user_name=user_name,
              server_id=server_id,
              ssh_public_key=ssh_public_key)
    app.synth()
以下是堆栈本身:

class UserStack(core.Stack):

    def __init__(self, scope: core.Construct, id: str,
                 settings: Settings, **kwargs) -> None:

        super().__init__(scope, id)
        env = settings.get_environment()

        CfnUser(scope,
                id=f"sftp-user-{kwargs['user_name']}",
                role=settings.get_role_arn(),
                server_id=kwargs['server_id'],
                user_name=kwargs['user_name'],
                home_directory_type="LOGICAL",
                home_directory_mappings=[self.MEP("/in", "/sftp-bucket/${Transfer:UserName}/in"),
                                         self.MEP("/out", "/sftp-bucket/${Transfer:UserName}/out"),
                                         self.MEP("/", "/sftp-bucket/${Transfer:UserName}")],
                ssh_public_keys=[kwargs['ssh_public_key']])


    def MEP(self, entry, target):
        return aws_transfer.CfnUser.HomeDirectoryMapEntryProperty(entry=entry, target=target)