private static async Task <RuleSet> CreateRuleSet(LoadBalancerClient lbClient, string loadBalancerId) { logger.Info($"Creating new rule set: {RuleSetName}"); List <Rule> rules = new List <Rule>(); var addHttpRequestHeaderRule = new AddHttpRequestHeaderRule { Header = "someRequestHeader", Value = "/example/1" }; var extendHttpRequestHeaderValueRule = new ExtendHttpRequestHeaderValueRule { Header = "someRequestHeader", Suffix = "Some-static-suffix-value", Prefix = "Some-static-prefix-value" }; var removeHttpResponseHeaderRule = new RemoveHttpResponseHeaderRule { Header = "someResponseHeader" }; rules.Add(addHttpRequestHeaderRule); rules.Add(extendHttpRequestHeaderValueRule); rules.Add(removeHttpResponseHeaderRule); var createRuleSetDetails = new CreateRuleSetDetails { Name = RuleSetName, Items = rules }; var createRuleSetRequest = new CreateRuleSetRequest { CreateRuleSetDetails = createRuleSetDetails, LoadBalancerId = loadBalancerId }; var createRuleSetResponse = await lbClient.CreateRuleSet(createRuleSetRequest); var waiterConfiguration = new WaiterConfiguration { MaxAttempts = 20, GetNextDelayInSeconds = DelayStrategy.GetExponentialDelayInSeconds }; var getWorkRequestRequest = new GetWorkRequestRequest { WorkRequestId = createRuleSetResponse.OpcWorkRequestId }; lbClient.Waiters.ForWorkRequest(getWorkRequestRequest, waiterConfiguration, WorkRequest.LifecycleStateEnum.Succeeded).Execute(); logger.Info($"RuleSet: {RuleSetName} is created"); var getRuleSetRequest = new GetRuleSetRequest { LoadBalancerId = loadBalancerId, RuleSetName = RuleSetName }; var getRuleSetResponse = await lbClient.GetRuleSet(getRuleSetRequest); return(getRuleSetResponse.RuleSet); }