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的传输以便文件的访问权限。

相关内容

热门资讯

透视苹果版!wepoker透视... 自定义wepoker透视底牌脚本系统规律,只需要输入自己想要的开挂功能,一键便可以生成出微扑克专用辅...
透视教学!红龙poker作弊指... 您好,红龙poker作弊指令这款游戏可以开挂的,确实是有挂的,需要了解加微【136704302】很多...
透视总结!hhpoker透视脚... 透视总结!hhpoker透视脚本,wpk显示有作弊,可靠技巧(从前有挂);值得一提的是,hhpoke...
透视攻略!wepoker底牌透... 透视攻略!wepoker底牌透视脚本怎样安装,德普之星透视辅助,发现一款(有挂教程)1、构建自己的微...
透视计算!wepoker透视脚... 自定义wepoker透视脚本安卓系统规律,只需要输入自己想要的开挂功能,一键便可以生成出微扑克专用辅...
透视辅助!wepoker透视版... 透视辅助!wepoker透视版下载,智星菠萝辅助怎么买,玩家分析(有挂透明)是一款可以让一直输的玩家...
透视透视!德普之星透视辅助软件... 透视透视!德普之星透视辅助软件是真的吗,wepoker黑侠破解,德州教程(果然有挂);玩家必备必赢加...
透视好友房!wpk透视脚本视频... 1、透视好友房!wpk透视脚本视频,wepoker脚本,推荐一款(有挂详情);该软件可以轻松地帮助玩...
透视黑科技!aapoker辅助... 透视黑科技!aapoker辅助是真的吗,wpk软件是正规的吗,2025新版教程(好像存在有挂);aa...
透视科技!aapoker辅助器... 透视科技!aapoker辅助器是真的吗,hhpoker免费透视脚本,来一盘(有挂规律)1、在aapo...