@@ -412,7 +412,331 @@ export const oneFcWithStageRos = {
412412 } ,
413413 } ,
414414} ;
415-
415+ export const largeCodeRos = {
416+ Description : 'my-demo-service stack' ,
417+ Mappings : {
418+ stages : {
419+ dev : {
420+ account_id : {
421+ Ref : 'account_id' ,
422+ } ,
423+ region : {
424+ Ref : 'region' ,
425+ } ,
426+ } ,
427+ } ,
428+ } ,
429+ Metadata : {
430+ 'ALIYUN::ROS::Interface' : {
431+ TemplateTags : [ 'Create by ROS CDK' ] ,
432+ } ,
433+ } ,
434+ Parameters : {
435+ account_id : {
436+ Default : 1234567890 ,
437+ Type : 'String' ,
438+ } ,
439+ region : {
440+ Default : 'cn-hangzhou' ,
441+ Type : 'String' ,
442+ } ,
443+ } ,
444+ ROSTemplateFormatVersion : '2015-09-01' ,
445+ Resources : {
446+ 'FCFunctionFormy-demo-service_artifacts_code_deployment' : {
447+ Properties : {
448+ CAPort : 9000 ,
449+ Code : {
450+ OssBucketName : {
451+ 'Fn::Sub' : expect . stringContaining ( 'assets-${ALIYUN::Region}' ) ,
452+ } ,
453+ OssObjectName : 'c6a72ed7e7e83f01a000b75885758088fa050298a31a1e95d37ac88f08e42315.zip' ,
454+ } ,
455+ FunctionName : {
456+ 'Fn::Join' : [
457+ '-' ,
458+ [
459+ 'ros-cdk' ,
460+ {
461+ 'Fn::Select' : [
462+ 0 ,
463+ {
464+ 'Fn::Split' : [
465+ '-' ,
466+ {
467+ Ref : 'ALIYUN::StackId' ,
468+ } ,
469+ ] ,
470+ } ,
471+ ] ,
472+ } ,
473+ ] ,
474+ ] ,
475+ } ,
476+ Handler : 'index.handler' ,
477+ MemorySize : 128 ,
478+ Runtime : 'python3.10' ,
479+ ServiceName : {
480+ 'Fn::GetAtt' : [ 'FCServiceFormy-demo-service_artifacts_code_deployment' , 'ServiceName' ] ,
481+ } ,
482+ Timeout : 300 ,
483+ } ,
484+ Type : 'ALIYUN::FC::Function' ,
485+ } ,
486+ 'FCRoleFormy-demo-service_artifacts_code_deployment' : {
487+ Properties : {
488+ AssumeRolePolicyDocument : {
489+ Statement : [
490+ {
491+ Action : 'sts:AssumeRole' ,
492+ Effect : 'Allow' ,
493+ Principal : {
494+ Service : [ 'fc.aliyuncs.com' ] ,
495+ } ,
496+ } ,
497+ ] ,
498+ Version : '1' ,
499+ } ,
500+ DeletionForce : false ,
501+ IgnoreExisting : false ,
502+ Policies : [
503+ {
504+ PolicyDocument : {
505+ Statement : [
506+ {
507+ Action : [ 'oss:*' ] ,
508+ Effect : 'Allow' ,
509+ Resource : [ '*' ] ,
510+ } ,
511+ ] ,
512+ Version : '1' ,
513+ } ,
514+ PolicyName : 'AliyunOSSFullAccess' ,
515+ } ,
516+ {
517+ PolicyDocument : {
518+ Statement : [
519+ {
520+ Action : [ 'log:*' ] ,
521+ Effect : 'Allow' ,
522+ Resource : [ '*' ] ,
523+ } ,
524+ {
525+ Action : [ 'ram:CreateServiceLinkedRole' ] ,
526+ Condition : {
527+ StringEquals : {
528+ 'ram:ServiceName' : [
529+ 'audit.log.aliyuncs.com' ,
530+ 'alert.log.aliyuncs.com' ,
531+ 'middlewarelens.log.aliyuncs.com' ,
532+ 'storagelens.log.aliyuncs.com' ,
533+ 'ai-lens.log.aliyuncs.com' ,
534+ 'securitylens.log.aliyuncs.com' ,
535+ ] ,
536+ } ,
537+ } ,
538+ Effect : 'Allow' ,
539+ Resource : [ '*' ] ,
540+ } ,
541+ ] ,
542+ Version : '1' ,
543+ } ,
544+ PolicyName : 'AliyunLogFullAccess' ,
545+ } ,
546+ ] ,
547+ RoleName : {
548+ 'Fn::Join' : [
549+ '-' ,
550+ [
551+ 'ros-cdk' ,
552+ {
553+ 'Fn::Select' : [
554+ 0 ,
555+ {
556+ 'Fn::Split' : [
557+ '-' ,
558+ {
559+ Ref : 'ALIYUN::StackId' ,
560+ } ,
561+ ] ,
562+ } ,
563+ ] ,
564+ } ,
565+ ] ,
566+ ] ,
567+ } ,
568+ } ,
569+ Type : 'ALIYUN::RAM::Role' ,
570+ } ,
571+ 'FCServiceFormy-demo-service_artifacts_code_deployment' : {
572+ Properties : {
573+ DeletionForce : false ,
574+ Description : 'FC service for oss deployment by CDK' ,
575+ Role : {
576+ 'Fn::GetAtt' : [ 'FCRoleFormy-demo-service_artifacts_code_deployment' , 'Arn' ] ,
577+ } ,
578+ ServiceName : {
579+ 'Fn::Join' : [
580+ '-' ,
581+ [
582+ 'ros-cdk' ,
583+ {
584+ 'Fn::Select' : [
585+ 0 ,
586+ {
587+ 'Fn::Split' : [
588+ '-' ,
589+ {
590+ Ref : 'ALIYUN::StackId' ,
591+ } ,
592+ ] ,
593+ } ,
594+ ] ,
595+ } ,
596+ ] ,
597+ ] ,
598+ } ,
599+ } ,
600+ Type : 'ALIYUN::FC::Service' ,
601+ } ,
602+ gateway_event_api_get__api_hello : {
603+ Properties : {
604+ ApiName : 'gateway_event_api_get__api_hello' ,
605+ GroupId : {
606+ 'Fn::GetAtt' : [ 'my-demo-service_apigroup' , 'GroupId' ] ,
607+ } ,
608+ RequestConfig : {
609+ RequestHttpMethod : 'GET' ,
610+ RequestMode : 'PASSTHROUGH' ,
611+ RequestPath : '/api/hello' ,
612+ RequestProtocol : 'HTTP' ,
613+ } ,
614+ ResultSample : 'ServerlessInsight resultSample' ,
615+ ResultType : 'JSON' ,
616+ ServiceConfig : {
617+ FunctionComputeConfig : {
618+ FcVersion : '3.0' ,
619+ FunctionName : {
620+ 'Fn::GetAtt' : [ 'hello_fn' , 'FunctionName' ] ,
621+ } ,
622+ RoleArn : {
623+ 'Fn::GetAtt' : [ 'my-demo-service_role' , 'Arn' ] ,
624+ } ,
625+ } ,
626+ ServiceProtocol : 'FunctionCompute' ,
627+ } ,
628+ Tags : [
629+ {
630+ Key : 'owner' ,
631+ Value : 'geek-fun' ,
632+ } ,
633+ ] ,
634+ Visibility : 'PRIVATE' ,
635+ } ,
636+ Type : 'ALIYUN::ApiGateway::Api' ,
637+ } ,
638+ hello_fn : {
639+ Properties : {
640+ Code : {
641+ OssBucketName : {
642+ 'Fn::GetAtt' : [ 'my-demo-service_artifacts_bucket' , 'Name' ] ,
643+ } ,
644+ OssObjectName : 'hello_fn/43cb4c356149762dbe507fc1baede172.zip' ,
645+ } ,
646+ EnvironmentVariables : {
647+ NODE_ENV : 'production' ,
648+ } ,
649+ FunctionName : 'hello_fn' ,
650+ Handler : 'index.handler' ,
651+ MemorySize : 128 ,
652+ Runtime : 'nodejs18' ,
653+ Timeout : 10 ,
654+ } ,
655+ Type : 'ALIYUN::FC3::Function' ,
656+ } ,
657+ 'my-demo-service_apigroup' : {
658+ Properties : {
659+ GroupName : 'my-demo-service_apigroup' ,
660+ Tags : [
661+ {
662+ Key : 'owner' ,
663+ Value : 'geek-fun' ,
664+ } ,
665+ ] ,
666+ } ,
667+ Type : 'ALIYUN::ApiGateway::Group' ,
668+ } ,
669+ 'my-demo-service_artifacts_bucket' : {
670+ Properties : {
671+ AccessControl : 'private' ,
672+ BucketName : 'my-demo-service-artifacts-bucket' ,
673+ DeletionForce : false ,
674+ EnableOssHdfsService : false ,
675+ RedundancyType : 'LRS' ,
676+ ServerSideEncryptionConfiguration : {
677+ SSEAlgorithm : 'KMS' ,
678+ } ,
679+ } ,
680+ Type : 'ALIYUN::OSS::Bucket' ,
681+ } ,
682+ 'my-demo-service_artifacts_code_deployment' : {
683+ Properties : {
684+ Parameters : {
685+ destinationBucket : {
686+ 'Fn::GetAtt' : [ 'my-demo-service_artifacts_bucket' , 'Name' ] ,
687+ } ,
688+ retainOnCreate : false ,
689+ sources : [
690+ {
691+ bucket : { 'Fn::Sub' : expect . stringContaining ( 'assets-${ALIYUN::Region}' ) } ,
692+ fileName : 'hello_fn/43cb4c356149762dbe507fc1baede172.ziplarge-artifact.zip' ,
693+ objectKey : '2bfeafed8d3df0d44c235271cdf2aa7d908a3c2757af14a67d33d102847f46fd.zip' ,
694+ } ,
695+ ] ,
696+ } ,
697+ ServiceToken : {
698+ 'Fn::GetAtt' : [ 'FCFunctionFormy-demo-service_artifacts_code_deployment' , 'ARN' ] ,
699+ } ,
700+ Timeout : 300 ,
701+ } ,
702+ Type : 'ALIYUN::ROS::CustomResource' ,
703+ } ,
704+ 'my-demo-service_role' : {
705+ Properties : {
706+ AssumeRolePolicyDocument : {
707+ Statement : [
708+ {
709+ Action : 'sts:AssumeRole' ,
710+ Effect : 'Allow' ,
711+ Principal : {
712+ Service : [ 'apigateway.aliyuncs.com' ] ,
713+ } ,
714+ } ,
715+ ] ,
716+ Version : '1' ,
717+ } ,
718+ Description : 'my-demo-service role' ,
719+ Policies : [
720+ {
721+ PolicyDocument : {
722+ Statement : [
723+ {
724+ Action : [ 'fc:InvokeFunction' ] ,
725+ Effect : 'Allow' ,
726+ Resource : [ '*' ] ,
727+ } ,
728+ ] ,
729+ Version : '1' ,
730+ } ,
731+ PolicyName : 'my-demo-service-policy' ,
732+ } ,
733+ ] ,
734+ RoleName : 'my-demo-service-gateway-access-role' ,
735+ } ,
736+ Type : 'ALIYUN::RAM::Role' ,
737+ } ,
738+ } ,
739+ } ;
416740export const defaultContext = {
417741 accessKeyId : 'access key id' ,
418742 accessKeySecret : 'access key secret' ,
0 commit comments