-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvoke_lambda.py
More file actions
executable file
·53 lines (37 loc) · 1.45 KB
/
Copy pathinvoke_lambda.py
File metadata and controls
executable file
·53 lines (37 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# SDDC Import/Export for VMware Cloud on AWS
################################################################################
### Copyright 2020-2021 VMware, Inc.
### SPDX-License-Identifier: BSD-2-Clause
################################################################################
import json
import sddc_import_export
# export, import, or export-import
operation = 'export'
# os or s3
export_type = 's3'
# Usually the 'json' folder, but '/tmp' is the only writable folder in Lambda
export_folder = '/tmp'
#Fill in the source org ID
source_org_id = ''
#Fill in the source SDDC ID
source_sddc_id = ''
#Fill in the dest org ID
dest_org_id = ''
#Fill in the dest SDDC ID
dest_sddc_id = ''
#Fill in the source SDDC refresh token
source_refresh_token = ''
#Fill in the dest SDDC refresh token
dest_refresh_token = ''
#Fill in the S3 bucket name
aws_s3_export_bucket = ''
def lambda_handler(event, context):
# TODO implement
print(event)
print(context)
sddc_import_export.main(['-o',f'{operation}','-et',f'{export_type}','-ef',f'{export_folder}','-so',f'{source_org_id}','-ss',f'{source_sddc_id}','-do',f'{dest_org_id}','-ds',f'{dest_sddc_id}','-st',f'{source_refresh_token}','-dt',f'{dest_refresh_token}','-s3b',f'{aws_s3_export_bucket}'])
return {
'statusCode': 200,
'body': json.dumps('Execution complete.')
}
#lambda_handler("x","y")