github.com/cloudwan/edgelq-sdk@v1.15.4/devices/resources/v1/device/device.pb.view.go (about) 1 // Code generated by protoc-gen-goten-resource 2 // Resource: Device 3 // DO NOT EDIT!!! 4 5 package device 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 api "github.com/cloudwan/edgelq-sdk/common/api" 16 project "github.com/cloudwan/edgelq-sdk/devices/resources/v1/project" 17 iam_attestation_domain "github.com/cloudwan/edgelq-sdk/iam/resources/v1/attestation_domain" 18 iam_iam_common "github.com/cloudwan/edgelq-sdk/iam/resources/v1/common" 19 iam_service_account "github.com/cloudwan/edgelq-sdk/iam/resources/v1/service_account" 20 logging_bucket "github.com/cloudwan/edgelq-sdk/logging/resources/v1/bucket" 21 monitoring_bucket "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/bucket" 22 meta "github.com/cloudwan/goten-sdk/types/meta" 23 latlng "google.golang.org/genproto/googleapis/type/latlng" 24 durationpb "google.golang.org/protobuf/types/known/durationpb" 25 fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 26 timestamppb "google.golang.org/protobuf/types/known/timestamppb" 27 ) 28 29 // ensure the imports are used 30 var ( 31 _ = googlefieldmaskpb.FieldMask{} 32 33 _ = view.View_UNSPECIFIED 34 ) 35 36 // make sure we're using proto imports 37 var ( 38 _ = &api.HealthCheckSpec{} 39 _ = &project.Project{} 40 _ = &iam_attestation_domain.AttestationDomain{} 41 _ = &iam_iam_common.PCR{} 42 _ = &iam_service_account.ServiceAccount{} 43 _ = &logging_bucket.Bucket{} 44 _ = &monitoring_bucket.Bucket{} 45 _ = &durationpb.Duration{} 46 _ = &fieldmaskpb.FieldMask{} 47 _ = ×tamppb.Timestamp{} 48 _ = &latlng.LatLng{} 49 _ = &meta.Meta{} 50 ) 51 52 func ResourceViewFieldMask(viewName view.View, extraMask *Device_FieldMask) *Device_FieldMask { 53 protoFieldMask := &googlefieldmaskpb.FieldMask{} 54 55 switch viewName { 56 case view.View_UNSPECIFIED: 57 return extraMask 58 case view.View_FULL: 59 return nil 60 case view.View_BASIC: 61 protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "display_name", "status.device_info.os_version", "status.device_info.hardware_information.system.product_name", "status.device_info.hardware_information.system.serial_number", "metadata.labels", "metadata.tags") 62 break 63 case view.View_NAME: 64 protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "display_name") 65 break 66 default: 67 return extraMask 68 } 69 if extraMask != nil { 70 protoFieldMask.Paths = append(protoFieldMask.Paths, extraMask.ToProtoFieldMask().Paths...) 71 } 72 res := &Device_FieldMask{} 73 _ = res.FromProtoFieldMask(protoFieldMask) 74 return res 75 }