コード例 #1
0
        public async Task <string> Cron(ILambdaContext context)
        {
            string invokeFunction = context.InvokedFunctionArn.Replace("cron", "action");

            context.Logger.LogLine($"function to invoke {invokeFunction}");
            List <string> dnsNames = await GetPicassoApiPublicDns(context);

            context.Logger.LogLine(String.Join(",", dnsNames));
            if (dnsNames != null && dnsNames.Count > 0)
            {
                await FunctionHelper.Trigger(dnsNames, 0, invokeFunction);
            }

            return($"Starting performance checks on {String.Join(",",dnsNames)}");
        }
コード例 #2
0
        public async Task Action(ActionRequest request, ILambdaContext context)
        {
            string path  = System.Environment.GetEnvironmentVariable("path");
            string s3url = System.Environment.GetEnvironmentVariable("s3url");

            using (HttpClient client = new HttpClient())
            {
                string url = $"{request.URLs[request.Index]}/{path}?s3url={s3url}";
                context.Logger.LogLine(url);
                var response = await client.GetAsync(url);

                context.Logger.LogLine(response.ToString());
            }
            request.Index++;
            if (request.URLs.Count > request.Index)
            {
                await FunctionHelper.Trigger(request.URLs, request.Index, context.InvokedFunctionArn);
            }
        }