From 82f625313c7c229f3e39416ee1a4dae263ad4dd3 Mon Sep 17 00:00:00 2001 From: wzh425 Date: Mon, 20 Mar 2023 20:07:55 +0800 Subject: [PATCH] feat(alert-sdk) : AlarmRuleService Add GetAsync (#509) * feat : add alert sdk * style : global using * reactor : Process pr * feat(alert-sdk) : AlarmRuleService Add GetAsync --- .../Model/AlarmRuleModel.cs | 39 +++++++++++++++++++ .../Service/IAlarmRuleService.cs | 2 + .../Service/AlarmRuleService.cs | 6 +++ 3 files changed, 47 insertions(+) create mode 100644 src/BuildingBlocks/StackSdks/Masa.BuildingBlocks.StackSdks.Alert/Model/AlarmRuleModel.cs diff --git a/src/BuildingBlocks/StackSdks/Masa.BuildingBlocks.StackSdks.Alert/Model/AlarmRuleModel.cs b/src/BuildingBlocks/StackSdks/Masa.BuildingBlocks.StackSdks.Alert/Model/AlarmRuleModel.cs new file mode 100644 index 000000000..b863acbad --- /dev/null +++ b/src/BuildingBlocks/StackSdks/Masa.BuildingBlocks.StackSdks.Alert/Model/AlarmRuleModel.cs @@ -0,0 +1,39 @@ +// Copyright (c) MASA Stack All rights reserved. +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +namespace Masa.BuildingBlocks.StackSdks.Alert.Model; + +public class AlarmRuleModel +{ + public Guid Id { get; set; } + + public AlarmRuleType Type { get; set; } + + public string DisplayName { get; set; } = string.Empty; + + public string ProjectIdentity { get; set; } = string.Empty; + + public string AppIdentity { get; set; } = string.Empty; + + public string ChartYAxisUnit { get; set; } = string.Empty; + + public CheckFrequencyModel CheckFrequency { get; set; } = new(); + + public string WhereExpression { get; set; } = string.Empty; + + public string QueryStr { get; set; } = string.Empty; + + public int ContinuousTriggerThreshold { get; set; } + + public SilenceCycleModel SilenceCycle { get; set; } = new(); + + public bool IsEnabled { get; set; } + + public List LogMonitorItems { get; set; } = new(); + + public List MetricMonitorItems { get; set; } = new(); + + public List Items { get; set; } = new(); + + public string ModifierName { get; set; } = string.Empty; +} diff --git a/src/BuildingBlocks/StackSdks/Masa.BuildingBlocks.StackSdks.Alert/Service/IAlarmRuleService.cs b/src/BuildingBlocks/StackSdks/Masa.BuildingBlocks.StackSdks.Alert/Service/IAlarmRuleService.cs index 9d79f095b..f748e4ce1 100644 --- a/src/BuildingBlocks/StackSdks/Masa.BuildingBlocks.StackSdks.Alert/Service/IAlarmRuleService.cs +++ b/src/BuildingBlocks/StackSdks/Masa.BuildingBlocks.StackSdks.Alert/Service/IAlarmRuleService.cs @@ -10,4 +10,6 @@ public interface IAlarmRuleService Task UpdateAsync(Guid id, AlarmRuleUpsertModel options); Task DeleteAsync(Guid id); + + Task GetAsync(Guid id); } diff --git a/src/Contrib/StackSdks/Masa.Contrib.StackSdks.Alert/Service/AlarmRuleService.cs b/src/Contrib/StackSdks/Masa.Contrib.StackSdks.Alert/Service/AlarmRuleService.cs index 61ba6ef06..c43a45dd1 100644 --- a/src/Contrib/StackSdks/Masa.Contrib.StackSdks.Alert/Service/AlarmRuleService.cs +++ b/src/Contrib/StackSdks/Masa.Contrib.StackSdks.Alert/Service/AlarmRuleService.cs @@ -30,4 +30,10 @@ public async Task DeleteAsync(Guid id) var requestUri = $"{_party}/{id}"; await _caller.DeleteAsync(requestUri, null); } + + public async Task GetAsync(Guid id) + { + var requestUri = $"{_party}/{id}"; + return await _caller.GetAsync(requestUri); + } }