github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/alerting_policy/alerting_policy.pb.view.go (about) 1 // Code generated by protoc-gen-goten-resource 2 // Resource: AlertingPolicy 3 // DO NOT EDIT!!! 4 5 package alerting_policy 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 notification_channel "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/notification_channel" 16 project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/project" 17 meta "github.com/cloudwan/goten-sdk/types/meta" 18 ) 19 20 // ensure the imports are used 21 var ( 22 _ = googlefieldmaskpb.FieldMask{} 23 24 _ = view.View_UNSPECIFIED 25 ) 26 27 // make sure we're using proto imports 28 var ( 29 _ = ¬ification_channel.NotificationChannel{} 30 _ = &project.Project{} 31 _ = &meta.Meta{} 32 ) 33 34 func ResourceViewFieldMask(viewName view.View, extraMask *AlertingPolicy_FieldMask) *AlertingPolicy_FieldMask { 35 protoFieldMask := &googlefieldmaskpb.FieldMask{} 36 37 switch viewName { 38 case view.View_UNSPECIFIED: 39 return extraMask 40 case view.View_FULL: 41 return nil 42 case view.View_BASIC: 43 protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "display_name", "spec.enabled") 44 break 45 case view.View_NAME: 46 protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "display_name") 47 break 48 default: 49 return extraMask 50 } 51 if extraMask != nil { 52 protoFieldMask.Paths = append(protoFieldMask.Paths, extraMask.ToProtoFieldMask().Paths...) 53 } 54 res := &AlertingPolicy_FieldMask{} 55 _ = res.FromProtoFieldMask(protoFieldMask) 56 return res 57 }