github.com/cloudwan/edgelq-sdk@v1.15.4/alerting/resources/v1/ts_entry/ts_entry.pb.namebuilder.go (about) 1 // Code generated by protoc-gen-goten-resource 2 // Resource: TsEntry 3 // DO NOT EDIT!!! 4 5 package ts_entry 6 7 import ( 8 gotenresource "github.com/cloudwan/goten-sdk/runtime/resource" 9 ) 10 11 // proto imports 12 import ( 13 rcommon "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/common" 14 ts_condition "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/ts_condition" 15 monitoring_common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 16 meta "github.com/cloudwan/goten-sdk/types/meta" 17 durationpb "google.golang.org/protobuf/types/known/durationpb" 18 timestamppb "google.golang.org/protobuf/types/known/timestamppb" 19 ) 20 21 // make sure we're using proto imports 22 var ( 23 _ = &rcommon.LogCndSpec{} 24 _ = &ts_condition.TsCondition{} 25 _ = &monitoring_common.LabelDescriptor{} 26 _ = &durationpb.Duration{} 27 _ = ×tamppb.Timestamp{} 28 _ = &meta.Meta{} 29 ) 30 31 const ( 32 NamePattern_Project_Policy_TsCondition_Region = "projects/{project}/policies/{policy}/tsConditions/{ts_condition}/regions/{region}/tsEntries/{ts_entry}" 33 ) 34 35 type NamePattern struct { 36 Pattern gotenresource.NamePattern `firestore:"pattern"` 37 } 38 39 type NameBuilder struct { 40 nameObj Name 41 } 42 43 func NewNameBuilder() *NameBuilder { 44 return &NameBuilder{ 45 nameObj: Name{ 46 TsEntryId: gotenresource.WildcardId, 47 ParentName: ParentName{ 48 NamePattern: NamePattern{ 49 // Set default pattern - just first. 50 Pattern: NamePattern_Project_Policy_TsCondition_Region, 51 }, 52 RegionId: gotenresource.WildcardId, 53 }, 54 }, 55 } 56 } 57 58 func (b *NameBuilder) Name() *Name { 59 copied := b.nameObj 60 return &copied 61 } 62 63 func (b *NameBuilder) Reference() *Reference { 64 return b.nameObj.AsReference() 65 } 66 67 func (b *NameBuilder) Parent() *ParentName { 68 copied := b.nameObj.ParentName 69 return &copied 70 } 71 72 func (b *NameBuilder) ParentReference() *ParentReference { 73 return b.nameObj.ParentName.AsReference() 74 } 75 76 func (b *NameBuilder) SetId(id string) *NameBuilder { 77 b.nameObj.TsEntryId = id 78 return b 79 } 80 81 func (b *NameBuilder) SetTsCondition(parent *ts_condition.Name) *NameBuilder { 82 parentName := &b.nameObj.ParentName 83 84 switch parent.Pattern { 85 case ts_condition.NamePattern_Project_Policy: 86 parentName.Pattern = NamePattern_Project_Policy_TsCondition_Region 87 } 88 parentName.ProjectId = parent.ProjectId 89 parentName.PolicyId = parent.PolicyId 90 parentName.TsConditionId = parent.TsConditionId 91 return b 92 } 93 94 func (b *NameBuilder) SetProjectId(id string) *NameBuilder { 95 parentName := &b.nameObj.ParentName 96 parentName.ProjectId = id 97 98 // Set pattern if something matches for this set of IDs 99 if parentName.ProjectId != "" && parentName.PolicyId != "" && parentName.TsConditionId != "" && parentName.RegionId != "" { 100 parentName.Pattern = NamePattern_Project_Policy_TsCondition_Region 101 } 102 return b 103 } 104 105 func (b *NameBuilder) SetPolicyId(id string) *NameBuilder { 106 parentName := &b.nameObj.ParentName 107 parentName.PolicyId = id 108 109 // Set pattern if something matches for this set of IDs 110 if parentName.ProjectId != "" && parentName.PolicyId != "" && parentName.TsConditionId != "" && parentName.RegionId != "" { 111 parentName.Pattern = NamePattern_Project_Policy_TsCondition_Region 112 } 113 return b 114 } 115 116 func (b *NameBuilder) SetTsConditionId(id string) *NameBuilder { 117 parentName := &b.nameObj.ParentName 118 parentName.TsConditionId = id 119 120 // Set pattern if something matches for this set of IDs 121 if parentName.ProjectId != "" && parentName.PolicyId != "" && parentName.TsConditionId != "" && parentName.RegionId != "" { 122 parentName.Pattern = NamePattern_Project_Policy_TsCondition_Region 123 } 124 return b 125 } 126 127 func (b *NameBuilder) SetRegionId(id string) *NameBuilder { 128 parentName := &b.nameObj.ParentName 129 parentName.RegionId = id 130 131 // Set pattern if something matches for this set of IDs 132 if parentName.ProjectId != "" && parentName.PolicyId != "" && parentName.TsConditionId != "" && parentName.RegionId != "" { 133 parentName.Pattern = NamePattern_Project_Policy_TsCondition_Region 134 } 135 return b 136 }