private createRecipe()

in infra/stack/greengrass/components/sample-logger-componet-construct.ts [41:86]


    private createRecipe(bucket: s3.IBucket, compConfig: any, ruleTopic: string): any {
        const compVersion = compConfig['Version'];
        const bucketKey = this.commonProps.appConfig.Stack.ComponentUpload.BucketPrefix;

        const recipe: any = {
            "RecipeFormatVersion": "2020-01-25",
            "ComponentName": this.compName,
            "ComponentVersion": compVersion,
            "ComponentDescription": `This component's name is ${this.compName}`,
            "ComponentPublisher": "beat",
            "ComponentConfiguration": {
                "DefaultConfiguration": {
                    
                }
            },
            "Manifests": [
                {
                    "Platform": {
                        "os": "linux"
                    },
                    "Lifecycle": {
                        "Setenv": {
                            "COMP_NAME_VERION": `${this.compName}:${compVersion}`,
                            "RULE_TOPIC": ruleTopic,
                            "SLEEP_TIME": '22',
                            "FUNCTION_VERION": `${this.compName}:${compVersion}`,
                        },
                        "Install": {
                            "script": `pip3 install -r {artifacts:decompressedPath}/${this.compName}/requirements.txt`
                        },
                        "Run": {
                            "script": `python3 {artifacts:decompressedPath}/${this.compName}/handler.py`
                        },
                    },
                    "Artifacts": [
                        {
                            "URI": `s3://${bucket.bucketName}/${bucketKey}/${this.compName}/${compVersion}/${this.compName}.zip`,
                            "Unarchive": "ZIP"
                        }
                    ]
                }
            ]
        };

        return recipe;
    }