ASWDataSync-在DataSync任务执行期间添加文件的情景
创始人
2024-09-20 23:01:13
0

AWS DataSync是一种服务,可以在AWS中安全快速地传输数据。使用AWS DataSync可以在两个地点之间安全地传输和同步文件,S3存储桶和EFS存储卷。如果需要在DataSync任务执行期间添加文件,则可以使用AWS SDK for Python(Boto3)来完成此操作。

以下示例代码演示如何在DataSync任务执行期间添加文件:

import boto3

client = boto3.client('datasync')

# Start a DataSync task
response = client.start_task_execution(
    TaskArn='',
    OverrideOptions={
        'VerifyMode': 'ONLY_FILES_TRANSFERRED',
        #add ACL for the file using below option
        'Atime': 'NONE',
        'Mtime': 'NONE',
        'Uid': 'NONE',
        'Gid': 'NONE',
        'PreserveDeletedFiles': 'PRESERVE',
        'PreserveDevices': 'NONE',
        'PosixPermissions': 'NONE',
        'BytesPerSecond': 268435456
    }
)

# Add a new file to the source location while the task is executing
result = client.create_location_object_storage(
    ServerHostname='',
    ServerPort=,
    ServerProtocol='HTTPS',
    BucketName='',
    AccessKey='',
    SecretKey=''
)

# Get the location ARN of the source object storage location
location_source_arn = result['LocationArn']

# Generate a list of dict objects representing the files to be transferred
transfer_list = [
    {
        'SourceLocationArn': location_source_arn,
        'DestinationLocationArn': '',
        'OverwriteMode': 'ALWAYS',
        'Source': {
            'BucketName': '',
            'Key': '',
        },
    }
]

# Add the new file to the list of files to be transferred
response = client.update_task(
    TaskArn='',
    Includes={
        'Files': transfer_list
    }
)

在上面的示例代码中,我们启动了一个传输任务,然后在任务执行期间添加了文件。您可以通过“update_task”函数将文件添加到待传输文件的列表中。同时,您还可以使用“OverrideOptions”参数控制ACL的传输以便文件的访问权限。

相关内容

热门资讯

智星德州菠萝辅助,wepoke... 一、wepoke ai辅助简介了解软件请加微:136704302wepoke ai辅助是一款在线扑克...
wpok透牌器,wepoke软... wpok透牌器,wepoke软件透明演示,智星德州菠萝外挂1、在wepoke软件透明演示ai机器人技...
wpkai辅助,微扑克辅助提高... wpkai辅助,微扑克辅助提高胜率,智星德州辅助器;人气非常高,ai更新快且高清可以动的一个微扑克辅...
微扑克透明挂,wepoke有哪... 微扑克透明挂,wepoke有哪些功能,智星德州菠萝辅助;致您一封信;亲爱wepoke有哪些功能玩家:...
aa poker智能ai辅助价... 自定义wepoke有插件吗系统规律,只需要输入自己想要的开挂功能,一键便可以生成出微扑克专用辅助器,...
德扑ai代打可靠吗,wepok... 德扑ai代打可靠吗,wepoke有挂吗网上靠谱吗,智星德州菠萝偷偷看牌功能您好,wepoke有挂吗网...
wepoke透明挂操作技巧,微... wepoke透明挂操作技巧,微扑克辅助插件挂,智星德州菠萝外挂(1)wepoke透明挂操作技巧,微扑...
wpkai机器人的打法,wep... wpkai机器人的打法,wepoke智能ai,智星菠萝德州有挂吗(1)wpkai机器人的打法,wep...
wpk透视辅助可测试真的假的,... wpk透视辅助可测试真的假的,wepoke软件透明演示,智星菠萝德州有挂吗(1)wpk透视辅助可测试...
WePoKe有挂吗,wpk透视... WePoKe有挂吗,wpk透视辅助测试,智星菠萝德州有挂吗是一款可以让一直输的玩家,快速成为一个“必...