public override void ExecuteCmdlet() { PSRulesAttributes ruleAttributes = new PSRulesAttributes(); if (!string.IsNullOrEmpty(SqlExpression)) { ruleAttributes.SqlFilter.SqlExpression = SqlExpression; } if (!string.IsNullOrEmpty(ActionSqlExpression)) { ruleAttributes.Action.SqlExpression = ActionSqlExpression; } if (RequiresPreprocessing.IsPresent) { ruleAttributes.Action.RequiresPreprocessing = true; } if (ShouldProcess(target: Name, action: string.Format(Resources.CreateRule, Name, Topic, Namespace))) { try { WriteObject(Client.CreateUpdateRules(ResourceGroupName, Namespace, Topic, Subscription, Name, ruleAttributes)); } catch (ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } } }
public override void ExecuteCmdlet() { try { if (!string.IsNullOrEmpty(Name)) { PSRulesAttributes ruleAttributes = Client.GetRule(ResourceGroupName, Namespace, Topic, Subscription, Name); WriteObject(ruleAttributes); } else { if (MaxCount.HasValue) { IEnumerable <PSRulesAttributes> ruleAttributes = Client.ListRules(ResourceGroupName, Namespace, Topic, Subscription, MaxCount); WriteObject(ruleAttributes, true); } else { IEnumerable <PSRulesAttributes> ruleAttributes = Client.ListRules(ResourceGroupName, Namespace, Topic, Subscription); WriteObject(ruleAttributes, true); } } } catch (Management.ServiceBus.Models.ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } }
public override void ExecuteCmdlet() { if (!string.IsNullOrEmpty(Name)) { PSRulesAttributes ruleAttributes = Client.GetRule(ResourceGroupName, Namespace, Topic, Subscription, Name); WriteObject(ruleAttributes); } else { IEnumerable <PSRulesAttributes> ruleAttributes = Client.ListRules(ResourceGroupName, Namespace, Topic, Subscription); WriteObject(ruleAttributes, true); } }
public override void ExecuteCmdlet() { PSRulesAttributes ruleAttributes = new PSRulesAttributes(); if (!string.IsNullOrEmpty(SqlExpression)) { ruleAttributes.SqlFilter.SqlExpression = SqlExpression; } if (ShouldProcess(target: Name, action: string.Format(Resources.CreateRule, Name, Topic, Namespace))) { WriteObject(Client.CreateUpdateRules(ResourceGroupName, Namespace, Topic, Subscription, Name, ruleAttributes)); } }
public override void ExecuteCmdlet() { PSRulesAttributes rulesAttributes = new PSRulesAttributes(); if (InputObject != null) { rulesAttributes = InputObject; } if (ShouldProcess(target: Name, action: string.Format(Resources.UpdateRule, Name, Namespace))) { WriteObject(Client.CreateUpdateRules(ResourceGroupName, Namespace, Topic, Subscription, Name, rulesAttributes)); } }
public override void ExecuteCmdlet() { PSRulesAttributes rulesAttributes = new PSRulesAttributes(); if (InputObject != null) { rulesAttributes = InputObject; } if (ShouldProcess(target: Name, action: string.Format(Resources.UpdateRule, Name, Namespace))) { try { WriteObject(Client.CreateUpdateRules(ResourceGroupName, Namespace, Topic, Subscription, Name, rulesAttributes)); } catch (ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } } }
public PSRulesAttributes CreateUpdateRules(string resourceGroupName, string namespaceName, string topicName, string subscriptionName, string ruleName, PSRulesAttributes ruleAttributes) { var parameters = new Rule(); parameters.FilterType = ruleAttributes.FilterType; parameters.Action = new Management.ServiceBus.Models.Action() { SqlExpression = ruleAttributes.Action.SqlExpression, CompatibilityLevel = ruleAttributes.Action.CompatibilityLevel, RequiresPreprocessing = ruleAttributes.Action.RequiresPreprocessing }; if (ruleAttributes.FilterType.ToString().Equals("SqlFilter")) { parameters.SqlFilter = new SqlFilter() { RequiresPreprocessing = ruleAttributes.SqlFilter.RequiresPreprocessing, SqlExpression = ruleAttributes.SqlFilter.SqlExpression } } ; if (ruleAttributes.FilterType.ToString().Equals("CorrelationFilter")) { parameters.CorrelationFilter = new CorrelationFilter() { CorrelationId = ruleAttributes.CorrelationFilter.CorrelationId, MessageId = ruleAttributes.CorrelationFilter.MessageId, To = ruleAttributes.CorrelationFilter.To, ReplyTo = ruleAttributes.CorrelationFilter.ReplyTo, Label = ruleAttributes.CorrelationFilter.Label, SessionId = ruleAttributes.CorrelationFilter.SessionId, ReplyToSessionId = ruleAttributes.CorrelationFilter.ReplyToSessionId, ContentType = ruleAttributes.CorrelationFilter.ContentType, RequiresPreprocessing = ruleAttributes.CorrelationFilter.RequiresPreprocessing, Properties = ruleAttributes.CorrelationFilter.Properties }; } var response = Client.Rules.CreateOrUpdate(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, parameters); return(new PSRulesAttributes(response)); }
public PSRulesAttributes CreateUpdateRules(string resourceGroupName, string namespaceName, string topicName, string subscriptionName, string ruleName, PSRulesAttributes ruleAttributes) { var parameters = new Rule() { Action = new Management.ServiceBus.Models.Action(), SqlFilter = new SqlFilter() { RequiresPreprocessing = ruleAttributes.SqlFilter.RequiresPreprocessing, SqlExpression = ruleAttributes.SqlFilter.SqlExpression }, CorrelationFilter = new CorrelationFilter() { CorrelationId = ruleAttributes.CorrelationFilter.CorrelationId, MessageId = ruleAttributes.CorrelationFilter.MessageId, To = ruleAttributes.CorrelationFilter.To, ReplyTo = ruleAttributes.CorrelationFilter.ReplyTo, Label = ruleAttributes.CorrelationFilter.Label, SessionId = ruleAttributes.CorrelationFilter.SessionId, ReplyToSessionId = ruleAttributes.CorrelationFilter.ReplyToSessionId, ContentType = ruleAttributes.CorrelationFilter.ContentType, RequiresPreprocessing = ruleAttributes.CorrelationFilter.RequiresPreprocessing, } }; var response = Client.Rules.CreateOrUpdate(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, parameters); return(new PSRulesAttributes(response)); }