github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/notification/notification.pb.view.go (about)

     1  // Code generated by protoc-gen-goten-resource
     2  // Resource: Notification
     3  // DO NOT EDIT!!!
     4  
     5  package notification
     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  	alert "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alert"
    16  	alerting_condition "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alerting_condition"
    17  	alerting_policy "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alerting_policy"
    18  	common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common"
    19  	notification_channel "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/notification_channel"
    20  	project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/project"
    21  	meta "github.com/cloudwan/goten-sdk/types/meta"
    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  	_ = &alert.Alert{}
    34  	_ = &alerting_condition.AlertingCondition{}
    35  	_ = &alerting_policy.AlertingPolicy{}
    36  	_ = &common.LabelDescriptor{}
    37  	_ = &notification_channel.NotificationChannel{}
    38  	_ = &project.Project{}
    39  	_ = &meta.Meta{}
    40  )
    41  
    42  func ResourceViewFieldMask(viewName view.View, extraMask *Notification_FieldMask) *Notification_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", "state.incident_notify_attempts_done", "state.notification_state")
    52  		break
    53  	case view.View_NAME:
    54  		protoFieldMask.Paths = append(protoFieldMask.Paths, "name")
    55  		break
    56  	default:
    57  		return extraMask
    58  	}
    59  	if extraMask != nil {
    60  		protoFieldMask.Paths = append(protoFieldMask.Paths, extraMask.ToProtoFieldMask().Paths...)
    61  	}
    62  	res := &Notification_FieldMask{}
    63  	_ = res.FromProtoFieldMask(protoFieldMask)
    64  	return res
    65  }