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

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