github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/metric_descriptor/metric_descriptor.pb.fieldmask.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/monitoring/proto/v4/metric_descriptor.proto 3 // DO NOT EDIT!!! 4 5 package metric_descriptor 6 7 import ( 8 "encoding/json" 9 "strings" 10 11 "google.golang.org/grpc/codes" 12 "google.golang.org/grpc/status" 13 "google.golang.org/protobuf/proto" 14 preflect "google.golang.org/protobuf/reflect/protoreflect" 15 googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 16 17 gotenobject "github.com/cloudwan/goten-sdk/runtime/object" 18 ) 19 20 // proto imports 21 import ( 22 api "github.com/cloudwan/edgelq-sdk/common/api" 23 common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 24 monitored_resource_descriptor "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/monitored_resource_descriptor" 25 project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/project" 26 meta "github.com/cloudwan/goten-sdk/types/meta" 27 durationpb "google.golang.org/protobuf/types/known/durationpb" 28 ) 29 30 // ensure the imports are used 31 var ( 32 _ = new(json.Marshaler) 33 _ = strings.Builder{} 34 35 _ = codes.NotFound 36 _ = status.Status{} 37 _ = new(proto.Message) 38 _ = new(preflect.Message) 39 _ = googlefieldmaskpb.FieldMask{} 40 41 _ = new(gotenobject.FieldMask) 42 ) 43 44 // make sure we're using proto imports 45 var ( 46 _ = api.LaunchStage(0) 47 _ = &common.LabelDescriptor{} 48 _ = &monitored_resource_descriptor.MonitoredResourceDescriptor{} 49 _ = &project.Project{} 50 _ = &durationpb.Duration{} 51 _ = &meta.Meta{} 52 ) 53 54 type MetricDescriptor_FieldMask struct { 55 Paths []MetricDescriptor_FieldPath 56 } 57 58 func FullMetricDescriptor_FieldMask() *MetricDescriptor_FieldMask { 59 res := &MetricDescriptor_FieldMask{} 60 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorName}) 61 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorMetadata}) 62 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorType}) 63 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorResourceTypes}) 64 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorLabels}) 65 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorMetricKind}) 66 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorValueType}) 67 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorUnit}) 68 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorDescription}) 69 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorDisplayName}) 70 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata}) 71 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorDistributionBucketOptions}) 72 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorPromotedLabelKeySets}) 73 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorIndexSpec}) 74 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorIndices}) 75 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorStorageConfig}) 76 res.Paths = append(res.Paths, &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorBinaryIndices}) 77 return res 78 } 79 80 func (fieldMask *MetricDescriptor_FieldMask) String() string { 81 if fieldMask == nil { 82 return "<nil>" 83 } 84 pathsStr := make([]string, 0, len(fieldMask.Paths)) 85 for _, path := range fieldMask.Paths { 86 pathsStr = append(pathsStr, path.String()) 87 } 88 return strings.Join(pathsStr, ", ") 89 } 90 91 func (fieldMask *MetricDescriptor_FieldMask) IsFull() bool { 92 if fieldMask == nil { 93 return false 94 } 95 presentSelectors := make([]bool, 17) 96 for _, path := range fieldMask.Paths { 97 if asFinal, ok := path.(*MetricDescriptor_FieldTerminalPath); ok { 98 presentSelectors[int(asFinal.selector)] = true 99 } 100 } 101 for _, flag := range presentSelectors { 102 if !flag { 103 return false 104 } 105 } 106 return true 107 } 108 109 func (fieldMask *MetricDescriptor_FieldMask) ProtoReflect() preflect.Message { 110 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 111 return ParseMetricDescriptor_FieldPath(raw) 112 }) 113 } 114 115 func (fieldMask *MetricDescriptor_FieldMask) ProtoMessage() {} 116 117 func (fieldMask *MetricDescriptor_FieldMask) Reset() { 118 if fieldMask != nil { 119 fieldMask.Paths = nil 120 } 121 } 122 123 func (fieldMask *MetricDescriptor_FieldMask) Subtract(other *MetricDescriptor_FieldMask) *MetricDescriptor_FieldMask { 124 result := &MetricDescriptor_FieldMask{} 125 removedSelectors := make([]bool, 17) 126 otherSubMasks := map[MetricDescriptor_FieldPathSelector]gotenobject.FieldMask{ 127 MetricDescriptor_FieldPathSelectorMetadata: &meta.Meta_FieldMask{}, 128 MetricDescriptor_FieldPathSelectorLabels: &common.LabelDescriptor_FieldMask{}, 129 MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: &MetricDescriptor_MetricDescriptorMetadata_FieldMask{}, 130 MetricDescriptor_FieldPathSelectorDistributionBucketOptions: &common.Distribution_BucketOptions_FieldMask{}, 131 MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: &common.LabelKeySet_FieldMask{}, 132 MetricDescriptor_FieldPathSelectorIndexSpec: &MetricDescriptor_IndexSpec_FieldMask{}, 133 MetricDescriptor_FieldPathSelectorIndices: &MetricDescriptor_Indices_FieldMask{}, 134 MetricDescriptor_FieldPathSelectorStorageConfig: &MetricDescriptor_StorageConfig_FieldMask{}, 135 MetricDescriptor_FieldPathSelectorBinaryIndices: &MetricDescriptor_BinaryIndices_FieldMask{}, 136 } 137 mySubMasks := map[MetricDescriptor_FieldPathSelector]gotenobject.FieldMask{ 138 MetricDescriptor_FieldPathSelectorMetadata: &meta.Meta_FieldMask{}, 139 MetricDescriptor_FieldPathSelectorLabels: &common.LabelDescriptor_FieldMask{}, 140 MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: &MetricDescriptor_MetricDescriptorMetadata_FieldMask{}, 141 MetricDescriptor_FieldPathSelectorDistributionBucketOptions: &common.Distribution_BucketOptions_FieldMask{}, 142 MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: &common.LabelKeySet_FieldMask{}, 143 MetricDescriptor_FieldPathSelectorIndexSpec: &MetricDescriptor_IndexSpec_FieldMask{}, 144 MetricDescriptor_FieldPathSelectorIndices: &MetricDescriptor_Indices_FieldMask{}, 145 MetricDescriptor_FieldPathSelectorStorageConfig: &MetricDescriptor_StorageConfig_FieldMask{}, 146 MetricDescriptor_FieldPathSelectorBinaryIndices: &MetricDescriptor_BinaryIndices_FieldMask{}, 147 } 148 149 for _, path := range other.GetPaths() { 150 switch tp := path.(type) { 151 case *MetricDescriptor_FieldTerminalPath: 152 removedSelectors[int(tp.selector)] = true 153 case *MetricDescriptor_FieldSubPath: 154 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 155 } 156 } 157 for _, path := range fieldMask.GetPaths() { 158 if !removedSelectors[int(path.Selector())] { 159 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 160 if tp, ok := path.(*MetricDescriptor_FieldTerminalPath); ok { 161 switch tp.selector { 162 case MetricDescriptor_FieldPathSelectorMetadata: 163 mySubMasks[MetricDescriptor_FieldPathSelectorMetadata] = meta.FullMeta_FieldMask() 164 case MetricDescriptor_FieldPathSelectorLabels: 165 mySubMasks[MetricDescriptor_FieldPathSelectorLabels] = common.FullLabelDescriptor_FieldMask() 166 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 167 mySubMasks[MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata] = FullMetricDescriptor_MetricDescriptorMetadata_FieldMask() 168 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 169 mySubMasks[MetricDescriptor_FieldPathSelectorDistributionBucketOptions] = common.FullDistribution_BucketOptions_FieldMask() 170 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 171 mySubMasks[MetricDescriptor_FieldPathSelectorPromotedLabelKeySets] = common.FullLabelKeySet_FieldMask() 172 case MetricDescriptor_FieldPathSelectorIndexSpec: 173 mySubMasks[MetricDescriptor_FieldPathSelectorIndexSpec] = FullMetricDescriptor_IndexSpec_FieldMask() 174 case MetricDescriptor_FieldPathSelectorIndices: 175 mySubMasks[MetricDescriptor_FieldPathSelectorIndices] = FullMetricDescriptor_Indices_FieldMask() 176 case MetricDescriptor_FieldPathSelectorStorageConfig: 177 mySubMasks[MetricDescriptor_FieldPathSelectorStorageConfig] = FullMetricDescriptor_StorageConfig_FieldMask() 178 case MetricDescriptor_FieldPathSelectorBinaryIndices: 179 mySubMasks[MetricDescriptor_FieldPathSelectorBinaryIndices] = FullMetricDescriptor_BinaryIndices_FieldMask() 180 } 181 } else if tp, ok := path.(*MetricDescriptor_FieldSubPath); ok { 182 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 183 } 184 } else { 185 result.Paths = append(result.Paths, path) 186 } 187 } 188 } 189 for selector, mySubMask := range mySubMasks { 190 if mySubMask.PathsCount() > 0 { 191 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 192 result.Paths = append(result.Paths, &MetricDescriptor_FieldSubPath{selector: selector, subPath: allowedPath}) 193 } 194 } 195 } 196 197 if len(result.Paths) == 0 { 198 return nil 199 } 200 return result 201 } 202 203 func (fieldMask *MetricDescriptor_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 204 return fieldMask.Subtract(other.(*MetricDescriptor_FieldMask)) 205 } 206 207 // FilterInputFields generates copy of field paths with output_only field paths removed 208 func (fieldMask *MetricDescriptor_FieldMask) FilterInputFields() *MetricDescriptor_FieldMask { 209 result := &MetricDescriptor_FieldMask{} 210 for _, path := range fieldMask.Paths { 211 switch path.Selector() { 212 case MetricDescriptor_FieldPathSelectorBinaryIndices: 213 case MetricDescriptor_FieldPathSelectorMetadata: 214 if _, ok := path.(*MetricDescriptor_FieldTerminalPath); ok { 215 for _, subpath := range meta.FullMeta_FieldMask().FilterInputFields().Paths { 216 result.Paths = append(result.Paths, &MetricDescriptor_FieldSubPath{selector: path.Selector(), subPath: subpath}) 217 } 218 } else if sub, ok := path.(*MetricDescriptor_FieldSubPath); ok { 219 selectedMask := &meta.Meta_FieldMask{ 220 Paths: []meta.Meta_FieldPath{sub.subPath.(meta.Meta_FieldPath)}, 221 } 222 for _, allowedPath := range selectedMask.FilterInputFields().Paths { 223 result.Paths = append(result.Paths, &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorMetadata, subPath: allowedPath}) 224 } 225 } 226 default: 227 result.Paths = append(result.Paths, path) 228 } 229 } 230 return result 231 } 232 233 // ToFieldMask is used for proto conversions 234 func (fieldMask *MetricDescriptor_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 235 protoFieldMask := &googlefieldmaskpb.FieldMask{} 236 for _, path := range fieldMask.Paths { 237 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 238 } 239 return protoFieldMask 240 } 241 242 func (fieldMask *MetricDescriptor_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 243 if fieldMask == nil { 244 return status.Error(codes.Internal, "target field mask is nil") 245 } 246 fieldMask.Paths = make([]MetricDescriptor_FieldPath, 0, len(protoFieldMask.Paths)) 247 for _, strPath := range protoFieldMask.Paths { 248 path, err := ParseMetricDescriptor_FieldPath(strPath) 249 if err != nil { 250 return err 251 } 252 fieldMask.Paths = append(fieldMask.Paths, path) 253 } 254 return nil 255 } 256 257 // implement methods required by customType 258 func (fieldMask MetricDescriptor_FieldMask) Marshal() ([]byte, error) { 259 protoFieldMask := fieldMask.ToProtoFieldMask() 260 return proto.Marshal(protoFieldMask) 261 } 262 263 func (fieldMask *MetricDescriptor_FieldMask) Unmarshal(data []byte) error { 264 protoFieldMask := &googlefieldmaskpb.FieldMask{} 265 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 266 return err 267 } 268 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 269 return err 270 } 271 return nil 272 } 273 274 func (fieldMask *MetricDescriptor_FieldMask) Size() int { 275 return proto.Size(fieldMask.ToProtoFieldMask()) 276 } 277 278 func (fieldMask MetricDescriptor_FieldMask) MarshalJSON() ([]byte, error) { 279 return json.Marshal(fieldMask.ToProtoFieldMask()) 280 } 281 282 func (fieldMask *MetricDescriptor_FieldMask) UnmarshalJSON(data []byte) error { 283 protoFieldMask := &googlefieldmaskpb.FieldMask{} 284 if err := json.Unmarshal(data, protoFieldMask); err != nil { 285 return err 286 } 287 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 288 return err 289 } 290 return nil 291 } 292 293 func (fieldMask *MetricDescriptor_FieldMask) AppendPath(path MetricDescriptor_FieldPath) { 294 fieldMask.Paths = append(fieldMask.Paths, path) 295 } 296 297 func (fieldMask *MetricDescriptor_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 298 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptor_FieldPath)) 299 } 300 301 func (fieldMask *MetricDescriptor_FieldMask) GetPaths() []MetricDescriptor_FieldPath { 302 if fieldMask == nil { 303 return nil 304 } 305 return fieldMask.Paths 306 } 307 308 func (fieldMask *MetricDescriptor_FieldMask) GetRawPaths() []gotenobject.FieldPath { 309 if fieldMask == nil { 310 return nil 311 } 312 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 313 for _, path := range fieldMask.Paths { 314 rawPaths = append(rawPaths, path) 315 } 316 return rawPaths 317 } 318 319 func (fieldMask *MetricDescriptor_FieldMask) SetFromCliFlag(raw string) error { 320 path, err := ParseMetricDescriptor_FieldPath(raw) 321 if err != nil { 322 return err 323 } 324 fieldMask.Paths = append(fieldMask.Paths, path) 325 return nil 326 } 327 328 func (fieldMask *MetricDescriptor_FieldMask) Set(target, source *MetricDescriptor) { 329 for _, path := range fieldMask.Paths { 330 val, _ := path.GetSingle(source) 331 // if val is nil, then field does not exist in source, skip 332 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 333 if val != nil { 334 path.WithIValue(val).SetTo(&target) 335 } 336 } 337 } 338 339 func (fieldMask *MetricDescriptor_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 340 fieldMask.Set(target.(*MetricDescriptor), source.(*MetricDescriptor)) 341 } 342 343 func (fieldMask *MetricDescriptor_FieldMask) Project(source *MetricDescriptor) *MetricDescriptor { 344 if source == nil { 345 return nil 346 } 347 if fieldMask == nil { 348 return source 349 } 350 result := &MetricDescriptor{} 351 metadataMask := &meta.Meta_FieldMask{} 352 wholeMetadataAccepted := false 353 labelsMask := &common.LabelDescriptor_FieldMask{} 354 wholeLabelsAccepted := false 355 metricDescriptorMetadataMask := &MetricDescriptor_MetricDescriptorMetadata_FieldMask{} 356 wholeMetricDescriptorMetadataAccepted := false 357 distributionBucketOptionsMask := &common.Distribution_BucketOptions_FieldMask{} 358 wholeDistributionBucketOptionsAccepted := false 359 promotedLabelKeySetsMask := &common.LabelKeySet_FieldMask{} 360 wholePromotedLabelKeySetsAccepted := false 361 indexSpecMask := &MetricDescriptor_IndexSpec_FieldMask{} 362 wholeIndexSpecAccepted := false 363 indicesMask := &MetricDescriptor_Indices_FieldMask{} 364 wholeIndicesAccepted := false 365 storageConfigMask := &MetricDescriptor_StorageConfig_FieldMask{} 366 wholeStorageConfigAccepted := false 367 binaryIndicesMask := &MetricDescriptor_BinaryIndices_FieldMask{} 368 wholeBinaryIndicesAccepted := false 369 370 for _, p := range fieldMask.Paths { 371 switch tp := p.(type) { 372 case *MetricDescriptor_FieldTerminalPath: 373 switch tp.selector { 374 case MetricDescriptor_FieldPathSelectorName: 375 result.Name = source.Name 376 case MetricDescriptor_FieldPathSelectorMetadata: 377 result.Metadata = source.Metadata 378 wholeMetadataAccepted = true 379 case MetricDescriptor_FieldPathSelectorType: 380 result.Type = source.Type 381 case MetricDescriptor_FieldPathSelectorResourceTypes: 382 result.ResourceTypes = source.ResourceTypes 383 case MetricDescriptor_FieldPathSelectorLabels: 384 result.Labels = source.Labels 385 wholeLabelsAccepted = true 386 case MetricDescriptor_FieldPathSelectorMetricKind: 387 result.MetricKind = source.MetricKind 388 case MetricDescriptor_FieldPathSelectorValueType: 389 result.ValueType = source.ValueType 390 case MetricDescriptor_FieldPathSelectorUnit: 391 result.Unit = source.Unit 392 case MetricDescriptor_FieldPathSelectorDescription: 393 result.Description = source.Description 394 case MetricDescriptor_FieldPathSelectorDisplayName: 395 result.DisplayName = source.DisplayName 396 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 397 result.MetricDescriptorMetadata = source.MetricDescriptorMetadata 398 wholeMetricDescriptorMetadataAccepted = true 399 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 400 result.DistributionBucketOptions = source.DistributionBucketOptions 401 wholeDistributionBucketOptionsAccepted = true 402 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 403 result.PromotedLabelKeySets = source.PromotedLabelKeySets 404 wholePromotedLabelKeySetsAccepted = true 405 case MetricDescriptor_FieldPathSelectorIndexSpec: 406 result.IndexSpec = source.IndexSpec 407 wholeIndexSpecAccepted = true 408 case MetricDescriptor_FieldPathSelectorIndices: 409 result.Indices = source.Indices 410 wholeIndicesAccepted = true 411 case MetricDescriptor_FieldPathSelectorStorageConfig: 412 result.StorageConfig = source.StorageConfig 413 wholeStorageConfigAccepted = true 414 case MetricDescriptor_FieldPathSelectorBinaryIndices: 415 result.BinaryIndices = source.BinaryIndices 416 wholeBinaryIndicesAccepted = true 417 } 418 case *MetricDescriptor_FieldSubPath: 419 switch tp.selector { 420 case MetricDescriptor_FieldPathSelectorMetadata: 421 metadataMask.AppendPath(tp.subPath.(meta.Meta_FieldPath)) 422 case MetricDescriptor_FieldPathSelectorLabels: 423 labelsMask.AppendPath(tp.subPath.(common.LabelDescriptor_FieldPath)) 424 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 425 metricDescriptorMetadataMask.AppendPath(tp.subPath.(MetricDescriptorMetricDescriptorMetadata_FieldPath)) 426 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 427 distributionBucketOptionsMask.AppendPath(tp.subPath.(common.DistributionBucketOptions_FieldPath)) 428 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 429 promotedLabelKeySetsMask.AppendPath(tp.subPath.(common.LabelKeySet_FieldPath)) 430 case MetricDescriptor_FieldPathSelectorIndexSpec: 431 indexSpecMask.AppendPath(tp.subPath.(MetricDescriptorIndexSpec_FieldPath)) 432 case MetricDescriptor_FieldPathSelectorIndices: 433 indicesMask.AppendPath(tp.subPath.(MetricDescriptorIndices_FieldPath)) 434 case MetricDescriptor_FieldPathSelectorStorageConfig: 435 storageConfigMask.AppendPath(tp.subPath.(MetricDescriptorStorageConfig_FieldPath)) 436 case MetricDescriptor_FieldPathSelectorBinaryIndices: 437 binaryIndicesMask.AppendPath(tp.subPath.(MetricDescriptorBinaryIndices_FieldPath)) 438 } 439 } 440 } 441 if wholeMetadataAccepted == false && len(metadataMask.Paths) > 0 { 442 result.Metadata = metadataMask.Project(source.GetMetadata()) 443 } 444 if wholeLabelsAccepted == false && len(labelsMask.Paths) > 0 { 445 for _, sourceItem := range source.GetLabels() { 446 result.Labels = append(result.Labels, labelsMask.Project(sourceItem)) 447 } 448 } 449 if wholeMetricDescriptorMetadataAccepted == false && len(metricDescriptorMetadataMask.Paths) > 0 { 450 result.MetricDescriptorMetadata = metricDescriptorMetadataMask.Project(source.GetMetricDescriptorMetadata()) 451 } 452 if wholeDistributionBucketOptionsAccepted == false && len(distributionBucketOptionsMask.Paths) > 0 { 453 result.DistributionBucketOptions = distributionBucketOptionsMask.Project(source.GetDistributionBucketOptions()) 454 } 455 if wholePromotedLabelKeySetsAccepted == false && len(promotedLabelKeySetsMask.Paths) > 0 { 456 for _, sourceItem := range source.GetPromotedLabelKeySets() { 457 result.PromotedLabelKeySets = append(result.PromotedLabelKeySets, promotedLabelKeySetsMask.Project(sourceItem)) 458 } 459 } 460 if wholeIndexSpecAccepted == false && len(indexSpecMask.Paths) > 0 { 461 result.IndexSpec = indexSpecMask.Project(source.GetIndexSpec()) 462 } 463 if wholeIndicesAccepted == false && len(indicesMask.Paths) > 0 { 464 result.Indices = indicesMask.Project(source.GetIndices()) 465 } 466 if wholeStorageConfigAccepted == false && len(storageConfigMask.Paths) > 0 { 467 result.StorageConfig = storageConfigMask.Project(source.GetStorageConfig()) 468 } 469 if wholeBinaryIndicesAccepted == false && len(binaryIndicesMask.Paths) > 0 { 470 result.BinaryIndices = binaryIndicesMask.Project(source.GetBinaryIndices()) 471 } 472 return result 473 } 474 475 func (fieldMask *MetricDescriptor_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 476 return fieldMask.Project(source.(*MetricDescriptor)) 477 } 478 479 func (fieldMask *MetricDescriptor_FieldMask) PathsCount() int { 480 if fieldMask == nil { 481 return 0 482 } 483 return len(fieldMask.Paths) 484 } 485 486 type MetricDescriptor_MetricDescriptorMetadata_FieldMask struct { 487 Paths []MetricDescriptorMetricDescriptorMetadata_FieldPath 488 } 489 490 func FullMetricDescriptor_MetricDescriptorMetadata_FieldMask() *MetricDescriptor_MetricDescriptorMetadata_FieldMask { 491 res := &MetricDescriptor_MetricDescriptorMetadata_FieldMask{} 492 res.Paths = append(res.Paths, &MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath{selector: MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage}) 493 return res 494 } 495 496 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) String() string { 497 if fieldMask == nil { 498 return "<nil>" 499 } 500 pathsStr := make([]string, 0, len(fieldMask.Paths)) 501 for _, path := range fieldMask.Paths { 502 pathsStr = append(pathsStr, path.String()) 503 } 504 return strings.Join(pathsStr, ", ") 505 } 506 507 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) IsFull() bool { 508 if fieldMask == nil { 509 return false 510 } 511 presentSelectors := make([]bool, 1) 512 for _, path := range fieldMask.Paths { 513 if asFinal, ok := path.(*MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath); ok { 514 presentSelectors[int(asFinal.selector)] = true 515 } 516 } 517 for _, flag := range presentSelectors { 518 if !flag { 519 return false 520 } 521 } 522 return true 523 } 524 525 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) ProtoReflect() preflect.Message { 526 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 527 return ParseMetricDescriptorMetricDescriptorMetadata_FieldPath(raw) 528 }) 529 } 530 531 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) ProtoMessage() {} 532 533 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) Reset() { 534 if fieldMask != nil { 535 fieldMask.Paths = nil 536 } 537 } 538 539 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) Subtract(other *MetricDescriptor_MetricDescriptorMetadata_FieldMask) *MetricDescriptor_MetricDescriptorMetadata_FieldMask { 540 result := &MetricDescriptor_MetricDescriptorMetadata_FieldMask{} 541 removedSelectors := make([]bool, 1) 542 543 for _, path := range other.GetPaths() { 544 switch tp := path.(type) { 545 case *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath: 546 removedSelectors[int(tp.selector)] = true 547 } 548 } 549 for _, path := range fieldMask.GetPaths() { 550 if !removedSelectors[int(path.Selector())] { 551 result.Paths = append(result.Paths, path) 552 } 553 } 554 555 if len(result.Paths) == 0 { 556 return nil 557 } 558 return result 559 } 560 561 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 562 return fieldMask.Subtract(other.(*MetricDescriptor_MetricDescriptorMetadata_FieldMask)) 563 } 564 565 // FilterInputFields generates copy of field paths with output_only field paths removed 566 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) FilterInputFields() *MetricDescriptor_MetricDescriptorMetadata_FieldMask { 567 result := &MetricDescriptor_MetricDescriptorMetadata_FieldMask{} 568 result.Paths = append(result.Paths, fieldMask.Paths...) 569 return result 570 } 571 572 // ToFieldMask is used for proto conversions 573 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 574 protoFieldMask := &googlefieldmaskpb.FieldMask{} 575 for _, path := range fieldMask.Paths { 576 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 577 } 578 return protoFieldMask 579 } 580 581 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 582 if fieldMask == nil { 583 return status.Error(codes.Internal, "target field mask is nil") 584 } 585 fieldMask.Paths = make([]MetricDescriptorMetricDescriptorMetadata_FieldPath, 0, len(protoFieldMask.Paths)) 586 for _, strPath := range protoFieldMask.Paths { 587 path, err := ParseMetricDescriptorMetricDescriptorMetadata_FieldPath(strPath) 588 if err != nil { 589 return err 590 } 591 fieldMask.Paths = append(fieldMask.Paths, path) 592 } 593 return nil 594 } 595 596 // implement methods required by customType 597 func (fieldMask MetricDescriptor_MetricDescriptorMetadata_FieldMask) Marshal() ([]byte, error) { 598 protoFieldMask := fieldMask.ToProtoFieldMask() 599 return proto.Marshal(protoFieldMask) 600 } 601 602 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) Unmarshal(data []byte) error { 603 protoFieldMask := &googlefieldmaskpb.FieldMask{} 604 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 605 return err 606 } 607 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 608 return err 609 } 610 return nil 611 } 612 613 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) Size() int { 614 return proto.Size(fieldMask.ToProtoFieldMask()) 615 } 616 617 func (fieldMask MetricDescriptor_MetricDescriptorMetadata_FieldMask) MarshalJSON() ([]byte, error) { 618 return json.Marshal(fieldMask.ToProtoFieldMask()) 619 } 620 621 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) UnmarshalJSON(data []byte) error { 622 protoFieldMask := &googlefieldmaskpb.FieldMask{} 623 if err := json.Unmarshal(data, protoFieldMask); err != nil { 624 return err 625 } 626 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 627 return err 628 } 629 return nil 630 } 631 632 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) AppendPath(path MetricDescriptorMetricDescriptorMetadata_FieldPath) { 633 fieldMask.Paths = append(fieldMask.Paths, path) 634 } 635 636 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 637 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorMetricDescriptorMetadata_FieldPath)) 638 } 639 640 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) GetPaths() []MetricDescriptorMetricDescriptorMetadata_FieldPath { 641 if fieldMask == nil { 642 return nil 643 } 644 return fieldMask.Paths 645 } 646 647 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) GetRawPaths() []gotenobject.FieldPath { 648 if fieldMask == nil { 649 return nil 650 } 651 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 652 for _, path := range fieldMask.Paths { 653 rawPaths = append(rawPaths, path) 654 } 655 return rawPaths 656 } 657 658 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) SetFromCliFlag(raw string) error { 659 path, err := ParseMetricDescriptorMetricDescriptorMetadata_FieldPath(raw) 660 if err != nil { 661 return err 662 } 663 fieldMask.Paths = append(fieldMask.Paths, path) 664 return nil 665 } 666 667 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) Set(target, source *MetricDescriptor_MetricDescriptorMetadata) { 668 for _, path := range fieldMask.Paths { 669 val, _ := path.GetSingle(source) 670 // if val is nil, then field does not exist in source, skip 671 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 672 if val != nil { 673 path.WithIValue(val).SetTo(&target) 674 } 675 } 676 } 677 678 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 679 fieldMask.Set(target.(*MetricDescriptor_MetricDescriptorMetadata), source.(*MetricDescriptor_MetricDescriptorMetadata)) 680 } 681 682 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) Project(source *MetricDescriptor_MetricDescriptorMetadata) *MetricDescriptor_MetricDescriptorMetadata { 683 if source == nil { 684 return nil 685 } 686 if fieldMask == nil { 687 return source 688 } 689 result := &MetricDescriptor_MetricDescriptorMetadata{} 690 691 for _, p := range fieldMask.Paths { 692 switch tp := p.(type) { 693 case *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath: 694 switch tp.selector { 695 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 696 result.LaunchStage = source.LaunchStage 697 } 698 } 699 } 700 return result 701 } 702 703 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 704 return fieldMask.Project(source.(*MetricDescriptor_MetricDescriptorMetadata)) 705 } 706 707 func (fieldMask *MetricDescriptor_MetricDescriptorMetadata_FieldMask) PathsCount() int { 708 if fieldMask == nil { 709 return 0 710 } 711 return len(fieldMask.Paths) 712 } 713 714 type MetricDescriptor_IndexSpec_FieldMask struct { 715 Paths []MetricDescriptorIndexSpec_FieldPath 716 } 717 718 func FullMetricDescriptor_IndexSpec_FieldMask() *MetricDescriptor_IndexSpec_FieldMask { 719 res := &MetricDescriptor_IndexSpec_FieldMask{} 720 res.Paths = append(res.Paths, &MetricDescriptorIndexSpec_FieldTerminalPath{selector: MetricDescriptorIndexSpec_FieldPathSelectorPerResource}) 721 return res 722 } 723 724 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) String() string { 725 if fieldMask == nil { 726 return "<nil>" 727 } 728 pathsStr := make([]string, 0, len(fieldMask.Paths)) 729 for _, path := range fieldMask.Paths { 730 pathsStr = append(pathsStr, path.String()) 731 } 732 return strings.Join(pathsStr, ", ") 733 } 734 735 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) IsFull() bool { 736 if fieldMask == nil { 737 return false 738 } 739 presentSelectors := make([]bool, 1) 740 for _, path := range fieldMask.Paths { 741 if asFinal, ok := path.(*MetricDescriptorIndexSpec_FieldTerminalPath); ok { 742 presentSelectors[int(asFinal.selector)] = true 743 } 744 } 745 for _, flag := range presentSelectors { 746 if !flag { 747 return false 748 } 749 } 750 return true 751 } 752 753 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) ProtoReflect() preflect.Message { 754 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 755 return ParseMetricDescriptorIndexSpec_FieldPath(raw) 756 }) 757 } 758 759 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) ProtoMessage() {} 760 761 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) Reset() { 762 if fieldMask != nil { 763 fieldMask.Paths = nil 764 } 765 } 766 767 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) Subtract(other *MetricDescriptor_IndexSpec_FieldMask) *MetricDescriptor_IndexSpec_FieldMask { 768 result := &MetricDescriptor_IndexSpec_FieldMask{} 769 removedSelectors := make([]bool, 1) 770 otherSubMasks := map[MetricDescriptorIndexSpec_FieldPathSelector]gotenobject.FieldMask{ 771 MetricDescriptorIndexSpec_FieldPathSelectorPerResource: &MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask{}, 772 } 773 mySubMasks := map[MetricDescriptorIndexSpec_FieldPathSelector]gotenobject.FieldMask{ 774 MetricDescriptorIndexSpec_FieldPathSelectorPerResource: &MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask{}, 775 } 776 777 for _, path := range other.GetPaths() { 778 switch tp := path.(type) { 779 case *MetricDescriptorIndexSpec_FieldTerminalPath: 780 removedSelectors[int(tp.selector)] = true 781 case *MetricDescriptorIndexSpec_FieldSubPath: 782 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 783 } 784 } 785 for _, path := range fieldMask.GetPaths() { 786 if !removedSelectors[int(path.Selector())] { 787 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 788 if tp, ok := path.(*MetricDescriptorIndexSpec_FieldTerminalPath); ok { 789 switch tp.selector { 790 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 791 mySubMasks[MetricDescriptorIndexSpec_FieldPathSelectorPerResource] = FullMetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask() 792 } 793 } else if tp, ok := path.(*MetricDescriptorIndexSpec_FieldSubPath); ok { 794 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 795 } 796 } else { 797 result.Paths = append(result.Paths, path) 798 } 799 } 800 } 801 for selector, mySubMask := range mySubMasks { 802 if mySubMask.PathsCount() > 0 { 803 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 804 result.Paths = append(result.Paths, &MetricDescriptorIndexSpec_FieldSubPath{selector: selector, subPath: allowedPath}) 805 } 806 } 807 } 808 809 if len(result.Paths) == 0 { 810 return nil 811 } 812 return result 813 } 814 815 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 816 return fieldMask.Subtract(other.(*MetricDescriptor_IndexSpec_FieldMask)) 817 } 818 819 // FilterInputFields generates copy of field paths with output_only field paths removed 820 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) FilterInputFields() *MetricDescriptor_IndexSpec_FieldMask { 821 result := &MetricDescriptor_IndexSpec_FieldMask{} 822 result.Paths = append(result.Paths, fieldMask.Paths...) 823 return result 824 } 825 826 // ToFieldMask is used for proto conversions 827 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 828 protoFieldMask := &googlefieldmaskpb.FieldMask{} 829 for _, path := range fieldMask.Paths { 830 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 831 } 832 return protoFieldMask 833 } 834 835 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 836 if fieldMask == nil { 837 return status.Error(codes.Internal, "target field mask is nil") 838 } 839 fieldMask.Paths = make([]MetricDescriptorIndexSpec_FieldPath, 0, len(protoFieldMask.Paths)) 840 for _, strPath := range protoFieldMask.Paths { 841 path, err := ParseMetricDescriptorIndexSpec_FieldPath(strPath) 842 if err != nil { 843 return err 844 } 845 fieldMask.Paths = append(fieldMask.Paths, path) 846 } 847 return nil 848 } 849 850 // implement methods required by customType 851 func (fieldMask MetricDescriptor_IndexSpec_FieldMask) Marshal() ([]byte, error) { 852 protoFieldMask := fieldMask.ToProtoFieldMask() 853 return proto.Marshal(protoFieldMask) 854 } 855 856 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) Unmarshal(data []byte) error { 857 protoFieldMask := &googlefieldmaskpb.FieldMask{} 858 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 859 return err 860 } 861 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 862 return err 863 } 864 return nil 865 } 866 867 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) Size() int { 868 return proto.Size(fieldMask.ToProtoFieldMask()) 869 } 870 871 func (fieldMask MetricDescriptor_IndexSpec_FieldMask) MarshalJSON() ([]byte, error) { 872 return json.Marshal(fieldMask.ToProtoFieldMask()) 873 } 874 875 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) UnmarshalJSON(data []byte) error { 876 protoFieldMask := &googlefieldmaskpb.FieldMask{} 877 if err := json.Unmarshal(data, protoFieldMask); err != nil { 878 return err 879 } 880 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 881 return err 882 } 883 return nil 884 } 885 886 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) AppendPath(path MetricDescriptorIndexSpec_FieldPath) { 887 fieldMask.Paths = append(fieldMask.Paths, path) 888 } 889 890 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 891 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndexSpec_FieldPath)) 892 } 893 894 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) GetPaths() []MetricDescriptorIndexSpec_FieldPath { 895 if fieldMask == nil { 896 return nil 897 } 898 return fieldMask.Paths 899 } 900 901 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) GetRawPaths() []gotenobject.FieldPath { 902 if fieldMask == nil { 903 return nil 904 } 905 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 906 for _, path := range fieldMask.Paths { 907 rawPaths = append(rawPaths, path) 908 } 909 return rawPaths 910 } 911 912 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) SetFromCliFlag(raw string) error { 913 path, err := ParseMetricDescriptorIndexSpec_FieldPath(raw) 914 if err != nil { 915 return err 916 } 917 fieldMask.Paths = append(fieldMask.Paths, path) 918 return nil 919 } 920 921 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) Set(target, source *MetricDescriptor_IndexSpec) { 922 for _, path := range fieldMask.Paths { 923 val, _ := path.GetSingle(source) 924 // if val is nil, then field does not exist in source, skip 925 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 926 if val != nil { 927 path.WithIValue(val).SetTo(&target) 928 } 929 } 930 } 931 932 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 933 fieldMask.Set(target.(*MetricDescriptor_IndexSpec), source.(*MetricDescriptor_IndexSpec)) 934 } 935 936 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) Project(source *MetricDescriptor_IndexSpec) *MetricDescriptor_IndexSpec { 937 if source == nil { 938 return nil 939 } 940 if fieldMask == nil { 941 return source 942 } 943 result := &MetricDescriptor_IndexSpec{} 944 perResourceMask := &MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask{} 945 wholePerResourceAccepted := false 946 947 for _, p := range fieldMask.Paths { 948 switch tp := p.(type) { 949 case *MetricDescriptorIndexSpec_FieldTerminalPath: 950 switch tp.selector { 951 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 952 result.PerResource = source.PerResource 953 wholePerResourceAccepted = true 954 } 955 case *MetricDescriptorIndexSpec_FieldSubPath: 956 switch tp.selector { 957 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 958 perResourceMask.AppendPath(tp.subPath.(MetricDescriptorIndexSpecPerMonitoredResource_FieldPath)) 959 } 960 } 961 } 962 if wholePerResourceAccepted == false && len(perResourceMask.Paths) > 0 { 963 for _, sourceItem := range source.GetPerResource() { 964 result.PerResource = append(result.PerResource, perResourceMask.Project(sourceItem)) 965 } 966 } 967 return result 968 } 969 970 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 971 return fieldMask.Project(source.(*MetricDescriptor_IndexSpec)) 972 } 973 974 func (fieldMask *MetricDescriptor_IndexSpec_FieldMask) PathsCount() int { 975 if fieldMask == nil { 976 return 0 977 } 978 return len(fieldMask.Paths) 979 } 980 981 type MetricDescriptor_Indices_FieldMask struct { 982 Paths []MetricDescriptorIndices_FieldPath 983 } 984 985 func FullMetricDescriptor_Indices_FieldMask() *MetricDescriptor_Indices_FieldMask { 986 res := &MetricDescriptor_Indices_FieldMask{} 987 res.Paths = append(res.Paths, &MetricDescriptorIndices_FieldTerminalPath{selector: MetricDescriptorIndices_FieldPathSelectorBuiltIn}) 988 res.Paths = append(res.Paths, &MetricDescriptorIndices_FieldTerminalPath{selector: MetricDescriptorIndices_FieldPathSelectorUserDefined}) 989 res.Paths = append(res.Paths, &MetricDescriptorIndices_FieldTerminalPath{selector: MetricDescriptorIndices_FieldPathSelectorLegacyMigrated}) 990 return res 991 } 992 993 func (fieldMask *MetricDescriptor_Indices_FieldMask) String() string { 994 if fieldMask == nil { 995 return "<nil>" 996 } 997 pathsStr := make([]string, 0, len(fieldMask.Paths)) 998 for _, path := range fieldMask.Paths { 999 pathsStr = append(pathsStr, path.String()) 1000 } 1001 return strings.Join(pathsStr, ", ") 1002 } 1003 1004 func (fieldMask *MetricDescriptor_Indices_FieldMask) IsFull() bool { 1005 if fieldMask == nil { 1006 return false 1007 } 1008 presentSelectors := make([]bool, 3) 1009 for _, path := range fieldMask.Paths { 1010 if asFinal, ok := path.(*MetricDescriptorIndices_FieldTerminalPath); ok { 1011 presentSelectors[int(asFinal.selector)] = true 1012 } 1013 } 1014 for _, flag := range presentSelectors { 1015 if !flag { 1016 return false 1017 } 1018 } 1019 return true 1020 } 1021 1022 func (fieldMask *MetricDescriptor_Indices_FieldMask) ProtoReflect() preflect.Message { 1023 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1024 return ParseMetricDescriptorIndices_FieldPath(raw) 1025 }) 1026 } 1027 1028 func (fieldMask *MetricDescriptor_Indices_FieldMask) ProtoMessage() {} 1029 1030 func (fieldMask *MetricDescriptor_Indices_FieldMask) Reset() { 1031 if fieldMask != nil { 1032 fieldMask.Paths = nil 1033 } 1034 } 1035 1036 func (fieldMask *MetricDescriptor_Indices_FieldMask) Subtract(other *MetricDescriptor_Indices_FieldMask) *MetricDescriptor_Indices_FieldMask { 1037 result := &MetricDescriptor_Indices_FieldMask{} 1038 removedSelectors := make([]bool, 3) 1039 otherSubMasks := map[MetricDescriptorIndices_FieldPathSelector]gotenobject.FieldMask{ 1040 MetricDescriptorIndices_FieldPathSelectorBuiltIn: &MetricDescriptor_Indices_IndexGroups_FieldMask{}, 1041 MetricDescriptorIndices_FieldPathSelectorUserDefined: &MetricDescriptor_Indices_IndexGroups_FieldMask{}, 1042 MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: &MetricDescriptor_Indices_NonAggregatedIndices_FieldMask{}, 1043 } 1044 mySubMasks := map[MetricDescriptorIndices_FieldPathSelector]gotenobject.FieldMask{ 1045 MetricDescriptorIndices_FieldPathSelectorBuiltIn: &MetricDescriptor_Indices_IndexGroups_FieldMask{}, 1046 MetricDescriptorIndices_FieldPathSelectorUserDefined: &MetricDescriptor_Indices_IndexGroups_FieldMask{}, 1047 MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: &MetricDescriptor_Indices_NonAggregatedIndices_FieldMask{}, 1048 } 1049 1050 for _, path := range other.GetPaths() { 1051 switch tp := path.(type) { 1052 case *MetricDescriptorIndices_FieldTerminalPath: 1053 removedSelectors[int(tp.selector)] = true 1054 case *MetricDescriptorIndices_FieldSubPath: 1055 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1056 } 1057 } 1058 for _, path := range fieldMask.GetPaths() { 1059 if !removedSelectors[int(path.Selector())] { 1060 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1061 if tp, ok := path.(*MetricDescriptorIndices_FieldTerminalPath); ok { 1062 switch tp.selector { 1063 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 1064 mySubMasks[MetricDescriptorIndices_FieldPathSelectorBuiltIn] = FullMetricDescriptor_Indices_IndexGroups_FieldMask() 1065 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 1066 mySubMasks[MetricDescriptorIndices_FieldPathSelectorUserDefined] = FullMetricDescriptor_Indices_IndexGroups_FieldMask() 1067 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 1068 mySubMasks[MetricDescriptorIndices_FieldPathSelectorLegacyMigrated] = FullMetricDescriptor_Indices_NonAggregatedIndices_FieldMask() 1069 } 1070 } else if tp, ok := path.(*MetricDescriptorIndices_FieldSubPath); ok { 1071 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 1072 } 1073 } else { 1074 result.Paths = append(result.Paths, path) 1075 } 1076 } 1077 } 1078 for selector, mySubMask := range mySubMasks { 1079 if mySubMask.PathsCount() > 0 { 1080 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 1081 result.Paths = append(result.Paths, &MetricDescriptorIndices_FieldSubPath{selector: selector, subPath: allowedPath}) 1082 } 1083 } 1084 } 1085 1086 if len(result.Paths) == 0 { 1087 return nil 1088 } 1089 return result 1090 } 1091 1092 func (fieldMask *MetricDescriptor_Indices_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1093 return fieldMask.Subtract(other.(*MetricDescriptor_Indices_FieldMask)) 1094 } 1095 1096 // FilterInputFields generates copy of field paths with output_only field paths removed 1097 func (fieldMask *MetricDescriptor_Indices_FieldMask) FilterInputFields() *MetricDescriptor_Indices_FieldMask { 1098 result := &MetricDescriptor_Indices_FieldMask{} 1099 result.Paths = append(result.Paths, fieldMask.Paths...) 1100 return result 1101 } 1102 1103 // ToFieldMask is used for proto conversions 1104 func (fieldMask *MetricDescriptor_Indices_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1105 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1106 for _, path := range fieldMask.Paths { 1107 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1108 } 1109 return protoFieldMask 1110 } 1111 1112 func (fieldMask *MetricDescriptor_Indices_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1113 if fieldMask == nil { 1114 return status.Error(codes.Internal, "target field mask is nil") 1115 } 1116 fieldMask.Paths = make([]MetricDescriptorIndices_FieldPath, 0, len(protoFieldMask.Paths)) 1117 for _, strPath := range protoFieldMask.Paths { 1118 path, err := ParseMetricDescriptorIndices_FieldPath(strPath) 1119 if err != nil { 1120 return err 1121 } 1122 fieldMask.Paths = append(fieldMask.Paths, path) 1123 } 1124 return nil 1125 } 1126 1127 // implement methods required by customType 1128 func (fieldMask MetricDescriptor_Indices_FieldMask) Marshal() ([]byte, error) { 1129 protoFieldMask := fieldMask.ToProtoFieldMask() 1130 return proto.Marshal(protoFieldMask) 1131 } 1132 1133 func (fieldMask *MetricDescriptor_Indices_FieldMask) Unmarshal(data []byte) error { 1134 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1135 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1136 return err 1137 } 1138 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1139 return err 1140 } 1141 return nil 1142 } 1143 1144 func (fieldMask *MetricDescriptor_Indices_FieldMask) Size() int { 1145 return proto.Size(fieldMask.ToProtoFieldMask()) 1146 } 1147 1148 func (fieldMask MetricDescriptor_Indices_FieldMask) MarshalJSON() ([]byte, error) { 1149 return json.Marshal(fieldMask.ToProtoFieldMask()) 1150 } 1151 1152 func (fieldMask *MetricDescriptor_Indices_FieldMask) UnmarshalJSON(data []byte) error { 1153 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1154 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1155 return err 1156 } 1157 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1158 return err 1159 } 1160 return nil 1161 } 1162 1163 func (fieldMask *MetricDescriptor_Indices_FieldMask) AppendPath(path MetricDescriptorIndices_FieldPath) { 1164 fieldMask.Paths = append(fieldMask.Paths, path) 1165 } 1166 1167 func (fieldMask *MetricDescriptor_Indices_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1168 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndices_FieldPath)) 1169 } 1170 1171 func (fieldMask *MetricDescriptor_Indices_FieldMask) GetPaths() []MetricDescriptorIndices_FieldPath { 1172 if fieldMask == nil { 1173 return nil 1174 } 1175 return fieldMask.Paths 1176 } 1177 1178 func (fieldMask *MetricDescriptor_Indices_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1179 if fieldMask == nil { 1180 return nil 1181 } 1182 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1183 for _, path := range fieldMask.Paths { 1184 rawPaths = append(rawPaths, path) 1185 } 1186 return rawPaths 1187 } 1188 1189 func (fieldMask *MetricDescriptor_Indices_FieldMask) SetFromCliFlag(raw string) error { 1190 path, err := ParseMetricDescriptorIndices_FieldPath(raw) 1191 if err != nil { 1192 return err 1193 } 1194 fieldMask.Paths = append(fieldMask.Paths, path) 1195 return nil 1196 } 1197 1198 func (fieldMask *MetricDescriptor_Indices_FieldMask) Set(target, source *MetricDescriptor_Indices) { 1199 for _, path := range fieldMask.Paths { 1200 val, _ := path.GetSingle(source) 1201 // if val is nil, then field does not exist in source, skip 1202 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1203 if val != nil { 1204 path.WithIValue(val).SetTo(&target) 1205 } 1206 } 1207 } 1208 1209 func (fieldMask *MetricDescriptor_Indices_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1210 fieldMask.Set(target.(*MetricDescriptor_Indices), source.(*MetricDescriptor_Indices)) 1211 } 1212 1213 func (fieldMask *MetricDescriptor_Indices_FieldMask) Project(source *MetricDescriptor_Indices) *MetricDescriptor_Indices { 1214 if source == nil { 1215 return nil 1216 } 1217 if fieldMask == nil { 1218 return source 1219 } 1220 result := &MetricDescriptor_Indices{} 1221 builtInMask := &MetricDescriptor_Indices_IndexGroups_FieldMask{} 1222 wholeBuiltInAccepted := false 1223 userDefinedMask := &MetricDescriptor_Indices_IndexGroups_FieldMask{} 1224 wholeUserDefinedAccepted := false 1225 legacyMigratedMask := &MetricDescriptor_Indices_NonAggregatedIndices_FieldMask{} 1226 wholeLegacyMigratedAccepted := false 1227 1228 for _, p := range fieldMask.Paths { 1229 switch tp := p.(type) { 1230 case *MetricDescriptorIndices_FieldTerminalPath: 1231 switch tp.selector { 1232 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 1233 result.BuiltIn = source.BuiltIn 1234 wholeBuiltInAccepted = true 1235 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 1236 result.UserDefined = source.UserDefined 1237 wholeUserDefinedAccepted = true 1238 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 1239 result.LegacyMigrated = source.LegacyMigrated 1240 wholeLegacyMigratedAccepted = true 1241 } 1242 case *MetricDescriptorIndices_FieldSubPath: 1243 switch tp.selector { 1244 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 1245 builtInMask.AppendPath(tp.subPath.(MetricDescriptorIndicesIndexGroups_FieldPath)) 1246 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 1247 userDefinedMask.AppendPath(tp.subPath.(MetricDescriptorIndicesIndexGroups_FieldPath)) 1248 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 1249 legacyMigratedMask.AppendPath(tp.subPath.(MetricDescriptorIndicesNonAggregatedIndices_FieldPath)) 1250 } 1251 } 1252 } 1253 if wholeBuiltInAccepted == false && len(builtInMask.Paths) > 0 { 1254 result.BuiltIn = builtInMask.Project(source.GetBuiltIn()) 1255 } 1256 if wholeUserDefinedAccepted == false && len(userDefinedMask.Paths) > 0 { 1257 result.UserDefined = userDefinedMask.Project(source.GetUserDefined()) 1258 } 1259 if wholeLegacyMigratedAccepted == false && len(legacyMigratedMask.Paths) > 0 { 1260 for _, sourceItem := range source.GetLegacyMigrated() { 1261 result.LegacyMigrated = append(result.LegacyMigrated, legacyMigratedMask.Project(sourceItem)) 1262 } 1263 } 1264 return result 1265 } 1266 1267 func (fieldMask *MetricDescriptor_Indices_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1268 return fieldMask.Project(source.(*MetricDescriptor_Indices)) 1269 } 1270 1271 func (fieldMask *MetricDescriptor_Indices_FieldMask) PathsCount() int { 1272 if fieldMask == nil { 1273 return 0 1274 } 1275 return len(fieldMask.Paths) 1276 } 1277 1278 type MetricDescriptor_StorageConfig_FieldMask struct { 1279 Paths []MetricDescriptorStorageConfig_FieldPath 1280 } 1281 1282 func FullMetricDescriptor_StorageConfig_FieldMask() *MetricDescriptor_StorageConfig_FieldMask { 1283 res := &MetricDescriptor_StorageConfig_FieldMask{} 1284 res.Paths = append(res.Paths, &MetricDescriptorStorageConfig_FieldTerminalPath{selector: MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints}) 1285 res.Paths = append(res.Paths, &MetricDescriptorStorageConfig_FieldTerminalPath{selector: MetricDescriptorStorageConfig_FieldPathSelectorMaxAp}) 1286 return res 1287 } 1288 1289 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) String() string { 1290 if fieldMask == nil { 1291 return "<nil>" 1292 } 1293 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1294 for _, path := range fieldMask.Paths { 1295 pathsStr = append(pathsStr, path.String()) 1296 } 1297 return strings.Join(pathsStr, ", ") 1298 } 1299 1300 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) IsFull() bool { 1301 if fieldMask == nil { 1302 return false 1303 } 1304 presentSelectors := make([]bool, 2) 1305 for _, path := range fieldMask.Paths { 1306 if asFinal, ok := path.(*MetricDescriptorStorageConfig_FieldTerminalPath); ok { 1307 presentSelectors[int(asFinal.selector)] = true 1308 } 1309 } 1310 for _, flag := range presentSelectors { 1311 if !flag { 1312 return false 1313 } 1314 } 1315 return true 1316 } 1317 1318 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) ProtoReflect() preflect.Message { 1319 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1320 return ParseMetricDescriptorStorageConfig_FieldPath(raw) 1321 }) 1322 } 1323 1324 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) ProtoMessage() {} 1325 1326 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) Reset() { 1327 if fieldMask != nil { 1328 fieldMask.Paths = nil 1329 } 1330 } 1331 1332 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) Subtract(other *MetricDescriptor_StorageConfig_FieldMask) *MetricDescriptor_StorageConfig_FieldMask { 1333 result := &MetricDescriptor_StorageConfig_FieldMask{} 1334 removedSelectors := make([]bool, 2) 1335 1336 for _, path := range other.GetPaths() { 1337 switch tp := path.(type) { 1338 case *MetricDescriptorStorageConfig_FieldTerminalPath: 1339 removedSelectors[int(tp.selector)] = true 1340 } 1341 } 1342 for _, path := range fieldMask.GetPaths() { 1343 if !removedSelectors[int(path.Selector())] { 1344 result.Paths = append(result.Paths, path) 1345 } 1346 } 1347 1348 if len(result.Paths) == 0 { 1349 return nil 1350 } 1351 return result 1352 } 1353 1354 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1355 return fieldMask.Subtract(other.(*MetricDescriptor_StorageConfig_FieldMask)) 1356 } 1357 1358 // FilterInputFields generates copy of field paths with output_only field paths removed 1359 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) FilterInputFields() *MetricDescriptor_StorageConfig_FieldMask { 1360 result := &MetricDescriptor_StorageConfig_FieldMask{} 1361 result.Paths = append(result.Paths, fieldMask.Paths...) 1362 return result 1363 } 1364 1365 // ToFieldMask is used for proto conversions 1366 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1367 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1368 for _, path := range fieldMask.Paths { 1369 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1370 } 1371 return protoFieldMask 1372 } 1373 1374 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1375 if fieldMask == nil { 1376 return status.Error(codes.Internal, "target field mask is nil") 1377 } 1378 fieldMask.Paths = make([]MetricDescriptorStorageConfig_FieldPath, 0, len(protoFieldMask.Paths)) 1379 for _, strPath := range protoFieldMask.Paths { 1380 path, err := ParseMetricDescriptorStorageConfig_FieldPath(strPath) 1381 if err != nil { 1382 return err 1383 } 1384 fieldMask.Paths = append(fieldMask.Paths, path) 1385 } 1386 return nil 1387 } 1388 1389 // implement methods required by customType 1390 func (fieldMask MetricDescriptor_StorageConfig_FieldMask) Marshal() ([]byte, error) { 1391 protoFieldMask := fieldMask.ToProtoFieldMask() 1392 return proto.Marshal(protoFieldMask) 1393 } 1394 1395 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) Unmarshal(data []byte) error { 1396 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1397 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1398 return err 1399 } 1400 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1401 return err 1402 } 1403 return nil 1404 } 1405 1406 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) Size() int { 1407 return proto.Size(fieldMask.ToProtoFieldMask()) 1408 } 1409 1410 func (fieldMask MetricDescriptor_StorageConfig_FieldMask) MarshalJSON() ([]byte, error) { 1411 return json.Marshal(fieldMask.ToProtoFieldMask()) 1412 } 1413 1414 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) UnmarshalJSON(data []byte) error { 1415 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1416 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1417 return err 1418 } 1419 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1420 return err 1421 } 1422 return nil 1423 } 1424 1425 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) AppendPath(path MetricDescriptorStorageConfig_FieldPath) { 1426 fieldMask.Paths = append(fieldMask.Paths, path) 1427 } 1428 1429 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1430 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorStorageConfig_FieldPath)) 1431 } 1432 1433 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) GetPaths() []MetricDescriptorStorageConfig_FieldPath { 1434 if fieldMask == nil { 1435 return nil 1436 } 1437 return fieldMask.Paths 1438 } 1439 1440 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1441 if fieldMask == nil { 1442 return nil 1443 } 1444 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1445 for _, path := range fieldMask.Paths { 1446 rawPaths = append(rawPaths, path) 1447 } 1448 return rawPaths 1449 } 1450 1451 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) SetFromCliFlag(raw string) error { 1452 path, err := ParseMetricDescriptorStorageConfig_FieldPath(raw) 1453 if err != nil { 1454 return err 1455 } 1456 fieldMask.Paths = append(fieldMask.Paths, path) 1457 return nil 1458 } 1459 1460 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) Set(target, source *MetricDescriptor_StorageConfig) { 1461 for _, path := range fieldMask.Paths { 1462 val, _ := path.GetSingle(source) 1463 // if val is nil, then field does not exist in source, skip 1464 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1465 if val != nil { 1466 path.WithIValue(val).SetTo(&target) 1467 } 1468 } 1469 } 1470 1471 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1472 fieldMask.Set(target.(*MetricDescriptor_StorageConfig), source.(*MetricDescriptor_StorageConfig)) 1473 } 1474 1475 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) Project(source *MetricDescriptor_StorageConfig) *MetricDescriptor_StorageConfig { 1476 if source == nil { 1477 return nil 1478 } 1479 if fieldMask == nil { 1480 return source 1481 } 1482 result := &MetricDescriptor_StorageConfig{} 1483 1484 for _, p := range fieldMask.Paths { 1485 switch tp := p.(type) { 1486 case *MetricDescriptorStorageConfig_FieldTerminalPath: 1487 switch tp.selector { 1488 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 1489 result.StoreRawPoints = source.StoreRawPoints 1490 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 1491 result.MaxAp = source.MaxAp 1492 } 1493 } 1494 } 1495 return result 1496 } 1497 1498 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1499 return fieldMask.Project(source.(*MetricDescriptor_StorageConfig)) 1500 } 1501 1502 func (fieldMask *MetricDescriptor_StorageConfig_FieldMask) PathsCount() int { 1503 if fieldMask == nil { 1504 return 0 1505 } 1506 return len(fieldMask.Paths) 1507 } 1508 1509 type MetricDescriptor_BinaryIndices_FieldMask struct { 1510 Paths []MetricDescriptorBinaryIndices_FieldPath 1511 } 1512 1513 func FullMetricDescriptor_BinaryIndices_FieldMask() *MetricDescriptor_BinaryIndices_FieldMask { 1514 res := &MetricDescriptor_BinaryIndices_FieldMask{} 1515 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndices_FieldTerminalPath{selector: MetricDescriptorBinaryIndices_FieldPathSelectorByResources}) 1516 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndices_FieldTerminalPath{selector: MetricDescriptorBinaryIndices_FieldPathSelectorRegion}) 1517 return res 1518 } 1519 1520 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) String() string { 1521 if fieldMask == nil { 1522 return "<nil>" 1523 } 1524 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1525 for _, path := range fieldMask.Paths { 1526 pathsStr = append(pathsStr, path.String()) 1527 } 1528 return strings.Join(pathsStr, ", ") 1529 } 1530 1531 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) IsFull() bool { 1532 if fieldMask == nil { 1533 return false 1534 } 1535 presentSelectors := make([]bool, 2) 1536 for _, path := range fieldMask.Paths { 1537 if asFinal, ok := path.(*MetricDescriptorBinaryIndices_FieldTerminalPath); ok { 1538 presentSelectors[int(asFinal.selector)] = true 1539 } 1540 } 1541 for _, flag := range presentSelectors { 1542 if !flag { 1543 return false 1544 } 1545 } 1546 return true 1547 } 1548 1549 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) ProtoReflect() preflect.Message { 1550 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1551 return ParseMetricDescriptorBinaryIndices_FieldPath(raw) 1552 }) 1553 } 1554 1555 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) ProtoMessage() {} 1556 1557 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) Reset() { 1558 if fieldMask != nil { 1559 fieldMask.Paths = nil 1560 } 1561 } 1562 1563 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) Subtract(other *MetricDescriptor_BinaryIndices_FieldMask) *MetricDescriptor_BinaryIndices_FieldMask { 1564 result := &MetricDescriptor_BinaryIndices_FieldMask{} 1565 removedSelectors := make([]bool, 2) 1566 otherSubMasks := map[MetricDescriptorBinaryIndices_FieldPathSelector]gotenobject.FieldMask{ 1567 MetricDescriptorBinaryIndices_FieldPathSelectorByResources: &MetricDescriptor_BinaryIndices_ByResourceType_FieldMask{}, 1568 } 1569 mySubMasks := map[MetricDescriptorBinaryIndices_FieldPathSelector]gotenobject.FieldMask{ 1570 MetricDescriptorBinaryIndices_FieldPathSelectorByResources: &MetricDescriptor_BinaryIndices_ByResourceType_FieldMask{}, 1571 } 1572 1573 for _, path := range other.GetPaths() { 1574 switch tp := path.(type) { 1575 case *MetricDescriptorBinaryIndices_FieldTerminalPath: 1576 removedSelectors[int(tp.selector)] = true 1577 case *MetricDescriptorBinaryIndices_FieldSubPath: 1578 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1579 } 1580 } 1581 for _, path := range fieldMask.GetPaths() { 1582 if !removedSelectors[int(path.Selector())] { 1583 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1584 if tp, ok := path.(*MetricDescriptorBinaryIndices_FieldTerminalPath); ok { 1585 switch tp.selector { 1586 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 1587 mySubMasks[MetricDescriptorBinaryIndices_FieldPathSelectorByResources] = FullMetricDescriptor_BinaryIndices_ByResourceType_FieldMask() 1588 } 1589 } else if tp, ok := path.(*MetricDescriptorBinaryIndices_FieldSubPath); ok { 1590 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 1591 } 1592 } else { 1593 result.Paths = append(result.Paths, path) 1594 } 1595 } 1596 } 1597 for selector, mySubMask := range mySubMasks { 1598 if mySubMask.PathsCount() > 0 { 1599 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 1600 result.Paths = append(result.Paths, &MetricDescriptorBinaryIndices_FieldSubPath{selector: selector, subPath: allowedPath}) 1601 } 1602 } 1603 } 1604 1605 if len(result.Paths) == 0 { 1606 return nil 1607 } 1608 return result 1609 } 1610 1611 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1612 return fieldMask.Subtract(other.(*MetricDescriptor_BinaryIndices_FieldMask)) 1613 } 1614 1615 // FilterInputFields generates copy of field paths with output_only field paths removed 1616 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) FilterInputFields() *MetricDescriptor_BinaryIndices_FieldMask { 1617 result := &MetricDescriptor_BinaryIndices_FieldMask{} 1618 result.Paths = append(result.Paths, fieldMask.Paths...) 1619 return result 1620 } 1621 1622 // ToFieldMask is used for proto conversions 1623 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1624 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1625 for _, path := range fieldMask.Paths { 1626 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1627 } 1628 return protoFieldMask 1629 } 1630 1631 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1632 if fieldMask == nil { 1633 return status.Error(codes.Internal, "target field mask is nil") 1634 } 1635 fieldMask.Paths = make([]MetricDescriptorBinaryIndices_FieldPath, 0, len(protoFieldMask.Paths)) 1636 for _, strPath := range protoFieldMask.Paths { 1637 path, err := ParseMetricDescriptorBinaryIndices_FieldPath(strPath) 1638 if err != nil { 1639 return err 1640 } 1641 fieldMask.Paths = append(fieldMask.Paths, path) 1642 } 1643 return nil 1644 } 1645 1646 // implement methods required by customType 1647 func (fieldMask MetricDescriptor_BinaryIndices_FieldMask) Marshal() ([]byte, error) { 1648 protoFieldMask := fieldMask.ToProtoFieldMask() 1649 return proto.Marshal(protoFieldMask) 1650 } 1651 1652 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) Unmarshal(data []byte) error { 1653 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1654 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1655 return err 1656 } 1657 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1658 return err 1659 } 1660 return nil 1661 } 1662 1663 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) Size() int { 1664 return proto.Size(fieldMask.ToProtoFieldMask()) 1665 } 1666 1667 func (fieldMask MetricDescriptor_BinaryIndices_FieldMask) MarshalJSON() ([]byte, error) { 1668 return json.Marshal(fieldMask.ToProtoFieldMask()) 1669 } 1670 1671 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) UnmarshalJSON(data []byte) error { 1672 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1673 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1674 return err 1675 } 1676 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1677 return err 1678 } 1679 return nil 1680 } 1681 1682 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) AppendPath(path MetricDescriptorBinaryIndices_FieldPath) { 1683 fieldMask.Paths = append(fieldMask.Paths, path) 1684 } 1685 1686 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1687 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorBinaryIndices_FieldPath)) 1688 } 1689 1690 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) GetPaths() []MetricDescriptorBinaryIndices_FieldPath { 1691 if fieldMask == nil { 1692 return nil 1693 } 1694 return fieldMask.Paths 1695 } 1696 1697 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1698 if fieldMask == nil { 1699 return nil 1700 } 1701 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1702 for _, path := range fieldMask.Paths { 1703 rawPaths = append(rawPaths, path) 1704 } 1705 return rawPaths 1706 } 1707 1708 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) SetFromCliFlag(raw string) error { 1709 path, err := ParseMetricDescriptorBinaryIndices_FieldPath(raw) 1710 if err != nil { 1711 return err 1712 } 1713 fieldMask.Paths = append(fieldMask.Paths, path) 1714 return nil 1715 } 1716 1717 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) Set(target, source *MetricDescriptor_BinaryIndices) { 1718 for _, path := range fieldMask.Paths { 1719 val, _ := path.GetSingle(source) 1720 // if val is nil, then field does not exist in source, skip 1721 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1722 if val != nil { 1723 path.WithIValue(val).SetTo(&target) 1724 } 1725 } 1726 } 1727 1728 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1729 fieldMask.Set(target.(*MetricDescriptor_BinaryIndices), source.(*MetricDescriptor_BinaryIndices)) 1730 } 1731 1732 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) Project(source *MetricDescriptor_BinaryIndices) *MetricDescriptor_BinaryIndices { 1733 if source == nil { 1734 return nil 1735 } 1736 if fieldMask == nil { 1737 return source 1738 } 1739 result := &MetricDescriptor_BinaryIndices{} 1740 byResourcesMask := &MetricDescriptor_BinaryIndices_ByResourceType_FieldMask{} 1741 wholeByResourcesAccepted := false 1742 1743 for _, p := range fieldMask.Paths { 1744 switch tp := p.(type) { 1745 case *MetricDescriptorBinaryIndices_FieldTerminalPath: 1746 switch tp.selector { 1747 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 1748 result.ByResources = source.ByResources 1749 wholeByResourcesAccepted = true 1750 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 1751 result.Region = source.Region 1752 } 1753 case *MetricDescriptorBinaryIndices_FieldSubPath: 1754 switch tp.selector { 1755 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 1756 byResourcesMask.AppendPath(tp.subPath.(MetricDescriptorBinaryIndicesByResourceType_FieldPath)) 1757 } 1758 } 1759 } 1760 if wholeByResourcesAccepted == false && len(byResourcesMask.Paths) > 0 { 1761 for _, sourceItem := range source.GetByResources() { 1762 result.ByResources = append(result.ByResources, byResourcesMask.Project(sourceItem)) 1763 } 1764 } 1765 return result 1766 } 1767 1768 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1769 return fieldMask.Project(source.(*MetricDescriptor_BinaryIndices)) 1770 } 1771 1772 func (fieldMask *MetricDescriptor_BinaryIndices_FieldMask) PathsCount() int { 1773 if fieldMask == nil { 1774 return 0 1775 } 1776 return len(fieldMask.Paths) 1777 } 1778 1779 type MetricDescriptor_IndexSpec_Index_FieldMask struct { 1780 Paths []MetricDescriptorIndexSpecIndex_FieldPath 1781 } 1782 1783 func FullMetricDescriptor_IndexSpec_Index_FieldMask() *MetricDescriptor_IndexSpec_Index_FieldMask { 1784 res := &MetricDescriptor_IndexSpec_Index_FieldMask{} 1785 res.Paths = append(res.Paths, &MetricDescriptorIndexSpecIndex_FieldTerminalPath{selector: MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels}) 1786 return res 1787 } 1788 1789 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) String() string { 1790 if fieldMask == nil { 1791 return "<nil>" 1792 } 1793 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1794 for _, path := range fieldMask.Paths { 1795 pathsStr = append(pathsStr, path.String()) 1796 } 1797 return strings.Join(pathsStr, ", ") 1798 } 1799 1800 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) IsFull() bool { 1801 if fieldMask == nil { 1802 return false 1803 } 1804 presentSelectors := make([]bool, 1) 1805 for _, path := range fieldMask.Paths { 1806 if asFinal, ok := path.(*MetricDescriptorIndexSpecIndex_FieldTerminalPath); ok { 1807 presentSelectors[int(asFinal.selector)] = true 1808 } 1809 } 1810 for _, flag := range presentSelectors { 1811 if !flag { 1812 return false 1813 } 1814 } 1815 return true 1816 } 1817 1818 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) ProtoReflect() preflect.Message { 1819 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1820 return ParseMetricDescriptorIndexSpecIndex_FieldPath(raw) 1821 }) 1822 } 1823 1824 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) ProtoMessage() {} 1825 1826 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) Reset() { 1827 if fieldMask != nil { 1828 fieldMask.Paths = nil 1829 } 1830 } 1831 1832 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) Subtract(other *MetricDescriptor_IndexSpec_Index_FieldMask) *MetricDescriptor_IndexSpec_Index_FieldMask { 1833 result := &MetricDescriptor_IndexSpec_Index_FieldMask{} 1834 removedSelectors := make([]bool, 1) 1835 1836 for _, path := range other.GetPaths() { 1837 switch tp := path.(type) { 1838 case *MetricDescriptorIndexSpecIndex_FieldTerminalPath: 1839 removedSelectors[int(tp.selector)] = true 1840 } 1841 } 1842 for _, path := range fieldMask.GetPaths() { 1843 if !removedSelectors[int(path.Selector())] { 1844 result.Paths = append(result.Paths, path) 1845 } 1846 } 1847 1848 if len(result.Paths) == 0 { 1849 return nil 1850 } 1851 return result 1852 } 1853 1854 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1855 return fieldMask.Subtract(other.(*MetricDescriptor_IndexSpec_Index_FieldMask)) 1856 } 1857 1858 // FilterInputFields generates copy of field paths with output_only field paths removed 1859 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) FilterInputFields() *MetricDescriptor_IndexSpec_Index_FieldMask { 1860 result := &MetricDescriptor_IndexSpec_Index_FieldMask{} 1861 result.Paths = append(result.Paths, fieldMask.Paths...) 1862 return result 1863 } 1864 1865 // ToFieldMask is used for proto conversions 1866 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1867 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1868 for _, path := range fieldMask.Paths { 1869 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1870 } 1871 return protoFieldMask 1872 } 1873 1874 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1875 if fieldMask == nil { 1876 return status.Error(codes.Internal, "target field mask is nil") 1877 } 1878 fieldMask.Paths = make([]MetricDescriptorIndexSpecIndex_FieldPath, 0, len(protoFieldMask.Paths)) 1879 for _, strPath := range protoFieldMask.Paths { 1880 path, err := ParseMetricDescriptorIndexSpecIndex_FieldPath(strPath) 1881 if err != nil { 1882 return err 1883 } 1884 fieldMask.Paths = append(fieldMask.Paths, path) 1885 } 1886 return nil 1887 } 1888 1889 // implement methods required by customType 1890 func (fieldMask MetricDescriptor_IndexSpec_Index_FieldMask) Marshal() ([]byte, error) { 1891 protoFieldMask := fieldMask.ToProtoFieldMask() 1892 return proto.Marshal(protoFieldMask) 1893 } 1894 1895 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) Unmarshal(data []byte) error { 1896 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1897 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1898 return err 1899 } 1900 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1901 return err 1902 } 1903 return nil 1904 } 1905 1906 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) Size() int { 1907 return proto.Size(fieldMask.ToProtoFieldMask()) 1908 } 1909 1910 func (fieldMask MetricDescriptor_IndexSpec_Index_FieldMask) MarshalJSON() ([]byte, error) { 1911 return json.Marshal(fieldMask.ToProtoFieldMask()) 1912 } 1913 1914 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) UnmarshalJSON(data []byte) error { 1915 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1916 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1917 return err 1918 } 1919 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1920 return err 1921 } 1922 return nil 1923 } 1924 1925 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) AppendPath(path MetricDescriptorIndexSpecIndex_FieldPath) { 1926 fieldMask.Paths = append(fieldMask.Paths, path) 1927 } 1928 1929 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1930 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndexSpecIndex_FieldPath)) 1931 } 1932 1933 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) GetPaths() []MetricDescriptorIndexSpecIndex_FieldPath { 1934 if fieldMask == nil { 1935 return nil 1936 } 1937 return fieldMask.Paths 1938 } 1939 1940 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1941 if fieldMask == nil { 1942 return nil 1943 } 1944 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1945 for _, path := range fieldMask.Paths { 1946 rawPaths = append(rawPaths, path) 1947 } 1948 return rawPaths 1949 } 1950 1951 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) SetFromCliFlag(raw string) error { 1952 path, err := ParseMetricDescriptorIndexSpecIndex_FieldPath(raw) 1953 if err != nil { 1954 return err 1955 } 1956 fieldMask.Paths = append(fieldMask.Paths, path) 1957 return nil 1958 } 1959 1960 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) Set(target, source *MetricDescriptor_IndexSpec_Index) { 1961 for _, path := range fieldMask.Paths { 1962 val, _ := path.GetSingle(source) 1963 // if val is nil, then field does not exist in source, skip 1964 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1965 if val != nil { 1966 path.WithIValue(val).SetTo(&target) 1967 } 1968 } 1969 } 1970 1971 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1972 fieldMask.Set(target.(*MetricDescriptor_IndexSpec_Index), source.(*MetricDescriptor_IndexSpec_Index)) 1973 } 1974 1975 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) Project(source *MetricDescriptor_IndexSpec_Index) *MetricDescriptor_IndexSpec_Index { 1976 if source == nil { 1977 return nil 1978 } 1979 if fieldMask == nil { 1980 return source 1981 } 1982 result := &MetricDescriptor_IndexSpec_Index{} 1983 1984 for _, p := range fieldMask.Paths { 1985 switch tp := p.(type) { 1986 case *MetricDescriptorIndexSpecIndex_FieldTerminalPath: 1987 switch tp.selector { 1988 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 1989 result.PromotedLabels = source.PromotedLabels 1990 } 1991 } 1992 } 1993 return result 1994 } 1995 1996 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1997 return fieldMask.Project(source.(*MetricDescriptor_IndexSpec_Index)) 1998 } 1999 2000 func (fieldMask *MetricDescriptor_IndexSpec_Index_FieldMask) PathsCount() int { 2001 if fieldMask == nil { 2002 return 0 2003 } 2004 return len(fieldMask.Paths) 2005 } 2006 2007 type MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask struct { 2008 Paths []MetricDescriptorIndexSpecPerMonitoredResource_FieldPath 2009 } 2010 2011 func FullMetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask() *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask { 2012 res := &MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask{} 2013 res.Paths = append(res.Paths, &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath{selector: MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource}) 2014 res.Paths = append(res.Paths, &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath{selector: MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices}) 2015 return res 2016 } 2017 2018 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) String() string { 2019 if fieldMask == nil { 2020 return "<nil>" 2021 } 2022 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2023 for _, path := range fieldMask.Paths { 2024 pathsStr = append(pathsStr, path.String()) 2025 } 2026 return strings.Join(pathsStr, ", ") 2027 } 2028 2029 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) IsFull() bool { 2030 if fieldMask == nil { 2031 return false 2032 } 2033 presentSelectors := make([]bool, 2) 2034 for _, path := range fieldMask.Paths { 2035 if asFinal, ok := path.(*MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath); ok { 2036 presentSelectors[int(asFinal.selector)] = true 2037 } 2038 } 2039 for _, flag := range presentSelectors { 2040 if !flag { 2041 return false 2042 } 2043 } 2044 return true 2045 } 2046 2047 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) ProtoReflect() preflect.Message { 2048 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2049 return ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(raw) 2050 }) 2051 } 2052 2053 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) ProtoMessage() {} 2054 2055 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) Reset() { 2056 if fieldMask != nil { 2057 fieldMask.Paths = nil 2058 } 2059 } 2060 2061 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) Subtract(other *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask { 2062 result := &MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask{} 2063 removedSelectors := make([]bool, 2) 2064 otherSubMasks := map[MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector]gotenobject.FieldMask{ 2065 MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: &MetricDescriptor_IndexSpec_Index_FieldMask{}, 2066 } 2067 mySubMasks := map[MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector]gotenobject.FieldMask{ 2068 MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: &MetricDescriptor_IndexSpec_Index_FieldMask{}, 2069 } 2070 2071 for _, path := range other.GetPaths() { 2072 switch tp := path.(type) { 2073 case *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath: 2074 removedSelectors[int(tp.selector)] = true 2075 case *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath: 2076 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 2077 } 2078 } 2079 for _, path := range fieldMask.GetPaths() { 2080 if !removedSelectors[int(path.Selector())] { 2081 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 2082 if tp, ok := path.(*MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath); ok { 2083 switch tp.selector { 2084 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 2085 mySubMasks[MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices] = FullMetricDescriptor_IndexSpec_Index_FieldMask() 2086 } 2087 } else if tp, ok := path.(*MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath); ok { 2088 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 2089 } 2090 } else { 2091 result.Paths = append(result.Paths, path) 2092 } 2093 } 2094 } 2095 for selector, mySubMask := range mySubMasks { 2096 if mySubMask.PathsCount() > 0 { 2097 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 2098 result.Paths = append(result.Paths, &MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath{selector: selector, subPath: allowedPath}) 2099 } 2100 } 2101 } 2102 2103 if len(result.Paths) == 0 { 2104 return nil 2105 } 2106 return result 2107 } 2108 2109 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2110 return fieldMask.Subtract(other.(*MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask)) 2111 } 2112 2113 // FilterInputFields generates copy of field paths with output_only field paths removed 2114 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) FilterInputFields() *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask { 2115 result := &MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask{} 2116 result.Paths = append(result.Paths, fieldMask.Paths...) 2117 return result 2118 } 2119 2120 // ToFieldMask is used for proto conversions 2121 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2122 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2123 for _, path := range fieldMask.Paths { 2124 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2125 } 2126 return protoFieldMask 2127 } 2128 2129 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2130 if fieldMask == nil { 2131 return status.Error(codes.Internal, "target field mask is nil") 2132 } 2133 fieldMask.Paths = make([]MetricDescriptorIndexSpecPerMonitoredResource_FieldPath, 0, len(protoFieldMask.Paths)) 2134 for _, strPath := range protoFieldMask.Paths { 2135 path, err := ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(strPath) 2136 if err != nil { 2137 return err 2138 } 2139 fieldMask.Paths = append(fieldMask.Paths, path) 2140 } 2141 return nil 2142 } 2143 2144 // implement methods required by customType 2145 func (fieldMask MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) Marshal() ([]byte, error) { 2146 protoFieldMask := fieldMask.ToProtoFieldMask() 2147 return proto.Marshal(protoFieldMask) 2148 } 2149 2150 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) Unmarshal(data []byte) error { 2151 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2152 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2153 return err 2154 } 2155 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2156 return err 2157 } 2158 return nil 2159 } 2160 2161 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) Size() int { 2162 return proto.Size(fieldMask.ToProtoFieldMask()) 2163 } 2164 2165 func (fieldMask MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) MarshalJSON() ([]byte, error) { 2166 return json.Marshal(fieldMask.ToProtoFieldMask()) 2167 } 2168 2169 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) UnmarshalJSON(data []byte) error { 2170 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2171 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2172 return err 2173 } 2174 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2175 return err 2176 } 2177 return nil 2178 } 2179 2180 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) AppendPath(path MetricDescriptorIndexSpecPerMonitoredResource_FieldPath) { 2181 fieldMask.Paths = append(fieldMask.Paths, path) 2182 } 2183 2184 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2185 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndexSpecPerMonitoredResource_FieldPath)) 2186 } 2187 2188 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) GetPaths() []MetricDescriptorIndexSpecPerMonitoredResource_FieldPath { 2189 if fieldMask == nil { 2190 return nil 2191 } 2192 return fieldMask.Paths 2193 } 2194 2195 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2196 if fieldMask == nil { 2197 return nil 2198 } 2199 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2200 for _, path := range fieldMask.Paths { 2201 rawPaths = append(rawPaths, path) 2202 } 2203 return rawPaths 2204 } 2205 2206 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) SetFromCliFlag(raw string) error { 2207 path, err := ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(raw) 2208 if err != nil { 2209 return err 2210 } 2211 fieldMask.Paths = append(fieldMask.Paths, path) 2212 return nil 2213 } 2214 2215 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) Set(target, source *MetricDescriptor_IndexSpec_PerMonitoredResource) { 2216 for _, path := range fieldMask.Paths { 2217 val, _ := path.GetSingle(source) 2218 // if val is nil, then field does not exist in source, skip 2219 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2220 if val != nil { 2221 path.WithIValue(val).SetTo(&target) 2222 } 2223 } 2224 } 2225 2226 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2227 fieldMask.Set(target.(*MetricDescriptor_IndexSpec_PerMonitoredResource), source.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 2228 } 2229 2230 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) Project(source *MetricDescriptor_IndexSpec_PerMonitoredResource) *MetricDescriptor_IndexSpec_PerMonitoredResource { 2231 if source == nil { 2232 return nil 2233 } 2234 if fieldMask == nil { 2235 return source 2236 } 2237 result := &MetricDescriptor_IndexSpec_PerMonitoredResource{} 2238 indicesMask := &MetricDescriptor_IndexSpec_Index_FieldMask{} 2239 wholeIndicesAccepted := false 2240 2241 for _, p := range fieldMask.Paths { 2242 switch tp := p.(type) { 2243 case *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath: 2244 switch tp.selector { 2245 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 2246 result.Resource = source.Resource 2247 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 2248 result.Indices = source.Indices 2249 wholeIndicesAccepted = true 2250 } 2251 case *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath: 2252 switch tp.selector { 2253 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 2254 indicesMask.AppendPath(tp.subPath.(MetricDescriptorIndexSpecIndex_FieldPath)) 2255 } 2256 } 2257 } 2258 if wholeIndicesAccepted == false && len(indicesMask.Paths) > 0 { 2259 for _, sourceItem := range source.GetIndices() { 2260 result.Indices = append(result.Indices, indicesMask.Project(sourceItem)) 2261 } 2262 } 2263 return result 2264 } 2265 2266 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2267 return fieldMask.Project(source.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 2268 } 2269 2270 func (fieldMask *MetricDescriptor_IndexSpec_PerMonitoredResource_FieldMask) PathsCount() int { 2271 if fieldMask == nil { 2272 return 0 2273 } 2274 return len(fieldMask.Paths) 2275 } 2276 2277 type MetricDescriptor_Indices_LabelsGroup_FieldMask struct { 2278 Paths []MetricDescriptorIndicesLabelsGroup_FieldPath 2279 } 2280 2281 func FullMetricDescriptor_Indices_LabelsGroup_FieldMask() *MetricDescriptor_Indices_LabelsGroup_FieldMask { 2282 res := &MetricDescriptor_Indices_LabelsGroup_FieldMask{} 2283 res.Paths = append(res.Paths, &MetricDescriptorIndicesLabelsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName}) 2284 res.Paths = append(res.Paths, &MetricDescriptorIndicesLabelsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys}) 2285 res.Paths = append(res.Paths, &MetricDescriptorIndicesLabelsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys}) 2286 res.Paths = append(res.Paths, &MetricDescriptorIndicesLabelsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus}) 2287 return res 2288 } 2289 2290 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) String() string { 2291 if fieldMask == nil { 2292 return "<nil>" 2293 } 2294 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2295 for _, path := range fieldMask.Paths { 2296 pathsStr = append(pathsStr, path.String()) 2297 } 2298 return strings.Join(pathsStr, ", ") 2299 } 2300 2301 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) IsFull() bool { 2302 if fieldMask == nil { 2303 return false 2304 } 2305 presentSelectors := make([]bool, 4) 2306 for _, path := range fieldMask.Paths { 2307 if asFinal, ok := path.(*MetricDescriptorIndicesLabelsGroup_FieldTerminalPath); ok { 2308 presentSelectors[int(asFinal.selector)] = true 2309 } 2310 } 2311 for _, flag := range presentSelectors { 2312 if !flag { 2313 return false 2314 } 2315 } 2316 return true 2317 } 2318 2319 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) ProtoReflect() preflect.Message { 2320 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2321 return ParseMetricDescriptorIndicesLabelsGroup_FieldPath(raw) 2322 }) 2323 } 2324 2325 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) ProtoMessage() {} 2326 2327 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) Reset() { 2328 if fieldMask != nil { 2329 fieldMask.Paths = nil 2330 } 2331 } 2332 2333 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) Subtract(other *MetricDescriptor_Indices_LabelsGroup_FieldMask) *MetricDescriptor_Indices_LabelsGroup_FieldMask { 2334 result := &MetricDescriptor_Indices_LabelsGroup_FieldMask{} 2335 removedSelectors := make([]bool, 4) 2336 2337 for _, path := range other.GetPaths() { 2338 switch tp := path.(type) { 2339 case *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: 2340 removedSelectors[int(tp.selector)] = true 2341 } 2342 } 2343 for _, path := range fieldMask.GetPaths() { 2344 if !removedSelectors[int(path.Selector())] { 2345 result.Paths = append(result.Paths, path) 2346 } 2347 } 2348 2349 if len(result.Paths) == 0 { 2350 return nil 2351 } 2352 return result 2353 } 2354 2355 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2356 return fieldMask.Subtract(other.(*MetricDescriptor_Indices_LabelsGroup_FieldMask)) 2357 } 2358 2359 // FilterInputFields generates copy of field paths with output_only field paths removed 2360 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) FilterInputFields() *MetricDescriptor_Indices_LabelsGroup_FieldMask { 2361 result := &MetricDescriptor_Indices_LabelsGroup_FieldMask{} 2362 result.Paths = append(result.Paths, fieldMask.Paths...) 2363 return result 2364 } 2365 2366 // ToFieldMask is used for proto conversions 2367 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2368 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2369 for _, path := range fieldMask.Paths { 2370 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2371 } 2372 return protoFieldMask 2373 } 2374 2375 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2376 if fieldMask == nil { 2377 return status.Error(codes.Internal, "target field mask is nil") 2378 } 2379 fieldMask.Paths = make([]MetricDescriptorIndicesLabelsGroup_FieldPath, 0, len(protoFieldMask.Paths)) 2380 for _, strPath := range protoFieldMask.Paths { 2381 path, err := ParseMetricDescriptorIndicesLabelsGroup_FieldPath(strPath) 2382 if err != nil { 2383 return err 2384 } 2385 fieldMask.Paths = append(fieldMask.Paths, path) 2386 } 2387 return nil 2388 } 2389 2390 // implement methods required by customType 2391 func (fieldMask MetricDescriptor_Indices_LabelsGroup_FieldMask) Marshal() ([]byte, error) { 2392 protoFieldMask := fieldMask.ToProtoFieldMask() 2393 return proto.Marshal(protoFieldMask) 2394 } 2395 2396 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) Unmarshal(data []byte) error { 2397 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2398 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2399 return err 2400 } 2401 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2402 return err 2403 } 2404 return nil 2405 } 2406 2407 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) Size() int { 2408 return proto.Size(fieldMask.ToProtoFieldMask()) 2409 } 2410 2411 func (fieldMask MetricDescriptor_Indices_LabelsGroup_FieldMask) MarshalJSON() ([]byte, error) { 2412 return json.Marshal(fieldMask.ToProtoFieldMask()) 2413 } 2414 2415 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) UnmarshalJSON(data []byte) error { 2416 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2417 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2418 return err 2419 } 2420 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2421 return err 2422 } 2423 return nil 2424 } 2425 2426 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) AppendPath(path MetricDescriptorIndicesLabelsGroup_FieldPath) { 2427 fieldMask.Paths = append(fieldMask.Paths, path) 2428 } 2429 2430 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2431 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndicesLabelsGroup_FieldPath)) 2432 } 2433 2434 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) GetPaths() []MetricDescriptorIndicesLabelsGroup_FieldPath { 2435 if fieldMask == nil { 2436 return nil 2437 } 2438 return fieldMask.Paths 2439 } 2440 2441 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2442 if fieldMask == nil { 2443 return nil 2444 } 2445 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2446 for _, path := range fieldMask.Paths { 2447 rawPaths = append(rawPaths, path) 2448 } 2449 return rawPaths 2450 } 2451 2452 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) SetFromCliFlag(raw string) error { 2453 path, err := ParseMetricDescriptorIndicesLabelsGroup_FieldPath(raw) 2454 if err != nil { 2455 return err 2456 } 2457 fieldMask.Paths = append(fieldMask.Paths, path) 2458 return nil 2459 } 2460 2461 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) Set(target, source *MetricDescriptor_Indices_LabelsGroup) { 2462 for _, path := range fieldMask.Paths { 2463 val, _ := path.GetSingle(source) 2464 // if val is nil, then field does not exist in source, skip 2465 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2466 if val != nil { 2467 path.WithIValue(val).SetTo(&target) 2468 } 2469 } 2470 } 2471 2472 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2473 fieldMask.Set(target.(*MetricDescriptor_Indices_LabelsGroup), source.(*MetricDescriptor_Indices_LabelsGroup)) 2474 } 2475 2476 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) Project(source *MetricDescriptor_Indices_LabelsGroup) *MetricDescriptor_Indices_LabelsGroup { 2477 if source == nil { 2478 return nil 2479 } 2480 if fieldMask == nil { 2481 return source 2482 } 2483 result := &MetricDescriptor_Indices_LabelsGroup{} 2484 2485 for _, p := range fieldMask.Paths { 2486 switch tp := p.(type) { 2487 case *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: 2488 switch tp.selector { 2489 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 2490 result.Name = source.Name 2491 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 2492 result.MetricKeys = source.MetricKeys 2493 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 2494 result.ResourceKeys = source.ResourceKeys 2495 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 2496 result.ClosingStatus = source.ClosingStatus 2497 } 2498 } 2499 } 2500 return result 2501 } 2502 2503 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2504 return fieldMask.Project(source.(*MetricDescriptor_Indices_LabelsGroup)) 2505 } 2506 2507 func (fieldMask *MetricDescriptor_Indices_LabelsGroup_FieldMask) PathsCount() int { 2508 if fieldMask == nil { 2509 return 0 2510 } 2511 return len(fieldMask.Paths) 2512 } 2513 2514 type MetricDescriptor_Indices_PaginationView_FieldMask struct { 2515 Paths []MetricDescriptorIndicesPaginationView_FieldPath 2516 } 2517 2518 func FullMetricDescriptor_Indices_PaginationView_FieldMask() *MetricDescriptor_Indices_PaginationView_FieldMask { 2519 res := &MetricDescriptor_Indices_PaginationView_FieldMask{} 2520 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorName}) 2521 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys}) 2522 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys}) 2523 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys}) 2524 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys}) 2525 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus}) 2526 return res 2527 } 2528 2529 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) String() string { 2530 if fieldMask == nil { 2531 return "<nil>" 2532 } 2533 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2534 for _, path := range fieldMask.Paths { 2535 pathsStr = append(pathsStr, path.String()) 2536 } 2537 return strings.Join(pathsStr, ", ") 2538 } 2539 2540 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) IsFull() bool { 2541 if fieldMask == nil { 2542 return false 2543 } 2544 presentSelectors := make([]bool, 6) 2545 for _, path := range fieldMask.Paths { 2546 if asFinal, ok := path.(*MetricDescriptorIndicesPaginationView_FieldTerminalPath); ok { 2547 presentSelectors[int(asFinal.selector)] = true 2548 } 2549 } 2550 for _, flag := range presentSelectors { 2551 if !flag { 2552 return false 2553 } 2554 } 2555 return true 2556 } 2557 2558 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) ProtoReflect() preflect.Message { 2559 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2560 return ParseMetricDescriptorIndicesPaginationView_FieldPath(raw) 2561 }) 2562 } 2563 2564 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) ProtoMessage() {} 2565 2566 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) Reset() { 2567 if fieldMask != nil { 2568 fieldMask.Paths = nil 2569 } 2570 } 2571 2572 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) Subtract(other *MetricDescriptor_Indices_PaginationView_FieldMask) *MetricDescriptor_Indices_PaginationView_FieldMask { 2573 result := &MetricDescriptor_Indices_PaginationView_FieldMask{} 2574 removedSelectors := make([]bool, 6) 2575 2576 for _, path := range other.GetPaths() { 2577 switch tp := path.(type) { 2578 case *MetricDescriptorIndicesPaginationView_FieldTerminalPath: 2579 removedSelectors[int(tp.selector)] = true 2580 } 2581 } 2582 for _, path := range fieldMask.GetPaths() { 2583 if !removedSelectors[int(path.Selector())] { 2584 result.Paths = append(result.Paths, path) 2585 } 2586 } 2587 2588 if len(result.Paths) == 0 { 2589 return nil 2590 } 2591 return result 2592 } 2593 2594 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2595 return fieldMask.Subtract(other.(*MetricDescriptor_Indices_PaginationView_FieldMask)) 2596 } 2597 2598 // FilterInputFields generates copy of field paths with output_only field paths removed 2599 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) FilterInputFields() *MetricDescriptor_Indices_PaginationView_FieldMask { 2600 result := &MetricDescriptor_Indices_PaginationView_FieldMask{} 2601 result.Paths = append(result.Paths, fieldMask.Paths...) 2602 return result 2603 } 2604 2605 // ToFieldMask is used for proto conversions 2606 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2607 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2608 for _, path := range fieldMask.Paths { 2609 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2610 } 2611 return protoFieldMask 2612 } 2613 2614 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2615 if fieldMask == nil { 2616 return status.Error(codes.Internal, "target field mask is nil") 2617 } 2618 fieldMask.Paths = make([]MetricDescriptorIndicesPaginationView_FieldPath, 0, len(protoFieldMask.Paths)) 2619 for _, strPath := range protoFieldMask.Paths { 2620 path, err := ParseMetricDescriptorIndicesPaginationView_FieldPath(strPath) 2621 if err != nil { 2622 return err 2623 } 2624 fieldMask.Paths = append(fieldMask.Paths, path) 2625 } 2626 return nil 2627 } 2628 2629 // implement methods required by customType 2630 func (fieldMask MetricDescriptor_Indices_PaginationView_FieldMask) Marshal() ([]byte, error) { 2631 protoFieldMask := fieldMask.ToProtoFieldMask() 2632 return proto.Marshal(protoFieldMask) 2633 } 2634 2635 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) Unmarshal(data []byte) error { 2636 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2637 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2638 return err 2639 } 2640 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2641 return err 2642 } 2643 return nil 2644 } 2645 2646 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) Size() int { 2647 return proto.Size(fieldMask.ToProtoFieldMask()) 2648 } 2649 2650 func (fieldMask MetricDescriptor_Indices_PaginationView_FieldMask) MarshalJSON() ([]byte, error) { 2651 return json.Marshal(fieldMask.ToProtoFieldMask()) 2652 } 2653 2654 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) UnmarshalJSON(data []byte) error { 2655 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2656 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2657 return err 2658 } 2659 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2660 return err 2661 } 2662 return nil 2663 } 2664 2665 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) AppendPath(path MetricDescriptorIndicesPaginationView_FieldPath) { 2666 fieldMask.Paths = append(fieldMask.Paths, path) 2667 } 2668 2669 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2670 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndicesPaginationView_FieldPath)) 2671 } 2672 2673 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) GetPaths() []MetricDescriptorIndicesPaginationView_FieldPath { 2674 if fieldMask == nil { 2675 return nil 2676 } 2677 return fieldMask.Paths 2678 } 2679 2680 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2681 if fieldMask == nil { 2682 return nil 2683 } 2684 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2685 for _, path := range fieldMask.Paths { 2686 rawPaths = append(rawPaths, path) 2687 } 2688 return rawPaths 2689 } 2690 2691 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) SetFromCliFlag(raw string) error { 2692 path, err := ParseMetricDescriptorIndicesPaginationView_FieldPath(raw) 2693 if err != nil { 2694 return err 2695 } 2696 fieldMask.Paths = append(fieldMask.Paths, path) 2697 return nil 2698 } 2699 2700 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) Set(target, source *MetricDescriptor_Indices_PaginationView) { 2701 for _, path := range fieldMask.Paths { 2702 val, _ := path.GetSingle(source) 2703 // if val is nil, then field does not exist in source, skip 2704 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2705 if val != nil { 2706 path.WithIValue(val).SetTo(&target) 2707 } 2708 } 2709 } 2710 2711 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2712 fieldMask.Set(target.(*MetricDescriptor_Indices_PaginationView), source.(*MetricDescriptor_Indices_PaginationView)) 2713 } 2714 2715 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) Project(source *MetricDescriptor_Indices_PaginationView) *MetricDescriptor_Indices_PaginationView { 2716 if source == nil { 2717 return nil 2718 } 2719 if fieldMask == nil { 2720 return source 2721 } 2722 result := &MetricDescriptor_Indices_PaginationView{} 2723 2724 for _, p := range fieldMask.Paths { 2725 switch tp := p.(type) { 2726 case *MetricDescriptorIndicesPaginationView_FieldTerminalPath: 2727 switch tp.selector { 2728 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 2729 result.Name = source.Name 2730 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 2731 result.FilterableMetricKeys = source.FilterableMetricKeys 2732 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 2733 result.FilterableResourceKeys = source.FilterableResourceKeys 2734 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 2735 result.PaginatedMetricKeys = source.PaginatedMetricKeys 2736 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 2737 result.PaginatedResourceKeys = source.PaginatedResourceKeys 2738 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 2739 result.ClosingStatus = source.ClosingStatus 2740 } 2741 } 2742 } 2743 return result 2744 } 2745 2746 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2747 return fieldMask.Project(source.(*MetricDescriptor_Indices_PaginationView)) 2748 } 2749 2750 func (fieldMask *MetricDescriptor_Indices_PaginationView_FieldMask) PathsCount() int { 2751 if fieldMask == nil { 2752 return 0 2753 } 2754 return len(fieldMask.Paths) 2755 } 2756 2757 type MetricDescriptor_Indices_AggregationsGroup_FieldMask struct { 2758 Paths []MetricDescriptorIndicesAggregationsGroup_FieldPath 2759 } 2760 2761 func FullMetricDescriptor_Indices_AggregationsGroup_FieldMask() *MetricDescriptor_Indices_AggregationsGroup_FieldMask { 2762 res := &MetricDescriptor_Indices_AggregationsGroup_FieldMask{} 2763 res.Paths = append(res.Paths, &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName}) 2764 res.Paths = append(res.Paths, &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners}) 2765 res.Paths = append(res.Paths, &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers}) 2766 res.Paths = append(res.Paths, &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus}) 2767 res.Paths = append(res.Paths, &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners}) 2768 return res 2769 } 2770 2771 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) String() string { 2772 if fieldMask == nil { 2773 return "<nil>" 2774 } 2775 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2776 for _, path := range fieldMask.Paths { 2777 pathsStr = append(pathsStr, path.String()) 2778 } 2779 return strings.Join(pathsStr, ", ") 2780 } 2781 2782 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) IsFull() bool { 2783 if fieldMask == nil { 2784 return false 2785 } 2786 presentSelectors := make([]bool, 5) 2787 for _, path := range fieldMask.Paths { 2788 if asFinal, ok := path.(*MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath); ok { 2789 presentSelectors[int(asFinal.selector)] = true 2790 } 2791 } 2792 for _, flag := range presentSelectors { 2793 if !flag { 2794 return false 2795 } 2796 } 2797 return true 2798 } 2799 2800 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) ProtoReflect() preflect.Message { 2801 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2802 return ParseMetricDescriptorIndicesAggregationsGroup_FieldPath(raw) 2803 }) 2804 } 2805 2806 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) ProtoMessage() {} 2807 2808 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) Reset() { 2809 if fieldMask != nil { 2810 fieldMask.Paths = nil 2811 } 2812 } 2813 2814 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) Subtract(other *MetricDescriptor_Indices_AggregationsGroup_FieldMask) *MetricDescriptor_Indices_AggregationsGroup_FieldMask { 2815 result := &MetricDescriptor_Indices_AggregationsGroup_FieldMask{} 2816 removedSelectors := make([]bool, 5) 2817 2818 for _, path := range other.GetPaths() { 2819 switch tp := path.(type) { 2820 case *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: 2821 removedSelectors[int(tp.selector)] = true 2822 } 2823 } 2824 for _, path := range fieldMask.GetPaths() { 2825 if !removedSelectors[int(path.Selector())] { 2826 result.Paths = append(result.Paths, path) 2827 } 2828 } 2829 2830 if len(result.Paths) == 0 { 2831 return nil 2832 } 2833 return result 2834 } 2835 2836 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2837 return fieldMask.Subtract(other.(*MetricDescriptor_Indices_AggregationsGroup_FieldMask)) 2838 } 2839 2840 // FilterInputFields generates copy of field paths with output_only field paths removed 2841 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) FilterInputFields() *MetricDescriptor_Indices_AggregationsGroup_FieldMask { 2842 result := &MetricDescriptor_Indices_AggregationsGroup_FieldMask{} 2843 result.Paths = append(result.Paths, fieldMask.Paths...) 2844 return result 2845 } 2846 2847 // ToFieldMask is used for proto conversions 2848 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2849 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2850 for _, path := range fieldMask.Paths { 2851 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2852 } 2853 return protoFieldMask 2854 } 2855 2856 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2857 if fieldMask == nil { 2858 return status.Error(codes.Internal, "target field mask is nil") 2859 } 2860 fieldMask.Paths = make([]MetricDescriptorIndicesAggregationsGroup_FieldPath, 0, len(protoFieldMask.Paths)) 2861 for _, strPath := range protoFieldMask.Paths { 2862 path, err := ParseMetricDescriptorIndicesAggregationsGroup_FieldPath(strPath) 2863 if err != nil { 2864 return err 2865 } 2866 fieldMask.Paths = append(fieldMask.Paths, path) 2867 } 2868 return nil 2869 } 2870 2871 // implement methods required by customType 2872 func (fieldMask MetricDescriptor_Indices_AggregationsGroup_FieldMask) Marshal() ([]byte, error) { 2873 protoFieldMask := fieldMask.ToProtoFieldMask() 2874 return proto.Marshal(protoFieldMask) 2875 } 2876 2877 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) Unmarshal(data []byte) error { 2878 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2879 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2880 return err 2881 } 2882 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2883 return err 2884 } 2885 return nil 2886 } 2887 2888 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) Size() int { 2889 return proto.Size(fieldMask.ToProtoFieldMask()) 2890 } 2891 2892 func (fieldMask MetricDescriptor_Indices_AggregationsGroup_FieldMask) MarshalJSON() ([]byte, error) { 2893 return json.Marshal(fieldMask.ToProtoFieldMask()) 2894 } 2895 2896 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) UnmarshalJSON(data []byte) error { 2897 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2898 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2899 return err 2900 } 2901 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2902 return err 2903 } 2904 return nil 2905 } 2906 2907 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) AppendPath(path MetricDescriptorIndicesAggregationsGroup_FieldPath) { 2908 fieldMask.Paths = append(fieldMask.Paths, path) 2909 } 2910 2911 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2912 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndicesAggregationsGroup_FieldPath)) 2913 } 2914 2915 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) GetPaths() []MetricDescriptorIndicesAggregationsGroup_FieldPath { 2916 if fieldMask == nil { 2917 return nil 2918 } 2919 return fieldMask.Paths 2920 } 2921 2922 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2923 if fieldMask == nil { 2924 return nil 2925 } 2926 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2927 for _, path := range fieldMask.Paths { 2928 rawPaths = append(rawPaths, path) 2929 } 2930 return rawPaths 2931 } 2932 2933 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) SetFromCliFlag(raw string) error { 2934 path, err := ParseMetricDescriptorIndicesAggregationsGroup_FieldPath(raw) 2935 if err != nil { 2936 return err 2937 } 2938 fieldMask.Paths = append(fieldMask.Paths, path) 2939 return nil 2940 } 2941 2942 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) Set(target, source *MetricDescriptor_Indices_AggregationsGroup) { 2943 for _, path := range fieldMask.Paths { 2944 val, _ := path.GetSingle(source) 2945 // if val is nil, then field does not exist in source, skip 2946 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2947 if val != nil { 2948 path.WithIValue(val).SetTo(&target) 2949 } 2950 } 2951 } 2952 2953 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2954 fieldMask.Set(target.(*MetricDescriptor_Indices_AggregationsGroup), source.(*MetricDescriptor_Indices_AggregationsGroup)) 2955 } 2956 2957 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) Project(source *MetricDescriptor_Indices_AggregationsGroup) *MetricDescriptor_Indices_AggregationsGroup { 2958 if source == nil { 2959 return nil 2960 } 2961 if fieldMask == nil { 2962 return source 2963 } 2964 result := &MetricDescriptor_Indices_AggregationsGroup{} 2965 2966 for _, p := range fieldMask.Paths { 2967 switch tp := p.(type) { 2968 case *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: 2969 switch tp.selector { 2970 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 2971 result.Name = source.Name 2972 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 2973 result.PerSeriesAligners = source.PerSeriesAligners 2974 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 2975 result.CrossSeriesReducers = source.CrossSeriesReducers 2976 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 2977 result.ClosingStatus = source.ClosingStatus 2978 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 2979 result.StorageAligners = source.StorageAligners 2980 } 2981 } 2982 } 2983 return result 2984 } 2985 2986 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2987 return fieldMask.Project(source.(*MetricDescriptor_Indices_AggregationsGroup)) 2988 } 2989 2990 func (fieldMask *MetricDescriptor_Indices_AggregationsGroup_FieldMask) PathsCount() int { 2991 if fieldMask == nil { 2992 return 0 2993 } 2994 return len(fieldMask.Paths) 2995 } 2996 2997 type MetricDescriptor_Indices_SortingFunction_FieldMask struct { 2998 Paths []MetricDescriptorIndicesSortingFunction_FieldPath 2999 } 3000 3001 func FullMetricDescriptor_Indices_SortingFunction_FieldMask() *MetricDescriptor_Indices_SortingFunction_FieldMask { 3002 res := &MetricDescriptor_Indices_SortingFunction_FieldMask{} 3003 res.Paths = append(res.Paths, &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorName}) 3004 res.Paths = append(res.Paths, &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner}) 3005 res.Paths = append(res.Paths, &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer}) 3006 res.Paths = append(res.Paths, &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus}) 3007 res.Paths = append(res.Paths, &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting}) 3008 return res 3009 } 3010 3011 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) String() string { 3012 if fieldMask == nil { 3013 return "<nil>" 3014 } 3015 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3016 for _, path := range fieldMask.Paths { 3017 pathsStr = append(pathsStr, path.String()) 3018 } 3019 return strings.Join(pathsStr, ", ") 3020 } 3021 3022 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) IsFull() bool { 3023 if fieldMask == nil { 3024 return false 3025 } 3026 presentSelectors := make([]bool, 5) 3027 for _, path := range fieldMask.Paths { 3028 if asFinal, ok := path.(*MetricDescriptorIndicesSortingFunction_FieldTerminalPath); ok { 3029 presentSelectors[int(asFinal.selector)] = true 3030 } 3031 } 3032 for _, flag := range presentSelectors { 3033 if !flag { 3034 return false 3035 } 3036 } 3037 return true 3038 } 3039 3040 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) ProtoReflect() preflect.Message { 3041 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3042 return ParseMetricDescriptorIndicesSortingFunction_FieldPath(raw) 3043 }) 3044 } 3045 3046 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) ProtoMessage() {} 3047 3048 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) Reset() { 3049 if fieldMask != nil { 3050 fieldMask.Paths = nil 3051 } 3052 } 3053 3054 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) Subtract(other *MetricDescriptor_Indices_SortingFunction_FieldMask) *MetricDescriptor_Indices_SortingFunction_FieldMask { 3055 result := &MetricDescriptor_Indices_SortingFunction_FieldMask{} 3056 removedSelectors := make([]bool, 5) 3057 3058 for _, path := range other.GetPaths() { 3059 switch tp := path.(type) { 3060 case *MetricDescriptorIndicesSortingFunction_FieldTerminalPath: 3061 removedSelectors[int(tp.selector)] = true 3062 } 3063 } 3064 for _, path := range fieldMask.GetPaths() { 3065 if !removedSelectors[int(path.Selector())] { 3066 result.Paths = append(result.Paths, path) 3067 } 3068 } 3069 3070 if len(result.Paths) == 0 { 3071 return nil 3072 } 3073 return result 3074 } 3075 3076 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3077 return fieldMask.Subtract(other.(*MetricDescriptor_Indices_SortingFunction_FieldMask)) 3078 } 3079 3080 // FilterInputFields generates copy of field paths with output_only field paths removed 3081 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) FilterInputFields() *MetricDescriptor_Indices_SortingFunction_FieldMask { 3082 result := &MetricDescriptor_Indices_SortingFunction_FieldMask{} 3083 result.Paths = append(result.Paths, fieldMask.Paths...) 3084 return result 3085 } 3086 3087 // ToFieldMask is used for proto conversions 3088 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3089 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3090 for _, path := range fieldMask.Paths { 3091 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3092 } 3093 return protoFieldMask 3094 } 3095 3096 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3097 if fieldMask == nil { 3098 return status.Error(codes.Internal, "target field mask is nil") 3099 } 3100 fieldMask.Paths = make([]MetricDescriptorIndicesSortingFunction_FieldPath, 0, len(protoFieldMask.Paths)) 3101 for _, strPath := range protoFieldMask.Paths { 3102 path, err := ParseMetricDescriptorIndicesSortingFunction_FieldPath(strPath) 3103 if err != nil { 3104 return err 3105 } 3106 fieldMask.Paths = append(fieldMask.Paths, path) 3107 } 3108 return nil 3109 } 3110 3111 // implement methods required by customType 3112 func (fieldMask MetricDescriptor_Indices_SortingFunction_FieldMask) Marshal() ([]byte, error) { 3113 protoFieldMask := fieldMask.ToProtoFieldMask() 3114 return proto.Marshal(protoFieldMask) 3115 } 3116 3117 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) Unmarshal(data []byte) error { 3118 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3119 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3120 return err 3121 } 3122 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3123 return err 3124 } 3125 return nil 3126 } 3127 3128 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) Size() int { 3129 return proto.Size(fieldMask.ToProtoFieldMask()) 3130 } 3131 3132 func (fieldMask MetricDescriptor_Indices_SortingFunction_FieldMask) MarshalJSON() ([]byte, error) { 3133 return json.Marshal(fieldMask.ToProtoFieldMask()) 3134 } 3135 3136 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) UnmarshalJSON(data []byte) error { 3137 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3138 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3139 return err 3140 } 3141 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3142 return err 3143 } 3144 return nil 3145 } 3146 3147 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) AppendPath(path MetricDescriptorIndicesSortingFunction_FieldPath) { 3148 fieldMask.Paths = append(fieldMask.Paths, path) 3149 } 3150 3151 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3152 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndicesSortingFunction_FieldPath)) 3153 } 3154 3155 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) GetPaths() []MetricDescriptorIndicesSortingFunction_FieldPath { 3156 if fieldMask == nil { 3157 return nil 3158 } 3159 return fieldMask.Paths 3160 } 3161 3162 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3163 if fieldMask == nil { 3164 return nil 3165 } 3166 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3167 for _, path := range fieldMask.Paths { 3168 rawPaths = append(rawPaths, path) 3169 } 3170 return rawPaths 3171 } 3172 3173 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) SetFromCliFlag(raw string) error { 3174 path, err := ParseMetricDescriptorIndicesSortingFunction_FieldPath(raw) 3175 if err != nil { 3176 return err 3177 } 3178 fieldMask.Paths = append(fieldMask.Paths, path) 3179 return nil 3180 } 3181 3182 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) Set(target, source *MetricDescriptor_Indices_SortingFunction) { 3183 for _, path := range fieldMask.Paths { 3184 val, _ := path.GetSingle(source) 3185 // if val is nil, then field does not exist in source, skip 3186 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3187 if val != nil { 3188 path.WithIValue(val).SetTo(&target) 3189 } 3190 } 3191 } 3192 3193 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3194 fieldMask.Set(target.(*MetricDescriptor_Indices_SortingFunction), source.(*MetricDescriptor_Indices_SortingFunction)) 3195 } 3196 3197 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) Project(source *MetricDescriptor_Indices_SortingFunction) *MetricDescriptor_Indices_SortingFunction { 3198 if source == nil { 3199 return nil 3200 } 3201 if fieldMask == nil { 3202 return source 3203 } 3204 result := &MetricDescriptor_Indices_SortingFunction{} 3205 3206 for _, p := range fieldMask.Paths { 3207 switch tp := p.(type) { 3208 case *MetricDescriptorIndicesSortingFunction_FieldTerminalPath: 3209 switch tp.selector { 3210 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 3211 result.Name = source.Name 3212 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 3213 result.Aligner = source.Aligner 3214 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 3215 result.Reducer = source.Reducer 3216 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 3217 result.ClosingStatus = source.ClosingStatus 3218 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 3219 result.Sorting = source.Sorting 3220 } 3221 } 3222 } 3223 return result 3224 } 3225 3226 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3227 return fieldMask.Project(source.(*MetricDescriptor_Indices_SortingFunction)) 3228 } 3229 3230 func (fieldMask *MetricDescriptor_Indices_SortingFunction_FieldMask) PathsCount() int { 3231 if fieldMask == nil { 3232 return 0 3233 } 3234 return len(fieldMask.Paths) 3235 } 3236 3237 type MetricDescriptor_Indices_PreAggregatedIndices_FieldMask struct { 3238 Paths []MetricDescriptorIndicesPreAggregatedIndices_FieldPath 3239 } 3240 3241 func FullMetricDescriptor_Indices_PreAggregatedIndices_FieldMask() *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask { 3242 res := &MetricDescriptor_Indices_PreAggregatedIndices_FieldMask{} 3243 res.Paths = append(res.Paths, &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName}) 3244 res.Paths = append(res.Paths, &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes}) 3245 res.Paths = append(res.Paths, &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets}) 3246 res.Paths = append(res.Paths, &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets}) 3247 res.Paths = append(res.Paths, &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations}) 3248 return res 3249 } 3250 3251 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) String() string { 3252 if fieldMask == nil { 3253 return "<nil>" 3254 } 3255 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3256 for _, path := range fieldMask.Paths { 3257 pathsStr = append(pathsStr, path.String()) 3258 } 3259 return strings.Join(pathsStr, ", ") 3260 } 3261 3262 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) IsFull() bool { 3263 if fieldMask == nil { 3264 return false 3265 } 3266 presentSelectors := make([]bool, 5) 3267 for _, path := range fieldMask.Paths { 3268 if asFinal, ok := path.(*MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath); ok { 3269 presentSelectors[int(asFinal.selector)] = true 3270 } 3271 } 3272 for _, flag := range presentSelectors { 3273 if !flag { 3274 return false 3275 } 3276 } 3277 return true 3278 } 3279 3280 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) ProtoReflect() preflect.Message { 3281 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3282 return ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPath(raw) 3283 }) 3284 } 3285 3286 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) ProtoMessage() {} 3287 3288 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) Reset() { 3289 if fieldMask != nil { 3290 fieldMask.Paths = nil 3291 } 3292 } 3293 3294 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) Subtract(other *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask { 3295 result := &MetricDescriptor_Indices_PreAggregatedIndices_FieldMask{} 3296 removedSelectors := make([]bool, 5) 3297 otherSubMasks := map[MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector]gotenobject.FieldMask{ 3298 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: &MetricDescriptor_Indices_LabelsGroup_FieldMask{}, 3299 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: &MetricDescriptor_Indices_LabelsGroup_FieldMask{}, 3300 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: &MetricDescriptor_Indices_AggregationsGroup_FieldMask{}, 3301 } 3302 mySubMasks := map[MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector]gotenobject.FieldMask{ 3303 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: &MetricDescriptor_Indices_LabelsGroup_FieldMask{}, 3304 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: &MetricDescriptor_Indices_LabelsGroup_FieldMask{}, 3305 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: &MetricDescriptor_Indices_AggregationsGroup_FieldMask{}, 3306 } 3307 3308 for _, path := range other.GetPaths() { 3309 switch tp := path.(type) { 3310 case *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: 3311 removedSelectors[int(tp.selector)] = true 3312 case *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath: 3313 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 3314 } 3315 } 3316 for _, path := range fieldMask.GetPaths() { 3317 if !removedSelectors[int(path.Selector())] { 3318 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 3319 if tp, ok := path.(*MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath); ok { 3320 switch tp.selector { 3321 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 3322 mySubMasks[MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets] = FullMetricDescriptor_Indices_LabelsGroup_FieldMask() 3323 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 3324 mySubMasks[MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets] = FullMetricDescriptor_Indices_LabelsGroup_FieldMask() 3325 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 3326 mySubMasks[MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations] = FullMetricDescriptor_Indices_AggregationsGroup_FieldMask() 3327 } 3328 } else if tp, ok := path.(*MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath); ok { 3329 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 3330 } 3331 } else { 3332 result.Paths = append(result.Paths, path) 3333 } 3334 } 3335 } 3336 for selector, mySubMask := range mySubMasks { 3337 if mySubMask.PathsCount() > 0 { 3338 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 3339 result.Paths = append(result.Paths, &MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath{selector: selector, subPath: allowedPath}) 3340 } 3341 } 3342 } 3343 3344 if len(result.Paths) == 0 { 3345 return nil 3346 } 3347 return result 3348 } 3349 3350 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3351 return fieldMask.Subtract(other.(*MetricDescriptor_Indices_PreAggregatedIndices_FieldMask)) 3352 } 3353 3354 // FilterInputFields generates copy of field paths with output_only field paths removed 3355 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) FilterInputFields() *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask { 3356 result := &MetricDescriptor_Indices_PreAggregatedIndices_FieldMask{} 3357 result.Paths = append(result.Paths, fieldMask.Paths...) 3358 return result 3359 } 3360 3361 // ToFieldMask is used for proto conversions 3362 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3363 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3364 for _, path := range fieldMask.Paths { 3365 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3366 } 3367 return protoFieldMask 3368 } 3369 3370 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3371 if fieldMask == nil { 3372 return status.Error(codes.Internal, "target field mask is nil") 3373 } 3374 fieldMask.Paths = make([]MetricDescriptorIndicesPreAggregatedIndices_FieldPath, 0, len(protoFieldMask.Paths)) 3375 for _, strPath := range protoFieldMask.Paths { 3376 path, err := ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPath(strPath) 3377 if err != nil { 3378 return err 3379 } 3380 fieldMask.Paths = append(fieldMask.Paths, path) 3381 } 3382 return nil 3383 } 3384 3385 // implement methods required by customType 3386 func (fieldMask MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) Marshal() ([]byte, error) { 3387 protoFieldMask := fieldMask.ToProtoFieldMask() 3388 return proto.Marshal(protoFieldMask) 3389 } 3390 3391 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) Unmarshal(data []byte) error { 3392 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3393 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3394 return err 3395 } 3396 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3397 return err 3398 } 3399 return nil 3400 } 3401 3402 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) Size() int { 3403 return proto.Size(fieldMask.ToProtoFieldMask()) 3404 } 3405 3406 func (fieldMask MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) MarshalJSON() ([]byte, error) { 3407 return json.Marshal(fieldMask.ToProtoFieldMask()) 3408 } 3409 3410 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) UnmarshalJSON(data []byte) error { 3411 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3412 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3413 return err 3414 } 3415 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3416 return err 3417 } 3418 return nil 3419 } 3420 3421 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) AppendPath(path MetricDescriptorIndicesPreAggregatedIndices_FieldPath) { 3422 fieldMask.Paths = append(fieldMask.Paths, path) 3423 } 3424 3425 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3426 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndicesPreAggregatedIndices_FieldPath)) 3427 } 3428 3429 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) GetPaths() []MetricDescriptorIndicesPreAggregatedIndices_FieldPath { 3430 if fieldMask == nil { 3431 return nil 3432 } 3433 return fieldMask.Paths 3434 } 3435 3436 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3437 if fieldMask == nil { 3438 return nil 3439 } 3440 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3441 for _, path := range fieldMask.Paths { 3442 rawPaths = append(rawPaths, path) 3443 } 3444 return rawPaths 3445 } 3446 3447 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) SetFromCliFlag(raw string) error { 3448 path, err := ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPath(raw) 3449 if err != nil { 3450 return err 3451 } 3452 fieldMask.Paths = append(fieldMask.Paths, path) 3453 return nil 3454 } 3455 3456 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) Set(target, source *MetricDescriptor_Indices_PreAggregatedIndices) { 3457 for _, path := range fieldMask.Paths { 3458 val, _ := path.GetSingle(source) 3459 // if val is nil, then field does not exist in source, skip 3460 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3461 if val != nil { 3462 path.WithIValue(val).SetTo(&target) 3463 } 3464 } 3465 } 3466 3467 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3468 fieldMask.Set(target.(*MetricDescriptor_Indices_PreAggregatedIndices), source.(*MetricDescriptor_Indices_PreAggregatedIndices)) 3469 } 3470 3471 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) Project(source *MetricDescriptor_Indices_PreAggregatedIndices) *MetricDescriptor_Indices_PreAggregatedIndices { 3472 if source == nil { 3473 return nil 3474 } 3475 if fieldMask == nil { 3476 return source 3477 } 3478 result := &MetricDescriptor_Indices_PreAggregatedIndices{} 3479 partitionLabelSetsMask := &MetricDescriptor_Indices_LabelsGroup_FieldMask{} 3480 wholePartitionLabelSetsAccepted := false 3481 filterAndGroupLabelSetsMask := &MetricDescriptor_Indices_LabelsGroup_FieldMask{} 3482 wholeFilterAndGroupLabelSetsAccepted := false 3483 supportedAggregationsMask := &MetricDescriptor_Indices_AggregationsGroup_FieldMask{} 3484 wholeSupportedAggregationsAccepted := false 3485 3486 for _, p := range fieldMask.Paths { 3487 switch tp := p.(type) { 3488 case *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: 3489 switch tp.selector { 3490 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 3491 result.Name = source.Name 3492 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 3493 result.ResourceTypes = source.ResourceTypes 3494 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 3495 result.PartitionLabelSets = source.PartitionLabelSets 3496 wholePartitionLabelSetsAccepted = true 3497 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 3498 result.FilterAndGroupLabelSets = source.FilterAndGroupLabelSets 3499 wholeFilterAndGroupLabelSetsAccepted = true 3500 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 3501 result.SupportedAggregations = source.SupportedAggregations 3502 wholeSupportedAggregationsAccepted = true 3503 } 3504 case *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath: 3505 switch tp.selector { 3506 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 3507 partitionLabelSetsMask.AppendPath(tp.subPath.(MetricDescriptorIndicesLabelsGroup_FieldPath)) 3508 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 3509 filterAndGroupLabelSetsMask.AppendPath(tp.subPath.(MetricDescriptorIndicesLabelsGroup_FieldPath)) 3510 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 3511 supportedAggregationsMask.AppendPath(tp.subPath.(MetricDescriptorIndicesAggregationsGroup_FieldPath)) 3512 } 3513 } 3514 } 3515 if wholePartitionLabelSetsAccepted == false && len(partitionLabelSetsMask.Paths) > 0 { 3516 for _, sourceItem := range source.GetPartitionLabelSets() { 3517 result.PartitionLabelSets = append(result.PartitionLabelSets, partitionLabelSetsMask.Project(sourceItem)) 3518 } 3519 } 3520 if wholeFilterAndGroupLabelSetsAccepted == false && len(filterAndGroupLabelSetsMask.Paths) > 0 { 3521 for _, sourceItem := range source.GetFilterAndGroupLabelSets() { 3522 result.FilterAndGroupLabelSets = append(result.FilterAndGroupLabelSets, filterAndGroupLabelSetsMask.Project(sourceItem)) 3523 } 3524 } 3525 if wholeSupportedAggregationsAccepted == false && len(supportedAggregationsMask.Paths) > 0 { 3526 for _, sourceItem := range source.GetSupportedAggregations() { 3527 result.SupportedAggregations = append(result.SupportedAggregations, supportedAggregationsMask.Project(sourceItem)) 3528 } 3529 } 3530 return result 3531 } 3532 3533 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3534 return fieldMask.Project(source.(*MetricDescriptor_Indices_PreAggregatedIndices)) 3535 } 3536 3537 func (fieldMask *MetricDescriptor_Indices_PreAggregatedIndices_FieldMask) PathsCount() int { 3538 if fieldMask == nil { 3539 return 0 3540 } 3541 return len(fieldMask.Paths) 3542 } 3543 3544 type MetricDescriptor_Indices_NonAggregatedIndices_FieldMask struct { 3545 Paths []MetricDescriptorIndicesNonAggregatedIndices_FieldPath 3546 } 3547 3548 func FullMetricDescriptor_Indices_NonAggregatedIndices_FieldMask() *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask { 3549 res := &MetricDescriptor_Indices_NonAggregatedIndices_FieldMask{} 3550 res.Paths = append(res.Paths, &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName}) 3551 res.Paths = append(res.Paths, &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes}) 3552 res.Paths = append(res.Paths, &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets}) 3553 return res 3554 } 3555 3556 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) String() string { 3557 if fieldMask == nil { 3558 return "<nil>" 3559 } 3560 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3561 for _, path := range fieldMask.Paths { 3562 pathsStr = append(pathsStr, path.String()) 3563 } 3564 return strings.Join(pathsStr, ", ") 3565 } 3566 3567 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) IsFull() bool { 3568 if fieldMask == nil { 3569 return false 3570 } 3571 presentSelectors := make([]bool, 3) 3572 for _, path := range fieldMask.Paths { 3573 if asFinal, ok := path.(*MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath); ok { 3574 presentSelectors[int(asFinal.selector)] = true 3575 } 3576 } 3577 for _, flag := range presentSelectors { 3578 if !flag { 3579 return false 3580 } 3581 } 3582 return true 3583 } 3584 3585 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) ProtoReflect() preflect.Message { 3586 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3587 return ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPath(raw) 3588 }) 3589 } 3590 3591 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) ProtoMessage() {} 3592 3593 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) Reset() { 3594 if fieldMask != nil { 3595 fieldMask.Paths = nil 3596 } 3597 } 3598 3599 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) Subtract(other *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask { 3600 result := &MetricDescriptor_Indices_NonAggregatedIndices_FieldMask{} 3601 removedSelectors := make([]bool, 3) 3602 otherSubMasks := map[MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector]gotenobject.FieldMask{ 3603 MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: &MetricDescriptor_Indices_LabelsGroup_FieldMask{}, 3604 } 3605 mySubMasks := map[MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector]gotenobject.FieldMask{ 3606 MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: &MetricDescriptor_Indices_LabelsGroup_FieldMask{}, 3607 } 3608 3609 for _, path := range other.GetPaths() { 3610 switch tp := path.(type) { 3611 case *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: 3612 removedSelectors[int(tp.selector)] = true 3613 case *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath: 3614 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 3615 } 3616 } 3617 for _, path := range fieldMask.GetPaths() { 3618 if !removedSelectors[int(path.Selector())] { 3619 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 3620 if tp, ok := path.(*MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath); ok { 3621 switch tp.selector { 3622 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 3623 mySubMasks[MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets] = FullMetricDescriptor_Indices_LabelsGroup_FieldMask() 3624 } 3625 } else if tp, ok := path.(*MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath); ok { 3626 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 3627 } 3628 } else { 3629 result.Paths = append(result.Paths, path) 3630 } 3631 } 3632 } 3633 for selector, mySubMask := range mySubMasks { 3634 if mySubMask.PathsCount() > 0 { 3635 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 3636 result.Paths = append(result.Paths, &MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath{selector: selector, subPath: allowedPath}) 3637 } 3638 } 3639 } 3640 3641 if len(result.Paths) == 0 { 3642 return nil 3643 } 3644 return result 3645 } 3646 3647 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3648 return fieldMask.Subtract(other.(*MetricDescriptor_Indices_NonAggregatedIndices_FieldMask)) 3649 } 3650 3651 // FilterInputFields generates copy of field paths with output_only field paths removed 3652 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) FilterInputFields() *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask { 3653 result := &MetricDescriptor_Indices_NonAggregatedIndices_FieldMask{} 3654 result.Paths = append(result.Paths, fieldMask.Paths...) 3655 return result 3656 } 3657 3658 // ToFieldMask is used for proto conversions 3659 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3660 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3661 for _, path := range fieldMask.Paths { 3662 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3663 } 3664 return protoFieldMask 3665 } 3666 3667 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3668 if fieldMask == nil { 3669 return status.Error(codes.Internal, "target field mask is nil") 3670 } 3671 fieldMask.Paths = make([]MetricDescriptorIndicesNonAggregatedIndices_FieldPath, 0, len(protoFieldMask.Paths)) 3672 for _, strPath := range protoFieldMask.Paths { 3673 path, err := ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPath(strPath) 3674 if err != nil { 3675 return err 3676 } 3677 fieldMask.Paths = append(fieldMask.Paths, path) 3678 } 3679 return nil 3680 } 3681 3682 // implement methods required by customType 3683 func (fieldMask MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) Marshal() ([]byte, error) { 3684 protoFieldMask := fieldMask.ToProtoFieldMask() 3685 return proto.Marshal(protoFieldMask) 3686 } 3687 3688 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) Unmarshal(data []byte) error { 3689 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3690 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3691 return err 3692 } 3693 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3694 return err 3695 } 3696 return nil 3697 } 3698 3699 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) Size() int { 3700 return proto.Size(fieldMask.ToProtoFieldMask()) 3701 } 3702 3703 func (fieldMask MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) MarshalJSON() ([]byte, error) { 3704 return json.Marshal(fieldMask.ToProtoFieldMask()) 3705 } 3706 3707 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) UnmarshalJSON(data []byte) error { 3708 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3709 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3710 return err 3711 } 3712 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3713 return err 3714 } 3715 return nil 3716 } 3717 3718 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) AppendPath(path MetricDescriptorIndicesNonAggregatedIndices_FieldPath) { 3719 fieldMask.Paths = append(fieldMask.Paths, path) 3720 } 3721 3722 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3723 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndicesNonAggregatedIndices_FieldPath)) 3724 } 3725 3726 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) GetPaths() []MetricDescriptorIndicesNonAggregatedIndices_FieldPath { 3727 if fieldMask == nil { 3728 return nil 3729 } 3730 return fieldMask.Paths 3731 } 3732 3733 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3734 if fieldMask == nil { 3735 return nil 3736 } 3737 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3738 for _, path := range fieldMask.Paths { 3739 rawPaths = append(rawPaths, path) 3740 } 3741 return rawPaths 3742 } 3743 3744 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) SetFromCliFlag(raw string) error { 3745 path, err := ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPath(raw) 3746 if err != nil { 3747 return err 3748 } 3749 fieldMask.Paths = append(fieldMask.Paths, path) 3750 return nil 3751 } 3752 3753 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) Set(target, source *MetricDescriptor_Indices_NonAggregatedIndices) { 3754 for _, path := range fieldMask.Paths { 3755 val, _ := path.GetSingle(source) 3756 // if val is nil, then field does not exist in source, skip 3757 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3758 if val != nil { 3759 path.WithIValue(val).SetTo(&target) 3760 } 3761 } 3762 } 3763 3764 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3765 fieldMask.Set(target.(*MetricDescriptor_Indices_NonAggregatedIndices), source.(*MetricDescriptor_Indices_NonAggregatedIndices)) 3766 } 3767 3768 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) Project(source *MetricDescriptor_Indices_NonAggregatedIndices) *MetricDescriptor_Indices_NonAggregatedIndices { 3769 if source == nil { 3770 return nil 3771 } 3772 if fieldMask == nil { 3773 return source 3774 } 3775 result := &MetricDescriptor_Indices_NonAggregatedIndices{} 3776 partitionLabelSetsMask := &MetricDescriptor_Indices_LabelsGroup_FieldMask{} 3777 wholePartitionLabelSetsAccepted := false 3778 3779 for _, p := range fieldMask.Paths { 3780 switch tp := p.(type) { 3781 case *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: 3782 switch tp.selector { 3783 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 3784 result.Name = source.Name 3785 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 3786 result.ResourceTypes = source.ResourceTypes 3787 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 3788 result.PartitionLabelSets = source.PartitionLabelSets 3789 wholePartitionLabelSetsAccepted = true 3790 } 3791 case *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath: 3792 switch tp.selector { 3793 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 3794 partitionLabelSetsMask.AppendPath(tp.subPath.(MetricDescriptorIndicesLabelsGroup_FieldPath)) 3795 } 3796 } 3797 } 3798 if wholePartitionLabelSetsAccepted == false && len(partitionLabelSetsMask.Paths) > 0 { 3799 for _, sourceItem := range source.GetPartitionLabelSets() { 3800 result.PartitionLabelSets = append(result.PartitionLabelSets, partitionLabelSetsMask.Project(sourceItem)) 3801 } 3802 } 3803 return result 3804 } 3805 3806 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3807 return fieldMask.Project(source.(*MetricDescriptor_Indices_NonAggregatedIndices)) 3808 } 3809 3810 func (fieldMask *MetricDescriptor_Indices_NonAggregatedIndices_FieldMask) PathsCount() int { 3811 if fieldMask == nil { 3812 return 0 3813 } 3814 return len(fieldMask.Paths) 3815 } 3816 3817 type MetricDescriptor_Indices_PaginationIndices_FieldMask struct { 3818 Paths []MetricDescriptorIndicesPaginationIndices_FieldPath 3819 } 3820 3821 func FullMetricDescriptor_Indices_PaginationIndices_FieldMask() *MetricDescriptor_Indices_PaginationIndices_FieldMask { 3822 res := &MetricDescriptor_Indices_PaginationIndices_FieldMask{} 3823 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName}) 3824 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes}) 3825 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets}) 3826 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews}) 3827 res.Paths = append(res.Paths, &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions}) 3828 return res 3829 } 3830 3831 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) String() string { 3832 if fieldMask == nil { 3833 return "<nil>" 3834 } 3835 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3836 for _, path := range fieldMask.Paths { 3837 pathsStr = append(pathsStr, path.String()) 3838 } 3839 return strings.Join(pathsStr, ", ") 3840 } 3841 3842 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) IsFull() bool { 3843 if fieldMask == nil { 3844 return false 3845 } 3846 presentSelectors := make([]bool, 5) 3847 for _, path := range fieldMask.Paths { 3848 if asFinal, ok := path.(*MetricDescriptorIndicesPaginationIndices_FieldTerminalPath); ok { 3849 presentSelectors[int(asFinal.selector)] = true 3850 } 3851 } 3852 for _, flag := range presentSelectors { 3853 if !flag { 3854 return false 3855 } 3856 } 3857 return true 3858 } 3859 3860 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) ProtoReflect() preflect.Message { 3861 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3862 return ParseMetricDescriptorIndicesPaginationIndices_FieldPath(raw) 3863 }) 3864 } 3865 3866 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) ProtoMessage() {} 3867 3868 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) Reset() { 3869 if fieldMask != nil { 3870 fieldMask.Paths = nil 3871 } 3872 } 3873 3874 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) Subtract(other *MetricDescriptor_Indices_PaginationIndices_FieldMask) *MetricDescriptor_Indices_PaginationIndices_FieldMask { 3875 result := &MetricDescriptor_Indices_PaginationIndices_FieldMask{} 3876 removedSelectors := make([]bool, 5) 3877 otherSubMasks := map[MetricDescriptorIndicesPaginationIndices_FieldPathSelector]gotenobject.FieldMask{ 3878 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: &MetricDescriptor_Indices_LabelsGroup_FieldMask{}, 3879 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: &MetricDescriptor_Indices_PaginationView_FieldMask{}, 3880 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: &MetricDescriptor_Indices_SortingFunction_FieldMask{}, 3881 } 3882 mySubMasks := map[MetricDescriptorIndicesPaginationIndices_FieldPathSelector]gotenobject.FieldMask{ 3883 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: &MetricDescriptor_Indices_LabelsGroup_FieldMask{}, 3884 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: &MetricDescriptor_Indices_PaginationView_FieldMask{}, 3885 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: &MetricDescriptor_Indices_SortingFunction_FieldMask{}, 3886 } 3887 3888 for _, path := range other.GetPaths() { 3889 switch tp := path.(type) { 3890 case *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: 3891 removedSelectors[int(tp.selector)] = true 3892 case *MetricDescriptorIndicesPaginationIndices_FieldSubPath: 3893 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 3894 } 3895 } 3896 for _, path := range fieldMask.GetPaths() { 3897 if !removedSelectors[int(path.Selector())] { 3898 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 3899 if tp, ok := path.(*MetricDescriptorIndicesPaginationIndices_FieldTerminalPath); ok { 3900 switch tp.selector { 3901 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 3902 mySubMasks[MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets] = FullMetricDescriptor_Indices_LabelsGroup_FieldMask() 3903 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 3904 mySubMasks[MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews] = FullMetricDescriptor_Indices_PaginationView_FieldMask() 3905 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 3906 mySubMasks[MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions] = FullMetricDescriptor_Indices_SortingFunction_FieldMask() 3907 } 3908 } else if tp, ok := path.(*MetricDescriptorIndicesPaginationIndices_FieldSubPath); ok { 3909 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 3910 } 3911 } else { 3912 result.Paths = append(result.Paths, path) 3913 } 3914 } 3915 } 3916 for selector, mySubMask := range mySubMasks { 3917 if mySubMask.PathsCount() > 0 { 3918 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 3919 result.Paths = append(result.Paths, &MetricDescriptorIndicesPaginationIndices_FieldSubPath{selector: selector, subPath: allowedPath}) 3920 } 3921 } 3922 } 3923 3924 if len(result.Paths) == 0 { 3925 return nil 3926 } 3927 return result 3928 } 3929 3930 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3931 return fieldMask.Subtract(other.(*MetricDescriptor_Indices_PaginationIndices_FieldMask)) 3932 } 3933 3934 // FilterInputFields generates copy of field paths with output_only field paths removed 3935 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) FilterInputFields() *MetricDescriptor_Indices_PaginationIndices_FieldMask { 3936 result := &MetricDescriptor_Indices_PaginationIndices_FieldMask{} 3937 result.Paths = append(result.Paths, fieldMask.Paths...) 3938 return result 3939 } 3940 3941 // ToFieldMask is used for proto conversions 3942 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3943 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3944 for _, path := range fieldMask.Paths { 3945 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3946 } 3947 return protoFieldMask 3948 } 3949 3950 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3951 if fieldMask == nil { 3952 return status.Error(codes.Internal, "target field mask is nil") 3953 } 3954 fieldMask.Paths = make([]MetricDescriptorIndicesPaginationIndices_FieldPath, 0, len(protoFieldMask.Paths)) 3955 for _, strPath := range protoFieldMask.Paths { 3956 path, err := ParseMetricDescriptorIndicesPaginationIndices_FieldPath(strPath) 3957 if err != nil { 3958 return err 3959 } 3960 fieldMask.Paths = append(fieldMask.Paths, path) 3961 } 3962 return nil 3963 } 3964 3965 // implement methods required by customType 3966 func (fieldMask MetricDescriptor_Indices_PaginationIndices_FieldMask) Marshal() ([]byte, error) { 3967 protoFieldMask := fieldMask.ToProtoFieldMask() 3968 return proto.Marshal(protoFieldMask) 3969 } 3970 3971 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) Unmarshal(data []byte) error { 3972 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3973 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3974 return err 3975 } 3976 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3977 return err 3978 } 3979 return nil 3980 } 3981 3982 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) Size() int { 3983 return proto.Size(fieldMask.ToProtoFieldMask()) 3984 } 3985 3986 func (fieldMask MetricDescriptor_Indices_PaginationIndices_FieldMask) MarshalJSON() ([]byte, error) { 3987 return json.Marshal(fieldMask.ToProtoFieldMask()) 3988 } 3989 3990 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) UnmarshalJSON(data []byte) error { 3991 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3992 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3993 return err 3994 } 3995 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3996 return err 3997 } 3998 return nil 3999 } 4000 4001 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) AppendPath(path MetricDescriptorIndicesPaginationIndices_FieldPath) { 4002 fieldMask.Paths = append(fieldMask.Paths, path) 4003 } 4004 4005 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 4006 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndicesPaginationIndices_FieldPath)) 4007 } 4008 4009 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) GetPaths() []MetricDescriptorIndicesPaginationIndices_FieldPath { 4010 if fieldMask == nil { 4011 return nil 4012 } 4013 return fieldMask.Paths 4014 } 4015 4016 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) GetRawPaths() []gotenobject.FieldPath { 4017 if fieldMask == nil { 4018 return nil 4019 } 4020 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 4021 for _, path := range fieldMask.Paths { 4022 rawPaths = append(rawPaths, path) 4023 } 4024 return rawPaths 4025 } 4026 4027 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) SetFromCliFlag(raw string) error { 4028 path, err := ParseMetricDescriptorIndicesPaginationIndices_FieldPath(raw) 4029 if err != nil { 4030 return err 4031 } 4032 fieldMask.Paths = append(fieldMask.Paths, path) 4033 return nil 4034 } 4035 4036 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) Set(target, source *MetricDescriptor_Indices_PaginationIndices) { 4037 for _, path := range fieldMask.Paths { 4038 val, _ := path.GetSingle(source) 4039 // if val is nil, then field does not exist in source, skip 4040 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 4041 if val != nil { 4042 path.WithIValue(val).SetTo(&target) 4043 } 4044 } 4045 } 4046 4047 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 4048 fieldMask.Set(target.(*MetricDescriptor_Indices_PaginationIndices), source.(*MetricDescriptor_Indices_PaginationIndices)) 4049 } 4050 4051 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) Project(source *MetricDescriptor_Indices_PaginationIndices) *MetricDescriptor_Indices_PaginationIndices { 4052 if source == nil { 4053 return nil 4054 } 4055 if fieldMask == nil { 4056 return source 4057 } 4058 result := &MetricDescriptor_Indices_PaginationIndices{} 4059 partitionLabelSetsMask := &MetricDescriptor_Indices_LabelsGroup_FieldMask{} 4060 wholePartitionLabelSetsAccepted := false 4061 viewsMask := &MetricDescriptor_Indices_PaginationView_FieldMask{} 4062 wholeViewsAccepted := false 4063 functionsMask := &MetricDescriptor_Indices_SortingFunction_FieldMask{} 4064 wholeFunctionsAccepted := false 4065 4066 for _, p := range fieldMask.Paths { 4067 switch tp := p.(type) { 4068 case *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: 4069 switch tp.selector { 4070 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 4071 result.Name = source.Name 4072 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 4073 result.ResourceTypes = source.ResourceTypes 4074 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 4075 result.PartitionLabelSets = source.PartitionLabelSets 4076 wholePartitionLabelSetsAccepted = true 4077 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 4078 result.Views = source.Views 4079 wholeViewsAccepted = true 4080 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 4081 result.Functions = source.Functions 4082 wholeFunctionsAccepted = true 4083 } 4084 case *MetricDescriptorIndicesPaginationIndices_FieldSubPath: 4085 switch tp.selector { 4086 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 4087 partitionLabelSetsMask.AppendPath(tp.subPath.(MetricDescriptorIndicesLabelsGroup_FieldPath)) 4088 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 4089 viewsMask.AppendPath(tp.subPath.(MetricDescriptorIndicesPaginationView_FieldPath)) 4090 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 4091 functionsMask.AppendPath(tp.subPath.(MetricDescriptorIndicesSortingFunction_FieldPath)) 4092 } 4093 } 4094 } 4095 if wholePartitionLabelSetsAccepted == false && len(partitionLabelSetsMask.Paths) > 0 { 4096 for _, sourceItem := range source.GetPartitionLabelSets() { 4097 result.PartitionLabelSets = append(result.PartitionLabelSets, partitionLabelSetsMask.Project(sourceItem)) 4098 } 4099 } 4100 if wholeViewsAccepted == false && len(viewsMask.Paths) > 0 { 4101 for _, sourceItem := range source.GetViews() { 4102 result.Views = append(result.Views, viewsMask.Project(sourceItem)) 4103 } 4104 } 4105 if wholeFunctionsAccepted == false && len(functionsMask.Paths) > 0 { 4106 for _, sourceItem := range source.GetFunctions() { 4107 result.Functions = append(result.Functions, functionsMask.Project(sourceItem)) 4108 } 4109 } 4110 return result 4111 } 4112 4113 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 4114 return fieldMask.Project(source.(*MetricDescriptor_Indices_PaginationIndices)) 4115 } 4116 4117 func (fieldMask *MetricDescriptor_Indices_PaginationIndices_FieldMask) PathsCount() int { 4118 if fieldMask == nil { 4119 return 0 4120 } 4121 return len(fieldMask.Paths) 4122 } 4123 4124 type MetricDescriptor_Indices_IndexGroups_FieldMask struct { 4125 Paths []MetricDescriptorIndicesIndexGroups_FieldPath 4126 } 4127 4128 func FullMetricDescriptor_Indices_IndexGroups_FieldMask() *MetricDescriptor_Indices_IndexGroups_FieldMask { 4129 res := &MetricDescriptor_Indices_IndexGroups_FieldMask{} 4130 res.Paths = append(res.Paths, &MetricDescriptorIndicesIndexGroups_FieldTerminalPath{selector: MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices}) 4131 res.Paths = append(res.Paths, &MetricDescriptorIndicesIndexGroups_FieldTerminalPath{selector: MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices}) 4132 res.Paths = append(res.Paths, &MetricDescriptorIndicesIndexGroups_FieldTerminalPath{selector: MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices}) 4133 return res 4134 } 4135 4136 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) String() string { 4137 if fieldMask == nil { 4138 return "<nil>" 4139 } 4140 pathsStr := make([]string, 0, len(fieldMask.Paths)) 4141 for _, path := range fieldMask.Paths { 4142 pathsStr = append(pathsStr, path.String()) 4143 } 4144 return strings.Join(pathsStr, ", ") 4145 } 4146 4147 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) IsFull() bool { 4148 if fieldMask == nil { 4149 return false 4150 } 4151 presentSelectors := make([]bool, 3) 4152 for _, path := range fieldMask.Paths { 4153 if asFinal, ok := path.(*MetricDescriptorIndicesIndexGroups_FieldTerminalPath); ok { 4154 presentSelectors[int(asFinal.selector)] = true 4155 } 4156 } 4157 for _, flag := range presentSelectors { 4158 if !flag { 4159 return false 4160 } 4161 } 4162 return true 4163 } 4164 4165 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) ProtoReflect() preflect.Message { 4166 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 4167 return ParseMetricDescriptorIndicesIndexGroups_FieldPath(raw) 4168 }) 4169 } 4170 4171 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) ProtoMessage() {} 4172 4173 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) Reset() { 4174 if fieldMask != nil { 4175 fieldMask.Paths = nil 4176 } 4177 } 4178 4179 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) Subtract(other *MetricDescriptor_Indices_IndexGroups_FieldMask) *MetricDescriptor_Indices_IndexGroups_FieldMask { 4180 result := &MetricDescriptor_Indices_IndexGroups_FieldMask{} 4181 removedSelectors := make([]bool, 3) 4182 otherSubMasks := map[MetricDescriptorIndicesIndexGroups_FieldPathSelector]gotenobject.FieldMask{ 4183 MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: &MetricDescriptor_Indices_PreAggregatedIndices_FieldMask{}, 4184 MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: &MetricDescriptor_Indices_NonAggregatedIndices_FieldMask{}, 4185 MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: &MetricDescriptor_Indices_PaginationIndices_FieldMask{}, 4186 } 4187 mySubMasks := map[MetricDescriptorIndicesIndexGroups_FieldPathSelector]gotenobject.FieldMask{ 4188 MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: &MetricDescriptor_Indices_PreAggregatedIndices_FieldMask{}, 4189 MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: &MetricDescriptor_Indices_NonAggregatedIndices_FieldMask{}, 4190 MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: &MetricDescriptor_Indices_PaginationIndices_FieldMask{}, 4191 } 4192 4193 for _, path := range other.GetPaths() { 4194 switch tp := path.(type) { 4195 case *MetricDescriptorIndicesIndexGroups_FieldTerminalPath: 4196 removedSelectors[int(tp.selector)] = true 4197 case *MetricDescriptorIndicesIndexGroups_FieldSubPath: 4198 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 4199 } 4200 } 4201 for _, path := range fieldMask.GetPaths() { 4202 if !removedSelectors[int(path.Selector())] { 4203 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 4204 if tp, ok := path.(*MetricDescriptorIndicesIndexGroups_FieldTerminalPath); ok { 4205 switch tp.selector { 4206 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 4207 mySubMasks[MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices] = FullMetricDescriptor_Indices_PreAggregatedIndices_FieldMask() 4208 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 4209 mySubMasks[MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices] = FullMetricDescriptor_Indices_NonAggregatedIndices_FieldMask() 4210 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 4211 mySubMasks[MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices] = FullMetricDescriptor_Indices_PaginationIndices_FieldMask() 4212 } 4213 } else if tp, ok := path.(*MetricDescriptorIndicesIndexGroups_FieldSubPath); ok { 4214 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 4215 } 4216 } else { 4217 result.Paths = append(result.Paths, path) 4218 } 4219 } 4220 } 4221 for selector, mySubMask := range mySubMasks { 4222 if mySubMask.PathsCount() > 0 { 4223 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 4224 result.Paths = append(result.Paths, &MetricDescriptorIndicesIndexGroups_FieldSubPath{selector: selector, subPath: allowedPath}) 4225 } 4226 } 4227 } 4228 4229 if len(result.Paths) == 0 { 4230 return nil 4231 } 4232 return result 4233 } 4234 4235 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 4236 return fieldMask.Subtract(other.(*MetricDescriptor_Indices_IndexGroups_FieldMask)) 4237 } 4238 4239 // FilterInputFields generates copy of field paths with output_only field paths removed 4240 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) FilterInputFields() *MetricDescriptor_Indices_IndexGroups_FieldMask { 4241 result := &MetricDescriptor_Indices_IndexGroups_FieldMask{} 4242 result.Paths = append(result.Paths, fieldMask.Paths...) 4243 return result 4244 } 4245 4246 // ToFieldMask is used for proto conversions 4247 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 4248 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4249 for _, path := range fieldMask.Paths { 4250 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 4251 } 4252 return protoFieldMask 4253 } 4254 4255 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 4256 if fieldMask == nil { 4257 return status.Error(codes.Internal, "target field mask is nil") 4258 } 4259 fieldMask.Paths = make([]MetricDescriptorIndicesIndexGroups_FieldPath, 0, len(protoFieldMask.Paths)) 4260 for _, strPath := range protoFieldMask.Paths { 4261 path, err := ParseMetricDescriptorIndicesIndexGroups_FieldPath(strPath) 4262 if err != nil { 4263 return err 4264 } 4265 fieldMask.Paths = append(fieldMask.Paths, path) 4266 } 4267 return nil 4268 } 4269 4270 // implement methods required by customType 4271 func (fieldMask MetricDescriptor_Indices_IndexGroups_FieldMask) Marshal() ([]byte, error) { 4272 protoFieldMask := fieldMask.ToProtoFieldMask() 4273 return proto.Marshal(protoFieldMask) 4274 } 4275 4276 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) Unmarshal(data []byte) error { 4277 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4278 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 4279 return err 4280 } 4281 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4282 return err 4283 } 4284 return nil 4285 } 4286 4287 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) Size() int { 4288 return proto.Size(fieldMask.ToProtoFieldMask()) 4289 } 4290 4291 func (fieldMask MetricDescriptor_Indices_IndexGroups_FieldMask) MarshalJSON() ([]byte, error) { 4292 return json.Marshal(fieldMask.ToProtoFieldMask()) 4293 } 4294 4295 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) UnmarshalJSON(data []byte) error { 4296 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4297 if err := json.Unmarshal(data, protoFieldMask); err != nil { 4298 return err 4299 } 4300 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4301 return err 4302 } 4303 return nil 4304 } 4305 4306 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) AppendPath(path MetricDescriptorIndicesIndexGroups_FieldPath) { 4307 fieldMask.Paths = append(fieldMask.Paths, path) 4308 } 4309 4310 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 4311 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorIndicesIndexGroups_FieldPath)) 4312 } 4313 4314 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) GetPaths() []MetricDescriptorIndicesIndexGroups_FieldPath { 4315 if fieldMask == nil { 4316 return nil 4317 } 4318 return fieldMask.Paths 4319 } 4320 4321 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) GetRawPaths() []gotenobject.FieldPath { 4322 if fieldMask == nil { 4323 return nil 4324 } 4325 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 4326 for _, path := range fieldMask.Paths { 4327 rawPaths = append(rawPaths, path) 4328 } 4329 return rawPaths 4330 } 4331 4332 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) SetFromCliFlag(raw string) error { 4333 path, err := ParseMetricDescriptorIndicesIndexGroups_FieldPath(raw) 4334 if err != nil { 4335 return err 4336 } 4337 fieldMask.Paths = append(fieldMask.Paths, path) 4338 return nil 4339 } 4340 4341 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) Set(target, source *MetricDescriptor_Indices_IndexGroups) { 4342 for _, path := range fieldMask.Paths { 4343 val, _ := path.GetSingle(source) 4344 // if val is nil, then field does not exist in source, skip 4345 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 4346 if val != nil { 4347 path.WithIValue(val).SetTo(&target) 4348 } 4349 } 4350 } 4351 4352 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 4353 fieldMask.Set(target.(*MetricDescriptor_Indices_IndexGroups), source.(*MetricDescriptor_Indices_IndexGroups)) 4354 } 4355 4356 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) Project(source *MetricDescriptor_Indices_IndexGroups) *MetricDescriptor_Indices_IndexGroups { 4357 if source == nil { 4358 return nil 4359 } 4360 if fieldMask == nil { 4361 return source 4362 } 4363 result := &MetricDescriptor_Indices_IndexGroups{} 4364 preAggregatedIndicesMask := &MetricDescriptor_Indices_PreAggregatedIndices_FieldMask{} 4365 wholePreAggregatedIndicesAccepted := false 4366 nonAggregatedIndicesMask := &MetricDescriptor_Indices_NonAggregatedIndices_FieldMask{} 4367 wholeNonAggregatedIndicesAccepted := false 4368 paginationIndicesMask := &MetricDescriptor_Indices_PaginationIndices_FieldMask{} 4369 wholePaginationIndicesAccepted := false 4370 4371 for _, p := range fieldMask.Paths { 4372 switch tp := p.(type) { 4373 case *MetricDescriptorIndicesIndexGroups_FieldTerminalPath: 4374 switch tp.selector { 4375 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 4376 result.PreAggregatedIndices = source.PreAggregatedIndices 4377 wholePreAggregatedIndicesAccepted = true 4378 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 4379 result.NonAggregatedIndices = source.NonAggregatedIndices 4380 wholeNonAggregatedIndicesAccepted = true 4381 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 4382 result.PaginationIndices = source.PaginationIndices 4383 wholePaginationIndicesAccepted = true 4384 } 4385 case *MetricDescriptorIndicesIndexGroups_FieldSubPath: 4386 switch tp.selector { 4387 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 4388 preAggregatedIndicesMask.AppendPath(tp.subPath.(MetricDescriptorIndicesPreAggregatedIndices_FieldPath)) 4389 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 4390 nonAggregatedIndicesMask.AppendPath(tp.subPath.(MetricDescriptorIndicesNonAggregatedIndices_FieldPath)) 4391 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 4392 paginationIndicesMask.AppendPath(tp.subPath.(MetricDescriptorIndicesPaginationIndices_FieldPath)) 4393 } 4394 } 4395 } 4396 if wholePreAggregatedIndicesAccepted == false && len(preAggregatedIndicesMask.Paths) > 0 { 4397 for _, sourceItem := range source.GetPreAggregatedIndices() { 4398 result.PreAggregatedIndices = append(result.PreAggregatedIndices, preAggregatedIndicesMask.Project(sourceItem)) 4399 } 4400 } 4401 if wholeNonAggregatedIndicesAccepted == false && len(nonAggregatedIndicesMask.Paths) > 0 { 4402 for _, sourceItem := range source.GetNonAggregatedIndices() { 4403 result.NonAggregatedIndices = append(result.NonAggregatedIndices, nonAggregatedIndicesMask.Project(sourceItem)) 4404 } 4405 } 4406 if wholePaginationIndicesAccepted == false && len(paginationIndicesMask.Paths) > 0 { 4407 for _, sourceItem := range source.GetPaginationIndices() { 4408 result.PaginationIndices = append(result.PaginationIndices, paginationIndicesMask.Project(sourceItem)) 4409 } 4410 } 4411 return result 4412 } 4413 4414 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 4415 return fieldMask.Project(source.(*MetricDescriptor_Indices_IndexGroups)) 4416 } 4417 4418 func (fieldMask *MetricDescriptor_Indices_IndexGroups_FieldMask) PathsCount() int { 4419 if fieldMask == nil { 4420 return 0 4421 } 4422 return len(fieldMask.Paths) 4423 } 4424 4425 type MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask struct { 4426 Paths []MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath 4427 } 4428 4429 func FullMetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask() *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask { 4430 res := &MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask{} 4431 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData}) 4432 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners}) 4433 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners}) 4434 return res 4435 } 4436 4437 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) String() string { 4438 if fieldMask == nil { 4439 return "<nil>" 4440 } 4441 pathsStr := make([]string, 0, len(fieldMask.Paths)) 4442 for _, path := range fieldMask.Paths { 4443 pathsStr = append(pathsStr, path.String()) 4444 } 4445 return strings.Join(pathsStr, ", ") 4446 } 4447 4448 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) IsFull() bool { 4449 if fieldMask == nil { 4450 return false 4451 } 4452 presentSelectors := make([]bool, 3) 4453 for _, path := range fieldMask.Paths { 4454 if asFinal, ok := path.(*MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath); ok { 4455 presentSelectors[int(asFinal.selector)] = true 4456 } 4457 } 4458 for _, flag := range presentSelectors { 4459 if !flag { 4460 return false 4461 } 4462 } 4463 return true 4464 } 4465 4466 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) ProtoReflect() preflect.Message { 4467 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 4468 return ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(raw) 4469 }) 4470 } 4471 4472 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) ProtoMessage() {} 4473 4474 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) Reset() { 4475 if fieldMask != nil { 4476 fieldMask.Paths = nil 4477 } 4478 } 4479 4480 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) Subtract(other *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask { 4481 result := &MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask{} 4482 removedSelectors := make([]bool, 3) 4483 4484 for _, path := range other.GetPaths() { 4485 switch tp := path.(type) { 4486 case *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: 4487 removedSelectors[int(tp.selector)] = true 4488 } 4489 } 4490 for _, path := range fieldMask.GetPaths() { 4491 if !removedSelectors[int(path.Selector())] { 4492 result.Paths = append(result.Paths, path) 4493 } 4494 } 4495 4496 if len(result.Paths) == 0 { 4497 return nil 4498 } 4499 return result 4500 } 4501 4502 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 4503 return fieldMask.Subtract(other.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask)) 4504 } 4505 4506 // FilterInputFields generates copy of field paths with output_only field paths removed 4507 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) FilterInputFields() *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask { 4508 result := &MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask{} 4509 result.Paths = append(result.Paths, fieldMask.Paths...) 4510 return result 4511 } 4512 4513 // ToFieldMask is used for proto conversions 4514 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 4515 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4516 for _, path := range fieldMask.Paths { 4517 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 4518 } 4519 return protoFieldMask 4520 } 4521 4522 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 4523 if fieldMask == nil { 4524 return status.Error(codes.Internal, "target field mask is nil") 4525 } 4526 fieldMask.Paths = make([]MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath, 0, len(protoFieldMask.Paths)) 4527 for _, strPath := range protoFieldMask.Paths { 4528 path, err := ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(strPath) 4529 if err != nil { 4530 return err 4531 } 4532 fieldMask.Paths = append(fieldMask.Paths, path) 4533 } 4534 return nil 4535 } 4536 4537 // implement methods required by customType 4538 func (fieldMask MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) Marshal() ([]byte, error) { 4539 protoFieldMask := fieldMask.ToProtoFieldMask() 4540 return proto.Marshal(protoFieldMask) 4541 } 4542 4543 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) Unmarshal(data []byte) error { 4544 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4545 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 4546 return err 4547 } 4548 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4549 return err 4550 } 4551 return nil 4552 } 4553 4554 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) Size() int { 4555 return proto.Size(fieldMask.ToProtoFieldMask()) 4556 } 4557 4558 func (fieldMask MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) MarshalJSON() ([]byte, error) { 4559 return json.Marshal(fieldMask.ToProtoFieldMask()) 4560 } 4561 4562 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) UnmarshalJSON(data []byte) error { 4563 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4564 if err := json.Unmarshal(data, protoFieldMask); err != nil { 4565 return err 4566 } 4567 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4568 return err 4569 } 4570 return nil 4571 } 4572 4573 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) AppendPath(path MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath) { 4574 fieldMask.Paths = append(fieldMask.Paths, path) 4575 } 4576 4577 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 4578 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath)) 4579 } 4580 4581 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) GetPaths() []MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath { 4582 if fieldMask == nil { 4583 return nil 4584 } 4585 return fieldMask.Paths 4586 } 4587 4588 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) GetRawPaths() []gotenobject.FieldPath { 4589 if fieldMask == nil { 4590 return nil 4591 } 4592 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 4593 for _, path := range fieldMask.Paths { 4594 rawPaths = append(rawPaths, path) 4595 } 4596 return rawPaths 4597 } 4598 4599 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) SetFromCliFlag(raw string) error { 4600 path, err := ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(raw) 4601 if err != nil { 4602 return err 4603 } 4604 fieldMask.Paths = append(fieldMask.Paths, path) 4605 return nil 4606 } 4607 4608 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) Set(target, source *MetricDescriptor_BinaryIndices_PreAggregatedIndex) { 4609 for _, path := range fieldMask.Paths { 4610 val, _ := path.GetSingle(source) 4611 // if val is nil, then field does not exist in source, skip 4612 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 4613 if val != nil { 4614 path.WithIValue(val).SetTo(&target) 4615 } 4616 } 4617 } 4618 4619 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 4620 fieldMask.Set(target.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex), source.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex)) 4621 } 4622 4623 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) Project(source *MetricDescriptor_BinaryIndices_PreAggregatedIndex) *MetricDescriptor_BinaryIndices_PreAggregatedIndex { 4624 if source == nil { 4625 return nil 4626 } 4627 if fieldMask == nil { 4628 return source 4629 } 4630 result := &MetricDescriptor_BinaryIndices_PreAggregatedIndex{} 4631 4632 for _, p := range fieldMask.Paths { 4633 switch tp := p.(type) { 4634 case *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: 4635 switch tp.selector { 4636 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 4637 result.KeyData = source.KeyData 4638 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 4639 result.WritingAligners = source.WritingAligners 4640 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 4641 result.ClosedAligners = source.ClosedAligners 4642 } 4643 } 4644 } 4645 return result 4646 } 4647 4648 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 4649 return fieldMask.Project(source.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex)) 4650 } 4651 4652 func (fieldMask *MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask) PathsCount() int { 4653 if fieldMask == nil { 4654 return 0 4655 } 4656 return len(fieldMask.Paths) 4657 } 4658 4659 type MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask struct { 4660 Paths []MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath 4661 } 4662 4663 func FullMetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask() *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask { 4664 res := &MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask{} 4665 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData}) 4666 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions}) 4667 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions}) 4668 return res 4669 } 4670 4671 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) String() string { 4672 if fieldMask == nil { 4673 return "<nil>" 4674 } 4675 pathsStr := make([]string, 0, len(fieldMask.Paths)) 4676 for _, path := range fieldMask.Paths { 4677 pathsStr = append(pathsStr, path.String()) 4678 } 4679 return strings.Join(pathsStr, ", ") 4680 } 4681 4682 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) IsFull() bool { 4683 if fieldMask == nil { 4684 return false 4685 } 4686 presentSelectors := make([]bool, 3) 4687 for _, path := range fieldMask.Paths { 4688 if asFinal, ok := path.(*MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath); ok { 4689 presentSelectors[int(asFinal.selector)] = true 4690 } 4691 } 4692 for _, flag := range presentSelectors { 4693 if !flag { 4694 return false 4695 } 4696 } 4697 return true 4698 } 4699 4700 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) ProtoReflect() preflect.Message { 4701 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 4702 return ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(raw) 4703 }) 4704 } 4705 4706 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) ProtoMessage() {} 4707 4708 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) Reset() { 4709 if fieldMask != nil { 4710 fieldMask.Paths = nil 4711 } 4712 } 4713 4714 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) Subtract(other *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask { 4715 result := &MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask{} 4716 removedSelectors := make([]bool, 3) 4717 4718 for _, path := range other.GetPaths() { 4719 switch tp := path.(type) { 4720 case *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: 4721 removedSelectors[int(tp.selector)] = true 4722 } 4723 } 4724 for _, path := range fieldMask.GetPaths() { 4725 if !removedSelectors[int(path.Selector())] { 4726 result.Paths = append(result.Paths, path) 4727 } 4728 } 4729 4730 if len(result.Paths) == 0 { 4731 return nil 4732 } 4733 return result 4734 } 4735 4736 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 4737 return fieldMask.Subtract(other.(*MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask)) 4738 } 4739 4740 // FilterInputFields generates copy of field paths with output_only field paths removed 4741 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) FilterInputFields() *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask { 4742 result := &MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask{} 4743 result.Paths = append(result.Paths, fieldMask.Paths...) 4744 return result 4745 } 4746 4747 // ToFieldMask is used for proto conversions 4748 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 4749 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4750 for _, path := range fieldMask.Paths { 4751 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 4752 } 4753 return protoFieldMask 4754 } 4755 4756 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 4757 if fieldMask == nil { 4758 return status.Error(codes.Internal, "target field mask is nil") 4759 } 4760 fieldMask.Paths = make([]MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath, 0, len(protoFieldMask.Paths)) 4761 for _, strPath := range protoFieldMask.Paths { 4762 path, err := ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(strPath) 4763 if err != nil { 4764 return err 4765 } 4766 fieldMask.Paths = append(fieldMask.Paths, path) 4767 } 4768 return nil 4769 } 4770 4771 // implement methods required by customType 4772 func (fieldMask MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) Marshal() ([]byte, error) { 4773 protoFieldMask := fieldMask.ToProtoFieldMask() 4774 return proto.Marshal(protoFieldMask) 4775 } 4776 4777 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) Unmarshal(data []byte) error { 4778 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4779 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 4780 return err 4781 } 4782 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4783 return err 4784 } 4785 return nil 4786 } 4787 4788 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) Size() int { 4789 return proto.Size(fieldMask.ToProtoFieldMask()) 4790 } 4791 4792 func (fieldMask MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) MarshalJSON() ([]byte, error) { 4793 return json.Marshal(fieldMask.ToProtoFieldMask()) 4794 } 4795 4796 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) UnmarshalJSON(data []byte) error { 4797 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4798 if err := json.Unmarshal(data, protoFieldMask); err != nil { 4799 return err 4800 } 4801 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4802 return err 4803 } 4804 return nil 4805 } 4806 4807 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) AppendPath(path MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath) { 4808 fieldMask.Paths = append(fieldMask.Paths, path) 4809 } 4810 4811 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 4812 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath)) 4813 } 4814 4815 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) GetPaths() []MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath { 4816 if fieldMask == nil { 4817 return nil 4818 } 4819 return fieldMask.Paths 4820 } 4821 4822 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) GetRawPaths() []gotenobject.FieldPath { 4823 if fieldMask == nil { 4824 return nil 4825 } 4826 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 4827 for _, path := range fieldMask.Paths { 4828 rawPaths = append(rawPaths, path) 4829 } 4830 return rawPaths 4831 } 4832 4833 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) SetFromCliFlag(raw string) error { 4834 path, err := ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(raw) 4835 if err != nil { 4836 return err 4837 } 4838 fieldMask.Paths = append(fieldMask.Paths, path) 4839 return nil 4840 } 4841 4842 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) Set(target, source *MetricDescriptor_BinaryIndices_PaginatingIndex) { 4843 for _, path := range fieldMask.Paths { 4844 val, _ := path.GetSingle(source) 4845 // if val is nil, then field does not exist in source, skip 4846 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 4847 if val != nil { 4848 path.WithIValue(val).SetTo(&target) 4849 } 4850 } 4851 } 4852 4853 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 4854 fieldMask.Set(target.(*MetricDescriptor_BinaryIndices_PaginatingIndex), source.(*MetricDescriptor_BinaryIndices_PaginatingIndex)) 4855 } 4856 4857 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) Project(source *MetricDescriptor_BinaryIndices_PaginatingIndex) *MetricDescriptor_BinaryIndices_PaginatingIndex { 4858 if source == nil { 4859 return nil 4860 } 4861 if fieldMask == nil { 4862 return source 4863 } 4864 result := &MetricDescriptor_BinaryIndices_PaginatingIndex{} 4865 4866 for _, p := range fieldMask.Paths { 4867 switch tp := p.(type) { 4868 case *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: 4869 switch tp.selector { 4870 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 4871 result.KeyData = source.KeyData 4872 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 4873 result.WritingFunctions = source.WritingFunctions 4874 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 4875 result.ClosedFunctions = source.ClosedFunctions 4876 } 4877 } 4878 } 4879 return result 4880 } 4881 4882 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 4883 return fieldMask.Project(source.(*MetricDescriptor_BinaryIndices_PaginatingIndex)) 4884 } 4885 4886 func (fieldMask *MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask) PathsCount() int { 4887 if fieldMask == nil { 4888 return 0 4889 } 4890 return len(fieldMask.Paths) 4891 } 4892 4893 type MetricDescriptor_BinaryIndices_ByResourceType_FieldMask struct { 4894 Paths []MetricDescriptorBinaryIndicesByResourceType_FieldPath 4895 } 4896 4897 func FullMetricDescriptor_BinaryIndices_ByResourceType_FieldMask() *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask { 4898 res := &MetricDescriptor_BinaryIndices_ByResourceType_FieldMask{} 4899 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType}) 4900 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder}) 4901 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices}) 4902 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices}) 4903 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices}) 4904 res.Paths = append(res.Paths, &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts}) 4905 return res 4906 } 4907 4908 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) String() string { 4909 if fieldMask == nil { 4910 return "<nil>" 4911 } 4912 pathsStr := make([]string, 0, len(fieldMask.Paths)) 4913 for _, path := range fieldMask.Paths { 4914 pathsStr = append(pathsStr, path.String()) 4915 } 4916 return strings.Join(pathsStr, ", ") 4917 } 4918 4919 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) IsFull() bool { 4920 if fieldMask == nil { 4921 return false 4922 } 4923 presentSelectors := make([]bool, 6) 4924 for _, path := range fieldMask.Paths { 4925 if asFinal, ok := path.(*MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath); ok { 4926 presentSelectors[int(asFinal.selector)] = true 4927 } 4928 } 4929 for _, flag := range presentSelectors { 4930 if !flag { 4931 return false 4932 } 4933 } 4934 return true 4935 } 4936 4937 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) ProtoReflect() preflect.Message { 4938 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 4939 return ParseMetricDescriptorBinaryIndicesByResourceType_FieldPath(raw) 4940 }) 4941 } 4942 4943 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) ProtoMessage() {} 4944 4945 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) Reset() { 4946 if fieldMask != nil { 4947 fieldMask.Paths = nil 4948 } 4949 } 4950 4951 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) Subtract(other *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask { 4952 result := &MetricDescriptor_BinaryIndices_ByResourceType_FieldMask{} 4953 removedSelectors := make([]bool, 6) 4954 otherSubMasks := map[MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector]gotenobject.FieldMask{ 4955 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: &MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask{}, 4956 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: &MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask{}, 4957 } 4958 mySubMasks := map[MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector]gotenobject.FieldMask{ 4959 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: &MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask{}, 4960 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: &MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask{}, 4961 } 4962 4963 for _, path := range other.GetPaths() { 4964 switch tp := path.(type) { 4965 case *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: 4966 removedSelectors[int(tp.selector)] = true 4967 case *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath: 4968 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 4969 } 4970 } 4971 for _, path := range fieldMask.GetPaths() { 4972 if !removedSelectors[int(path.Selector())] { 4973 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 4974 if tp, ok := path.(*MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath); ok { 4975 switch tp.selector { 4976 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 4977 mySubMasks[MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices] = FullMetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask() 4978 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 4979 mySubMasks[MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices] = FullMetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask() 4980 } 4981 } else if tp, ok := path.(*MetricDescriptorBinaryIndicesByResourceType_FieldSubPath); ok { 4982 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 4983 } 4984 } else { 4985 result.Paths = append(result.Paths, path) 4986 } 4987 } 4988 } 4989 for selector, mySubMask := range mySubMasks { 4990 if mySubMask.PathsCount() > 0 { 4991 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 4992 result.Paths = append(result.Paths, &MetricDescriptorBinaryIndicesByResourceType_FieldSubPath{selector: selector, subPath: allowedPath}) 4993 } 4994 } 4995 } 4996 4997 if len(result.Paths) == 0 { 4998 return nil 4999 } 5000 return result 5001 } 5002 5003 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 5004 return fieldMask.Subtract(other.(*MetricDescriptor_BinaryIndices_ByResourceType_FieldMask)) 5005 } 5006 5007 // FilterInputFields generates copy of field paths with output_only field paths removed 5008 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) FilterInputFields() *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask { 5009 result := &MetricDescriptor_BinaryIndices_ByResourceType_FieldMask{} 5010 result.Paths = append(result.Paths, fieldMask.Paths...) 5011 return result 5012 } 5013 5014 // ToFieldMask is used for proto conversions 5015 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 5016 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5017 for _, path := range fieldMask.Paths { 5018 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 5019 } 5020 return protoFieldMask 5021 } 5022 5023 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 5024 if fieldMask == nil { 5025 return status.Error(codes.Internal, "target field mask is nil") 5026 } 5027 fieldMask.Paths = make([]MetricDescriptorBinaryIndicesByResourceType_FieldPath, 0, len(protoFieldMask.Paths)) 5028 for _, strPath := range protoFieldMask.Paths { 5029 path, err := ParseMetricDescriptorBinaryIndicesByResourceType_FieldPath(strPath) 5030 if err != nil { 5031 return err 5032 } 5033 fieldMask.Paths = append(fieldMask.Paths, path) 5034 } 5035 return nil 5036 } 5037 5038 // implement methods required by customType 5039 func (fieldMask MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) Marshal() ([]byte, error) { 5040 protoFieldMask := fieldMask.ToProtoFieldMask() 5041 return proto.Marshal(protoFieldMask) 5042 } 5043 5044 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) Unmarshal(data []byte) error { 5045 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5046 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 5047 return err 5048 } 5049 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5050 return err 5051 } 5052 return nil 5053 } 5054 5055 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) Size() int { 5056 return proto.Size(fieldMask.ToProtoFieldMask()) 5057 } 5058 5059 func (fieldMask MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) MarshalJSON() ([]byte, error) { 5060 return json.Marshal(fieldMask.ToProtoFieldMask()) 5061 } 5062 5063 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) UnmarshalJSON(data []byte) error { 5064 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5065 if err := json.Unmarshal(data, protoFieldMask); err != nil { 5066 return err 5067 } 5068 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5069 return err 5070 } 5071 return nil 5072 } 5073 5074 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) AppendPath(path MetricDescriptorBinaryIndicesByResourceType_FieldPath) { 5075 fieldMask.Paths = append(fieldMask.Paths, path) 5076 } 5077 5078 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 5079 fieldMask.Paths = append(fieldMask.Paths, path.(MetricDescriptorBinaryIndicesByResourceType_FieldPath)) 5080 } 5081 5082 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) GetPaths() []MetricDescriptorBinaryIndicesByResourceType_FieldPath { 5083 if fieldMask == nil { 5084 return nil 5085 } 5086 return fieldMask.Paths 5087 } 5088 5089 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) GetRawPaths() []gotenobject.FieldPath { 5090 if fieldMask == nil { 5091 return nil 5092 } 5093 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 5094 for _, path := range fieldMask.Paths { 5095 rawPaths = append(rawPaths, path) 5096 } 5097 return rawPaths 5098 } 5099 5100 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) SetFromCliFlag(raw string) error { 5101 path, err := ParseMetricDescriptorBinaryIndicesByResourceType_FieldPath(raw) 5102 if err != nil { 5103 return err 5104 } 5105 fieldMask.Paths = append(fieldMask.Paths, path) 5106 return nil 5107 } 5108 5109 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) Set(target, source *MetricDescriptor_BinaryIndices_ByResourceType) { 5110 for _, path := range fieldMask.Paths { 5111 val, _ := path.GetSingle(source) 5112 // if val is nil, then field does not exist in source, skip 5113 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 5114 if val != nil { 5115 path.WithIValue(val).SetTo(&target) 5116 } 5117 } 5118 } 5119 5120 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 5121 fieldMask.Set(target.(*MetricDescriptor_BinaryIndices_ByResourceType), source.(*MetricDescriptor_BinaryIndices_ByResourceType)) 5122 } 5123 5124 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) Project(source *MetricDescriptor_BinaryIndices_ByResourceType) *MetricDescriptor_BinaryIndices_ByResourceType { 5125 if source == nil { 5126 return nil 5127 } 5128 if fieldMask == nil { 5129 return source 5130 } 5131 result := &MetricDescriptor_BinaryIndices_ByResourceType{} 5132 preAggregatedIndicesMask := &MetricDescriptor_BinaryIndices_PreAggregatedIndex_FieldMask{} 5133 wholePreAggregatedIndicesAccepted := false 5134 paginatingIndicesMask := &MetricDescriptor_BinaryIndices_PaginatingIndex_FieldMask{} 5135 wholePaginatingIndicesAccepted := false 5136 5137 for _, p := range fieldMask.Paths { 5138 switch tp := p.(type) { 5139 case *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: 5140 switch tp.selector { 5141 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 5142 result.ResourceType = source.ResourceType 5143 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 5144 result.AggsEncoder = source.AggsEncoder 5145 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 5146 result.PreAggregatedIndices = source.PreAggregatedIndices 5147 wholePreAggregatedIndicesAccepted = true 5148 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 5149 result.PaginatingIndices = source.PaginatingIndices 5150 wholePaginatingIndicesAccepted = true 5151 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 5152 result.NonAggregatedIndices = source.NonAggregatedIndices 5153 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 5154 result.NameParts = source.NameParts 5155 } 5156 case *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath: 5157 switch tp.selector { 5158 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 5159 preAggregatedIndicesMask.AppendPath(tp.subPath.(MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath)) 5160 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 5161 paginatingIndicesMask.AppendPath(tp.subPath.(MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath)) 5162 } 5163 } 5164 } 5165 if wholePreAggregatedIndicesAccepted == false && len(preAggregatedIndicesMask.Paths) > 0 { 5166 for _, sourceItem := range source.GetPreAggregatedIndices() { 5167 result.PreAggregatedIndices = append(result.PreAggregatedIndices, preAggregatedIndicesMask.Project(sourceItem)) 5168 } 5169 } 5170 if wholePaginatingIndicesAccepted == false && len(paginatingIndicesMask.Paths) > 0 { 5171 for _, sourceItem := range source.GetPaginatingIndices() { 5172 result.PaginatingIndices = append(result.PaginatingIndices, paginatingIndicesMask.Project(sourceItem)) 5173 } 5174 } 5175 return result 5176 } 5177 5178 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 5179 return fieldMask.Project(source.(*MetricDescriptor_BinaryIndices_ByResourceType)) 5180 } 5181 5182 func (fieldMask *MetricDescriptor_BinaryIndices_ByResourceType_FieldMask) PathsCount() int { 5183 if fieldMask == nil { 5184 return 0 5185 } 5186 return len(fieldMask.Paths) 5187 }