github.com/cloudwan/edgelq-sdk@v1.15.4/alerting/resources/v1/alert/alert.pb.view.go (about) 1 // Code generated by protoc-gen-goten-resource 2 // Resource: Alert 3 // DO NOT EDIT!!! 4 5 package alert 6 7 import ( 8 googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 9 10 "github.com/cloudwan/goten-sdk/types/view" 11 ) 12 13 // proto imports 14 import ( 15 rcommon "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/common" 16 log_condition "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/log_condition" 17 notification_channel "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/notification_channel" 18 ts_condition "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/ts_condition" 19 meta "github.com/cloudwan/goten-sdk/types/meta" 20 durationpb "google.golang.org/protobuf/types/known/durationpb" 21 timestamppb "google.golang.org/protobuf/types/known/timestamppb" 22 ) 23 24 // ensure the imports are used 25 var ( 26 _ = googlefieldmaskpb.FieldMask{} 27 28 _ = view.View_UNSPECIFIED 29 ) 30 31 // make sure we're using proto imports 32 var ( 33 _ = &log_condition.LogCondition{} 34 _ = ¬ification_channel.NotificationChannel{} 35 _ = &rcommon.LogCndSpec{} 36 _ = &ts_condition.TsCondition{} 37 _ = &durationpb.Duration{} 38 _ = ×tamppb.Timestamp{} 39 _ = &meta.Meta{} 40 ) 41 42 func ResourceViewFieldMask(viewName view.View, extraMask *Alert_FieldMask) *Alert_FieldMask { 43 protoFieldMask := &googlefieldmaskpb.FieldMask{} 44 45 switch viewName { 46 case view.View_UNSPECIFIED: 47 return extraMask 48 case view.View_FULL: 49 return nil 50 case view.View_BASIC: 51 protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "display_name", "alerting_resource.name", "state.is_firing", "state.escalation_level", "state.ai_agent_handling_state", "state.operator_handling_state", "state.start_time", "state.end_time") 52 break 53 case view.View_DETAIL: 54 protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "display_name", "alerting_resource", "ts_info.type", "ts_info.anomaly_window_size", "ts_info.metric_types", "ts_info.resource_types", "ts_info.common_metric_labels", "ts_info.common_resource_labels", "ts_info.time_series", "log_info.log_types", "log_info.common_log_labels", "log_info.violating_log", "state.is_firing", "state.escalation_level", "state.ai_agent_handling_state", "state.ai_agent_diagnosis_notes", "state.ai_remediation_arg", "state.operator_handling_state", "state.operator_notes", "state.start_time", "state.end_time") 55 break 56 case view.View_NAME: 57 protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "display_name") 58 break 59 default: 60 return extraMask 61 } 62 if extraMask != nil { 63 protoFieldMask.Paths = append(protoFieldMask.Paths, extraMask.ToProtoFieldMask().Paths...) 64 } 65 res := &Alert_FieldMask{} 66 _ = res.FromProtoFieldMask(protoFieldMask) 67 return res 68 }