public void GetAutomationRule() { SmartsheetClient ss = HelperFunctions.SetupClient("Get Automation Rule"); AutomationRule automationRule = ss.SheetResources.AutomationRuleResources.GetAutomationRule(324, 284); Assert.AreEqual(284, (long)automationRule.Id); }
public void AutomationRules_CreateorUpdate() { using (var context = MockContext.Start(this.GetType())) { var SecurityInsightsClient = TestHelper.GetSecurityInsightsClient(context); var AutomationRuleId = Guid.NewGuid().ToString(); var AutomationRuleTriggeringLogic = new AutomationRuleTriggeringLogic() { IsEnabled = false }; var ActionConfiguration = new AutomationRuleRunPlaybookActionActionConfiguration() { LogicAppResourceId = TestHelper.ActionLAResourceID, TenantId = TestHelper.TestEnvironment.Tenant }; var AutomationRuleAction = new AutomationRuleRunPlaybookAction() { Order = 1, ActionConfiguration = ActionConfiguration }; var AutomationRuleActions = new List <AutomationRuleAction>(); AutomationRuleActions.Add(AutomationRuleAction); var AutomationRuleProperties = new AutomationRule() { DisplayName = "SDK Test", Order = 1, TriggeringLogic = AutomationRuleTriggeringLogic, Actions = AutomationRuleActions }; var AutomationRule = SecurityInsightsClient.AutomationRules.CreateOrUpdate(TestHelper.ResourceGroup, TestHelper.WorkspaceName, AutomationRuleId, AutomationRuleProperties); ValidateAutomationRule(AutomationRule); SecurityInsightsClient.AutomationRules.Delete(TestHelper.ResourceGroup, TestHelper.WorkspaceName, AutomationRuleId); } }
private static AutomationRule GetDefaultAutomationRuleProperties() { var AutomationRuleTriggeringLogic = new AutomationRuleTriggeringLogic() { IsEnabled = false }; var ActionConfiguration = new PlaybookActionProperties() { LogicAppResourceId = TestHelper.ActionLAResourceID, TenantId = Guid.Parse(TestHelper.TestEnvironment.Tenant) }; var AutomationRuleAction = new AutomationRuleRunPlaybookAction() { Order = 1, ActionConfiguration = ActionConfiguration }; var AutomationRuleActions = new List <AutomationRuleAction>(); AutomationRuleActions.Add(AutomationRuleAction); var AutomationRuleProperties = new AutomationRule() { DisplayName = "SDK Test", Order = 1, TriggeringLogic = AutomationRuleTriggeringLogic, Actions = AutomationRuleActions }; return(AutomationRuleProperties); }
public void UpdateAutomationRule() { SmartsheetClient ss = HelperFunctions.SetupClient("Update Automation Rule"); AutomationAction autoRuleAction = new AutomationAction(); Recipient recipient = new Recipient(); recipient.Email = "*****@*****.**"; autoRuleAction.Recipients = new Recipient[] { recipient }; autoRuleAction.Type = AutomationActionType.NOTIFICATION_ACTION; autoRuleAction.Frequency = AutomationActionFrequency.WEEKLY; AutomationRule autoRule = new AutomationRule(); autoRule.Id = 284; autoRule.Action = autoRuleAction; AutomationRule automationRule = ss.SheetResources.AutomationRuleResources.UpdateAutomationRule(324, autoRule); }
/// <summary> /// Creates or updates the automation rule. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='workspaceName'> /// The name of the workspace. /// </param> /// <param name='automationRuleId'> /// Automation rule ID /// </param> /// <param name='automationRule'> /// The automation rule /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <AutomationRule> CreateOrUpdateAsync(this IAutomationRulesOperations operations, string resourceGroupName, string workspaceName, string automationRuleId, AutomationRule automationRule, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, automationRuleId, automationRule, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Creates or updates the automation rule. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='workspaceName'> /// The name of the workspace. /// </param> /// <param name='automationRuleId'> /// Automation rule ID /// </param> /// <param name='automationRule'> /// The automation rule /// </param> public static AutomationRule CreateOrUpdate(this IAutomationRulesOperations operations, string resourceGroupName, string workspaceName, string automationRuleId, AutomationRule automationRule) { return(operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, automationRuleId, automationRule).GetAwaiter().GetResult()); }
/// <summary> /// <para>Updates an automation rule for this sheet.</para> /// <para>Mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/automationrules/{automationRuleId}</para> /// </summary> /// <param name="sheetId"> the Id of the sheet </param> /// <param name="automationRule"> the automation rule </param> /// <returns> the automation rule </returns> /// <exception cref="System.InvalidOperationException"> if any argument is null or an empty string </exception> /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception> /// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception> /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception> /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception> /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception> public virtual AutomationRule UpdateAutomationRule(long sheetId, AutomationRule automationRule) { return(this.UpdateResource("sheets/" + sheetId + "/automationrules/" + automationRule.Id, typeof(AutomationRule), automationRule)); }
private void ValidateAutomationRule(AutomationRule AutomationRule) { Assert.NotNull(AutomationRule); }