public EditCommandBar() { InitializeComponent(); _dispatcher = Window.Current.Dispatcher; FunctionInput.RegisterPropertyChangedCallback(AutoSuggestBox.IsSuggestionListOpenProperty, IsSuggestionListOpenChanged); SizeChanged += OnSizeChanged; }
public ActionResult InsertFunction() { var model = new FunctionInput { TenantId = AbpSession.TenantId }; return(View("Easyman.FwWeb.Views.Admin.EditFunction", model)); }
public static object CreateObjectFromOptionReceived(int id, JObject requestObject) { if (id == 1) { string[] functionParams = CreateFunctionParams(requestObject); FunctionInput functionInputs = new FunctionInput() { MethodName = functionParams[0], UserDataType = functionParams[1], ParamName = functionParams[3] }; return(functionInputs); } if (id == 2) { string[] forLoopParams = CreateForLoopParams(requestObject); ForLoopInput forLoopInputs = new ForLoopInput { MethodName = forLoopParams[0], ArrayName = forLoopParams[1], }; return(forLoopInputs); } if (id == 3) { string[] ifStatementParams = CreateIfStatementParams(requestObject); IfStatementInput ifStatementInputs = new IfStatementInput { MethodName = ifStatementParams[0], PName = ifStatementParams[1], UserInt = ifStatementParams[2], PName2 = ifStatementParams[3] }; return(ifStatementInputs); } if (id == 4) { string[] variableParams = CreateVariableParams(requestObject); VariableInput variableInputs = new VariableInput { MethodName = variableParams[0], DataType = variableParams[1], VarName = variableParams[2], UserData = variableParams[3] }; return(variableInputs); } else { return(null); } }
private static string BuildCurrentSpendObject(string token, FunctionInput input, TraceWriter log) { try { var currentMonthSpend = SpendDuringCurrentMonth(token, input.ArmBillingService, input.SubscriptionId, input.OfferNumber, log, input.CurrentMonth); var percentOfSpend = (int)((currentMonthSpend / input.MonthSpendLimit) * 100); if (percentOfSpend >= 100) { log.Info("sending over budget"); return(JsonConvert.SerializeObject( new { over_budget = true, current_spend = currentMonthSpend, percent_of_spend = percentOfSpend })); } else if (percentOfSpend >= 70) { log.Info("sending over 70%"); return(JsonConvert.SerializeObject( new { over_budget = false, current_spend = currentMonthSpend, percent_of_spend = percentOfSpend })); } else { log.Info("not sending. spend is at " + percentOfSpend); return(null); } } catch (Exception e) { log.Error($"Error retrieving budget details for subscription: {e.Message}"); return(null); } }
public void SavePost(FunctionInput input) { var fun = _functionManager.GetFunction(input.Id) ?? new Function(); fun.Code = input.Code; fun.Name = input.Name; fun.Discribition = input.Discribition; fun.Type = input.Type; fun.CreationTime = DateTime.Now; fun.TenantId = input.TenantId.HasValue ? input.TenantId.Value : 1; fun.Roles = fun.Roles ?? new List <FunctionRole>(); var funId = _functionManager.SaveOrUpdateFunction(fun); _functionManager.SetRoles(funId, input.RoleIds); }
/// <summary> /// A simple function that takes a string and returns both the upper and lower case version of the string. /// </summary> /// <param name="input"></param> /// <param name="context"></param> /// <returns></returns> public string FunctionHandler(FunctionInput input, ILambdaContext context) { var output = ""; output += "**** ifconfig" + Environment.NewLine; output += "ifconfig".Bash() + Environment.NewLine; output += "**** /usr/sbin/route" + Environment.NewLine; output += "/usr/sbin/route".Bash() + Environment.NewLine; output += "**** PING: google.com" + Environment.NewLine; output += "ping -c 4 google.com".Bash() + Environment.NewLine; output += "**** PING: 127.0.0.1" + Environment.NewLine; output += "ping -c 4 127.0.0.1".Bash() + Environment.NewLine; Console.WriteLine(output); return(output); // Console.WriteLine($"input.Url: {input.Url.ToString()}"); // // Setup Selenium driver // ChromeOptions chromeOptions = new ChromeOptions(); // chromeOptions.AddUserProfilePreference("download.prompt_for_download", false); // chromeOptions.AddArgument("--no-sandbox"); // chromeOptions.AddArgument("--headless"); // chromeOptions.AddArgument("--verbose"); // chromeOptions.AddArgument("--disable-dev-shm-usage"); // // Console.WriteLine(input.GoToUrl); // IWebDriver driver = null; // if (input.UseChromeDriver) // { // driver = new ChromeDriver(chromeOptions); // } // if (input.GoToUrl) // { // driver.Navigate().GoToUrl(input.Url); // var about = driver.FindElement(By.LinkText("About")); // Console.WriteLine($"about.Text: {about.Text}"); // } // return input.Url.ToString(); }
public static async Task <string> Run([TimerTrigger("0 30 1 * * *")] TimerInfo myTimer, TraceWriter log) //public static async Task<string> Run([TimerTrigger("* * * * * 1")]TimerInfo myTimer, TraceWriter log) { log.Info($"C# Timer trigger function executed at: {DateTime.Now}"); var input = FunctionInput.GetInput(log); // get the token string token; try { token = await new Tuple <string, string, string>(input.TenantId, input.ApplicationId, input.ApplicationSecret).GetAccessToken(); } catch (Exception e) { log.Error($"Error retrieving access token to subscription {e.Message}"); return(null); } log.Info($"token: {token}"); return(BuildCurrentSpendObject(token, input, log)); }
public static void FunctionHandler(FunctionInput input, ILambdaContext context) { var es_domain = "Insert ES Domain Name Here"; var es_arn = "Insert ES full ARN Here"; var ec2client = new AmazonEC2Client(); var result = ec2client.DescribeInstancesAsync(new DescribeInstancesRequest { InstanceIds = new List <string> { input.Instanceid } }); var publicIP = result.Result.Reservations[0].Instances[0].PublicIpAddress; var newAccessPolicy = $"{{\"Version\":\"2012-10-17\",\"Statement\":[{{\"Effect\":\"Allow\",\"Principal\":{{\"AWS\":\"*\"}},\"Action\":\"es:*\",\"Resource\":\"{es_arn}\",\"Condition\":{{\"IpAddress\":{{\"aws:SourceIp\":[\"{publicIP}\"]}}}}}}]}}"; var esclient = new AmazonElasticsearchClient(); var updateAccessPolicy = esclient.UpdateElasticsearchDomainConfigAsync(new UpdateElasticsearchDomainConfigRequest { DomainName = es_domain, AccessPolicies = newAccessPolicy }).Result; }
/// <summary> /// Return a greeting. /// </summary> /// <param name="input"></param> /// <param name="context"></param> /// <returns></returns> public string FunctionHandler(FunctionInput input, ILambdaContext context) { return($"Hello, {input.Name}!"); }
public void PostsBasedOnOddOrEven(FunctionInput input, ILambdaContext context) { var postId = input.id; var oddOrEvenResult = input.OddOrEvenPostsResult; }