@@ -1288,6 +1288,7 @@ export const bucketWithWebsiteIac = {
12881288 key : 'my_bucket' ,
12891289 name : 'my-bucket' ,
12901290 website : {
1291+ code : 'tests/fixtures/artifacts/large-artifact.zip' ,
12911292 index : 'index.html' ,
12921293 error_page : '404.html' ,
12931294 error_code : 404 ,
@@ -1298,17 +1299,176 @@ export const bucketWithWebsiteIac = {
12981299
12991300export const bucketWithWebsiteRos = {
13001301 Description : 'my-bucket-service stack' ,
1301- Metadata : { 'ALIYUN::ROS::Interface' : { TemplateTags : [ 'Create by ROS CDK' ] } } ,
1302+ Metadata : {
1303+ 'ALIYUN::ROS::Interface' : {
1304+ TemplateTags : [ 'Create by ROS CDK' ] ,
1305+ } ,
1306+ } ,
13021307 ROSTemplateFormatVersion : '2015-09-01' ,
13031308 Resources : {
1309+ FCFunctionFormy_bucket_bucket_code_deployment : {
1310+ Properties : {
1311+ CAPort : 9000 ,
1312+ Code : {
1313+ OssBucketName : {
1314+ 'Fn::Sub' : expect . any ( String ) ,
1315+ } ,
1316+ OssObjectName : 'c6a72ed7e7e83f01a000b75885758088fa050298a31a1e95d37ac88f08e42315.zip' ,
1317+ } ,
1318+ FunctionName : {
1319+ 'Fn::Join' : [
1320+ '-' ,
1321+ [
1322+ 'ros-cdk' ,
1323+ {
1324+ 'Fn::Select' : [
1325+ 0 ,
1326+ {
1327+ 'Fn::Split' : [
1328+ '-' ,
1329+ {
1330+ Ref : 'ALIYUN::StackId' ,
1331+ } ,
1332+ ] ,
1333+ } ,
1334+ ] ,
1335+ } ,
1336+ ] ,
1337+ ] ,
1338+ } ,
1339+ Handler : 'index.handler' ,
1340+ MemorySize : 128 ,
1341+ Runtime : 'python3.10' ,
1342+ ServiceName : {
1343+ 'Fn::GetAtt' : [ 'FCServiceFormy_bucket_bucket_code_deployment' , 'ServiceName' ] ,
1344+ } ,
1345+ Timeout : 3000 ,
1346+ } ,
1347+ Type : 'ALIYUN::FC::Function' ,
1348+ } ,
1349+ FCRoleFormy_bucket_bucket_code_deployment : {
1350+ Properties : {
1351+ AssumeRolePolicyDocument : {
1352+ Statement : [
1353+ {
1354+ Action : 'sts:AssumeRole' ,
1355+ Effect : 'Allow' ,
1356+ Principal : {
1357+ Service : [ 'fc.aliyuncs.com' ] ,
1358+ } ,
1359+ } ,
1360+ ] ,
1361+ Version : '1' ,
1362+ } ,
1363+ DeletionForce : false ,
1364+ IgnoreExisting : false ,
1365+ Policies : [
1366+ {
1367+ PolicyDocument : {
1368+ Statement : [
1369+ {
1370+ Action : [ 'oss:*' ] ,
1371+ Effect : 'Allow' ,
1372+ Resource : [ '*' ] ,
1373+ } ,
1374+ ] ,
1375+ Version : '1' ,
1376+ } ,
1377+ PolicyName : 'AliyunOSSFullAccess' ,
1378+ } ,
1379+ {
1380+ PolicyDocument : {
1381+ Statement : [
1382+ {
1383+ Action : [ 'log:*' ] ,
1384+ Effect : 'Allow' ,
1385+ Resource : [ '*' ] ,
1386+ } ,
1387+ {
1388+ Action : [ 'ram:CreateServiceLinkedRole' ] ,
1389+ Condition : {
1390+ StringEquals : {
1391+ 'ram:ServiceName' : [
1392+ 'audit.log.aliyuncs.com' ,
1393+ 'alert.log.aliyuncs.com' ,
1394+ 'middlewarelens.log.aliyuncs.com' ,
1395+ 'storagelens.log.aliyuncs.com' ,
1396+ 'ai-lens.log.aliyuncs.com' ,
1397+ 'securitylens.log.aliyuncs.com' ,
1398+ ] ,
1399+ } ,
1400+ } ,
1401+ Effect : 'Allow' ,
1402+ Resource : [ '*' ] ,
1403+ } ,
1404+ ] ,
1405+ Version : '1' ,
1406+ } ,
1407+ PolicyName : 'AliyunLogFullAccess' ,
1408+ } ,
1409+ ] ,
1410+ RoleName : {
1411+ 'Fn::Join' : [
1412+ '-' ,
1413+ [
1414+ 'ros-cdk' ,
1415+ {
1416+ 'Fn::Select' : [
1417+ 0 ,
1418+ {
1419+ 'Fn::Split' : [
1420+ '-' ,
1421+ {
1422+ Ref : 'ALIYUN::StackId' ,
1423+ } ,
1424+ ] ,
1425+ } ,
1426+ ] ,
1427+ } ,
1428+ ] ,
1429+ ] ,
1430+ } ,
1431+ } ,
1432+ Type : 'ALIYUN::RAM::Role' ,
1433+ } ,
1434+ FCServiceFormy_bucket_bucket_code_deployment : {
1435+ Properties : {
1436+ DeletionForce : false ,
1437+ Description : 'FC service for oss deployment by CDK' ,
1438+ Role : {
1439+ 'Fn::GetAtt' : [ 'FCRoleFormy_bucket_bucket_code_deployment' , 'Arn' ] ,
1440+ } ,
1441+ ServiceName : {
1442+ 'Fn::Join' : [
1443+ '-' ,
1444+ [
1445+ 'ros-cdk' ,
1446+ {
1447+ 'Fn::Select' : [
1448+ 0 ,
1449+ {
1450+ 'Fn::Split' : [
1451+ '-' ,
1452+ {
1453+ Ref : 'ALIYUN::StackId' ,
1454+ } ,
1455+ ] ,
1456+ } ,
1457+ ] ,
1458+ } ,
1459+ ] ,
1460+ ] ,
1461+ } ,
1462+ } ,
1463+ Type : 'ALIYUN::FC::Service' ,
1464+ } ,
13041465 my_bucket : {
13051466 Properties : {
1306- BucketName : 'my-bucket' ,
13071467 AccessControl : 'private' ,
1468+ BucketName : 'my-bucket' ,
13081469 DeletionForce : false ,
13091470 EnableOssHdfsService : false ,
13101471 RedundancyType : 'LRS' ,
1311-
13121472 WebsiteConfigurationV2 : {
13131473 ErrorDocument : {
13141474 HttpStatus : '404' ,
@@ -1323,5 +1483,29 @@ export const bucketWithWebsiteRos = {
13231483 } ,
13241484 Type : 'ALIYUN::OSS::Bucket' ,
13251485 } ,
1486+ my_bucket_bucket_code_deployment : {
1487+ Properties : {
1488+ Parameters : {
1489+ destinationBucket : {
1490+ 'Fn::GetAtt' : [ 'my_bucket' , 'Name' ] ,
1491+ } ,
1492+ retainOnCreate : false ,
1493+ sources : [
1494+ {
1495+ bucket : {
1496+ 'Fn::Sub' : expect . any ( String ) ,
1497+ } ,
1498+ fileName : 'large-artifact.zip' ,
1499+ objectKey : '2bfeafed8d3df0d44c235271cdf2aa7d908a3c2757af14a67d33d102847f46fd.zip' ,
1500+ } ,
1501+ ] ,
1502+ } ,
1503+ ServiceToken : {
1504+ 'Fn::GetAtt' : [ 'FCFunctionFormy_bucket_bucket_code_deployment' , 'ARN' ] ,
1505+ } ,
1506+ Timeout : 3000 ,
1507+ } ,
1508+ Type : 'ALIYUN::ROS::CustomResource' ,
1509+ } ,
13261510 } ,
13271511} ;
0 commit comments