github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/metric_descriptor/metric_descriptor.pb.fieldpath.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 "fmt" 10 "reflect" 11 "strings" 12 "time" 13 14 "google.golang.org/grpc/codes" 15 "google.golang.org/grpc/status" 16 "google.golang.org/protobuf/encoding/protojson" 17 "google.golang.org/protobuf/proto" 18 "google.golang.org/protobuf/reflect/protoregistry" 19 20 gotenobject "github.com/cloudwan/goten-sdk/runtime/object" 21 "github.com/cloudwan/goten-sdk/runtime/strcase" 22 ) 23 24 // proto imports 25 import ( 26 api "github.com/cloudwan/edgelq-sdk/common/api" 27 common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 28 monitored_resource_descriptor "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/monitored_resource_descriptor" 29 project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/project" 30 meta "github.com/cloudwan/goten-sdk/types/meta" 31 durationpb "google.golang.org/protobuf/types/known/durationpb" 32 ) 33 34 // ensure the imports are used 35 var ( 36 _ = new(json.Marshaler) 37 _ = new(fmt.Stringer) 38 _ = reflect.DeepEqual 39 _ = strings.Builder{} 40 _ = time.Second 41 42 _ = strcase.ToLowerCamel 43 _ = codes.NotFound 44 _ = status.Status{} 45 _ = protojson.UnmarshalOptions{} 46 _ = new(proto.Message) 47 _ = protoregistry.GlobalTypes 48 49 _ = new(gotenobject.FieldPath) 50 ) 51 52 // make sure we're using proto imports 53 var ( 54 _ = api.LaunchStage(0) 55 _ = &common.LabelDescriptor{} 56 _ = &monitored_resource_descriptor.MonitoredResourceDescriptor{} 57 _ = &project.Project{} 58 _ = &durationpb.Duration{} 59 _ = &meta.Meta{} 60 ) 61 62 // FieldPath provides implementation to handle 63 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 64 type MetricDescriptor_FieldPath interface { 65 gotenobject.FieldPath 66 Selector() MetricDescriptor_FieldPathSelector 67 Get(source *MetricDescriptor) []interface{} 68 GetSingle(source *MetricDescriptor) (interface{}, bool) 69 ClearValue(item *MetricDescriptor) 70 71 // Those methods build corresponding MetricDescriptor_FieldPathValue 72 // (or array of values) and holds passed value. Panics if injected type is incorrect. 73 WithIValue(value interface{}) MetricDescriptor_FieldPathValue 74 WithIArrayOfValues(values interface{}) MetricDescriptor_FieldPathArrayOfValues 75 WithIArrayItemValue(value interface{}) MetricDescriptor_FieldPathArrayItemValue 76 } 77 78 type MetricDescriptor_FieldPathSelector int32 79 80 const ( 81 MetricDescriptor_FieldPathSelectorName MetricDescriptor_FieldPathSelector = 0 82 MetricDescriptor_FieldPathSelectorMetadata MetricDescriptor_FieldPathSelector = 1 83 MetricDescriptor_FieldPathSelectorType MetricDescriptor_FieldPathSelector = 2 84 MetricDescriptor_FieldPathSelectorResourceTypes MetricDescriptor_FieldPathSelector = 3 85 MetricDescriptor_FieldPathSelectorLabels MetricDescriptor_FieldPathSelector = 4 86 MetricDescriptor_FieldPathSelectorMetricKind MetricDescriptor_FieldPathSelector = 5 87 MetricDescriptor_FieldPathSelectorValueType MetricDescriptor_FieldPathSelector = 6 88 MetricDescriptor_FieldPathSelectorUnit MetricDescriptor_FieldPathSelector = 7 89 MetricDescriptor_FieldPathSelectorDescription MetricDescriptor_FieldPathSelector = 8 90 MetricDescriptor_FieldPathSelectorDisplayName MetricDescriptor_FieldPathSelector = 9 91 MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata MetricDescriptor_FieldPathSelector = 10 92 MetricDescriptor_FieldPathSelectorDistributionBucketOptions MetricDescriptor_FieldPathSelector = 11 93 MetricDescriptor_FieldPathSelectorPromotedLabelKeySets MetricDescriptor_FieldPathSelector = 12 94 MetricDescriptor_FieldPathSelectorIndexSpec MetricDescriptor_FieldPathSelector = 13 95 MetricDescriptor_FieldPathSelectorIndices MetricDescriptor_FieldPathSelector = 14 96 MetricDescriptor_FieldPathSelectorStorageConfig MetricDescriptor_FieldPathSelector = 15 97 MetricDescriptor_FieldPathSelectorBinaryIndices MetricDescriptor_FieldPathSelector = 16 98 ) 99 100 func (s MetricDescriptor_FieldPathSelector) String() string { 101 switch s { 102 case MetricDescriptor_FieldPathSelectorName: 103 return "name" 104 case MetricDescriptor_FieldPathSelectorMetadata: 105 return "metadata" 106 case MetricDescriptor_FieldPathSelectorType: 107 return "type" 108 case MetricDescriptor_FieldPathSelectorResourceTypes: 109 return "resource_types" 110 case MetricDescriptor_FieldPathSelectorLabels: 111 return "labels" 112 case MetricDescriptor_FieldPathSelectorMetricKind: 113 return "metric_kind" 114 case MetricDescriptor_FieldPathSelectorValueType: 115 return "value_type" 116 case MetricDescriptor_FieldPathSelectorUnit: 117 return "unit" 118 case MetricDescriptor_FieldPathSelectorDescription: 119 return "description" 120 case MetricDescriptor_FieldPathSelectorDisplayName: 121 return "display_name" 122 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 123 return "metric_descriptor_metadata" 124 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 125 return "distribution_bucket_options" 126 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 127 return "promoted_label_key_sets" 128 case MetricDescriptor_FieldPathSelectorIndexSpec: 129 return "index_spec" 130 case MetricDescriptor_FieldPathSelectorIndices: 131 return "indices" 132 case MetricDescriptor_FieldPathSelectorStorageConfig: 133 return "storage_config" 134 case MetricDescriptor_FieldPathSelectorBinaryIndices: 135 return "binary_indices" 136 default: 137 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", s)) 138 } 139 } 140 141 func BuildMetricDescriptor_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptor_FieldPath, error) { 142 if len(fp) == 0 { 143 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor") 144 } 145 if len(fp) == 1 { 146 switch fp[0] { 147 case "name": 148 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorName}, nil 149 case "metadata": 150 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorMetadata}, nil 151 case "type": 152 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorType}, nil 153 case "resource_types", "resourceTypes", "resource-types": 154 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorResourceTypes}, nil 155 case "labels": 156 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorLabels}, nil 157 case "metric_kind", "metricKind", "metric-kind": 158 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorMetricKind}, nil 159 case "value_type", "valueType", "value-type": 160 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorValueType}, nil 161 case "unit": 162 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorUnit}, nil 163 case "description": 164 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorDescription}, nil 165 case "display_name", "displayName", "display-name": 166 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorDisplayName}, nil 167 case "metric_descriptor_metadata", "metricDescriptorMetadata", "metric-descriptor-metadata": 168 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata}, nil 169 case "distribution_bucket_options", "distributionBucketOptions", "distribution-bucket-options": 170 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorDistributionBucketOptions}, nil 171 case "promoted_label_key_sets", "promotedLabelKeySets", "promoted-label-key-sets": 172 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorPromotedLabelKeySets}, nil 173 case "index_spec", "indexSpec", "index-spec": 174 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorIndexSpec}, nil 175 case "indices": 176 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorIndices}, nil 177 case "storage_config", "storageConfig", "storage-config": 178 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorStorageConfig}, nil 179 case "binary_indices", "binaryIndices", "binary-indices": 180 return &MetricDescriptor_FieldTerminalPath{selector: MetricDescriptor_FieldPathSelectorBinaryIndices}, nil 181 } 182 } else { 183 switch fp[0] { 184 case "metadata": 185 if subpath, err := meta.BuildMeta_FieldPath(fp[1:]); err != nil { 186 return nil, err 187 } else { 188 return &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorMetadata, subPath: subpath}, nil 189 } 190 case "labels": 191 if subpath, err := common.BuildLabelDescriptor_FieldPath(fp[1:]); err != nil { 192 return nil, err 193 } else { 194 return &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorLabels, subPath: subpath}, nil 195 } 196 case "metric_descriptor_metadata", "metricDescriptorMetadata", "metric-descriptor-metadata": 197 if subpath, err := BuildMetricDescriptorMetricDescriptorMetadata_FieldPath(fp[1:]); err != nil { 198 return nil, err 199 } else { 200 return &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata, subPath: subpath}, nil 201 } 202 case "distribution_bucket_options", "distributionBucketOptions", "distribution-bucket-options": 203 if subpath, err := common.BuildDistributionBucketOptions_FieldPath(fp[1:]); err != nil { 204 return nil, err 205 } else { 206 return &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorDistributionBucketOptions, subPath: subpath}, nil 207 } 208 case "promoted_label_key_sets", "promotedLabelKeySets", "promoted-label-key-sets": 209 if subpath, err := common.BuildLabelKeySet_FieldPath(fp[1:]); err != nil { 210 return nil, err 211 } else { 212 return &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorPromotedLabelKeySets, subPath: subpath}, nil 213 } 214 case "index_spec", "indexSpec", "index-spec": 215 if subpath, err := BuildMetricDescriptorIndexSpec_FieldPath(fp[1:]); err != nil { 216 return nil, err 217 } else { 218 return &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorIndexSpec, subPath: subpath}, nil 219 } 220 case "indices": 221 if subpath, err := BuildMetricDescriptorIndices_FieldPath(fp[1:]); err != nil { 222 return nil, err 223 } else { 224 return &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorIndices, subPath: subpath}, nil 225 } 226 case "storage_config", "storageConfig", "storage-config": 227 if subpath, err := BuildMetricDescriptorStorageConfig_FieldPath(fp[1:]); err != nil { 228 return nil, err 229 } else { 230 return &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorStorageConfig, subPath: subpath}, nil 231 } 232 case "binary_indices", "binaryIndices", "binary-indices": 233 if subpath, err := BuildMetricDescriptorBinaryIndices_FieldPath(fp[1:]); err != nil { 234 return nil, err 235 } else { 236 return &MetricDescriptor_FieldSubPath{selector: MetricDescriptor_FieldPathSelectorBinaryIndices, subPath: subpath}, nil 237 } 238 } 239 } 240 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor", fp) 241 } 242 243 func ParseMetricDescriptor_FieldPath(rawField string) (MetricDescriptor_FieldPath, error) { 244 fp, err := gotenobject.ParseRawFieldPath(rawField) 245 if err != nil { 246 return nil, err 247 } 248 return BuildMetricDescriptor_FieldPath(fp) 249 } 250 251 func MustParseMetricDescriptor_FieldPath(rawField string) MetricDescriptor_FieldPath { 252 fp, err := ParseMetricDescriptor_FieldPath(rawField) 253 if err != nil { 254 panic(err) 255 } 256 return fp 257 } 258 259 type MetricDescriptor_FieldTerminalPath struct { 260 selector MetricDescriptor_FieldPathSelector 261 } 262 263 var _ MetricDescriptor_FieldPath = (*MetricDescriptor_FieldTerminalPath)(nil) 264 265 func (fp *MetricDescriptor_FieldTerminalPath) Selector() MetricDescriptor_FieldPathSelector { 266 return fp.selector 267 } 268 269 // String returns path representation in proto convention 270 func (fp *MetricDescriptor_FieldTerminalPath) String() string { 271 return fp.selector.String() 272 } 273 274 // JSONString returns path representation is JSON convention 275 func (fp *MetricDescriptor_FieldTerminalPath) JSONString() string { 276 return strcase.ToLowerCamel(fp.String()) 277 } 278 279 // Get returns all values pointed by specific field from source MetricDescriptor 280 func (fp *MetricDescriptor_FieldTerminalPath) Get(source *MetricDescriptor) (values []interface{}) { 281 if source != nil { 282 switch fp.selector { 283 case MetricDescriptor_FieldPathSelectorName: 284 if source.Name != nil { 285 values = append(values, source.Name) 286 } 287 case MetricDescriptor_FieldPathSelectorMetadata: 288 if source.Metadata != nil { 289 values = append(values, source.Metadata) 290 } 291 case MetricDescriptor_FieldPathSelectorType: 292 values = append(values, source.Type) 293 case MetricDescriptor_FieldPathSelectorResourceTypes: 294 for _, value := range source.GetResourceTypes() { 295 values = append(values, value) 296 } 297 case MetricDescriptor_FieldPathSelectorLabels: 298 for _, value := range source.GetLabels() { 299 values = append(values, value) 300 } 301 case MetricDescriptor_FieldPathSelectorMetricKind: 302 values = append(values, source.MetricKind) 303 case MetricDescriptor_FieldPathSelectorValueType: 304 values = append(values, source.ValueType) 305 case MetricDescriptor_FieldPathSelectorUnit: 306 values = append(values, source.Unit) 307 case MetricDescriptor_FieldPathSelectorDescription: 308 values = append(values, source.Description) 309 case MetricDescriptor_FieldPathSelectorDisplayName: 310 values = append(values, source.DisplayName) 311 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 312 if source.MetricDescriptorMetadata != nil { 313 values = append(values, source.MetricDescriptorMetadata) 314 } 315 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 316 if source.DistributionBucketOptions != nil { 317 values = append(values, source.DistributionBucketOptions) 318 } 319 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 320 for _, value := range source.GetPromotedLabelKeySets() { 321 values = append(values, value) 322 } 323 case MetricDescriptor_FieldPathSelectorIndexSpec: 324 if source.IndexSpec != nil { 325 values = append(values, source.IndexSpec) 326 } 327 case MetricDescriptor_FieldPathSelectorIndices: 328 if source.Indices != nil { 329 values = append(values, source.Indices) 330 } 331 case MetricDescriptor_FieldPathSelectorStorageConfig: 332 if source.StorageConfig != nil { 333 values = append(values, source.StorageConfig) 334 } 335 case MetricDescriptor_FieldPathSelectorBinaryIndices: 336 if source.BinaryIndices != nil { 337 values = append(values, source.BinaryIndices) 338 } 339 default: 340 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fp.selector)) 341 } 342 } 343 return 344 } 345 346 func (fp *MetricDescriptor_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 347 return fp.Get(source.(*MetricDescriptor)) 348 } 349 350 // GetSingle returns value pointed by specific field of from source MetricDescriptor 351 func (fp *MetricDescriptor_FieldTerminalPath) GetSingle(source *MetricDescriptor) (interface{}, bool) { 352 switch fp.selector { 353 case MetricDescriptor_FieldPathSelectorName: 354 res := source.GetName() 355 return res, res != nil 356 case MetricDescriptor_FieldPathSelectorMetadata: 357 res := source.GetMetadata() 358 return res, res != nil 359 case MetricDescriptor_FieldPathSelectorType: 360 return source.GetType(), source != nil 361 case MetricDescriptor_FieldPathSelectorResourceTypes: 362 res := source.GetResourceTypes() 363 return res, res != nil 364 case MetricDescriptor_FieldPathSelectorLabels: 365 res := source.GetLabels() 366 return res, res != nil 367 case MetricDescriptor_FieldPathSelectorMetricKind: 368 return source.GetMetricKind(), source != nil 369 case MetricDescriptor_FieldPathSelectorValueType: 370 return source.GetValueType(), source != nil 371 case MetricDescriptor_FieldPathSelectorUnit: 372 return source.GetUnit(), source != nil 373 case MetricDescriptor_FieldPathSelectorDescription: 374 return source.GetDescription(), source != nil 375 case MetricDescriptor_FieldPathSelectorDisplayName: 376 return source.GetDisplayName(), source != nil 377 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 378 res := source.GetMetricDescriptorMetadata() 379 return res, res != nil 380 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 381 res := source.GetDistributionBucketOptions() 382 return res, res != nil 383 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 384 res := source.GetPromotedLabelKeySets() 385 return res, res != nil 386 case MetricDescriptor_FieldPathSelectorIndexSpec: 387 res := source.GetIndexSpec() 388 return res, res != nil 389 case MetricDescriptor_FieldPathSelectorIndices: 390 res := source.GetIndices() 391 return res, res != nil 392 case MetricDescriptor_FieldPathSelectorStorageConfig: 393 res := source.GetStorageConfig() 394 return res, res != nil 395 case MetricDescriptor_FieldPathSelectorBinaryIndices: 396 res := source.GetBinaryIndices() 397 return res, res != nil 398 default: 399 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fp.selector)) 400 } 401 } 402 403 func (fp *MetricDescriptor_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 404 return fp.GetSingle(source.(*MetricDescriptor)) 405 } 406 407 // GetDefault returns a default value of the field type 408 func (fp *MetricDescriptor_FieldTerminalPath) GetDefault() interface{} { 409 switch fp.selector { 410 case MetricDescriptor_FieldPathSelectorName: 411 return (*Name)(nil) 412 case MetricDescriptor_FieldPathSelectorMetadata: 413 return (*meta.Meta)(nil) 414 case MetricDescriptor_FieldPathSelectorType: 415 return "" 416 case MetricDescriptor_FieldPathSelectorResourceTypes: 417 return ([]string)(nil) 418 case MetricDescriptor_FieldPathSelectorLabels: 419 return ([]*common.LabelDescriptor)(nil) 420 case MetricDescriptor_FieldPathSelectorMetricKind: 421 return MetricDescriptor_METRIC_KIND_UNSPECIFIED 422 case MetricDescriptor_FieldPathSelectorValueType: 423 return MetricDescriptor_VALUE_TYPE_UNSPECIFIED 424 case MetricDescriptor_FieldPathSelectorUnit: 425 return "" 426 case MetricDescriptor_FieldPathSelectorDescription: 427 return "" 428 case MetricDescriptor_FieldPathSelectorDisplayName: 429 return "" 430 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 431 return (*MetricDescriptor_MetricDescriptorMetadata)(nil) 432 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 433 return (*common.Distribution_BucketOptions)(nil) 434 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 435 return ([]*common.LabelKeySet)(nil) 436 case MetricDescriptor_FieldPathSelectorIndexSpec: 437 return (*MetricDescriptor_IndexSpec)(nil) 438 case MetricDescriptor_FieldPathSelectorIndices: 439 return (*MetricDescriptor_Indices)(nil) 440 case MetricDescriptor_FieldPathSelectorStorageConfig: 441 return (*MetricDescriptor_StorageConfig)(nil) 442 case MetricDescriptor_FieldPathSelectorBinaryIndices: 443 return (*MetricDescriptor_BinaryIndices)(nil) 444 default: 445 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fp.selector)) 446 } 447 } 448 449 func (fp *MetricDescriptor_FieldTerminalPath) ClearValue(item *MetricDescriptor) { 450 if item != nil { 451 switch fp.selector { 452 case MetricDescriptor_FieldPathSelectorName: 453 item.Name = nil 454 case MetricDescriptor_FieldPathSelectorMetadata: 455 item.Metadata = nil 456 case MetricDescriptor_FieldPathSelectorType: 457 item.Type = "" 458 case MetricDescriptor_FieldPathSelectorResourceTypes: 459 item.ResourceTypes = nil 460 case MetricDescriptor_FieldPathSelectorLabels: 461 item.Labels = nil 462 case MetricDescriptor_FieldPathSelectorMetricKind: 463 item.MetricKind = MetricDescriptor_METRIC_KIND_UNSPECIFIED 464 case MetricDescriptor_FieldPathSelectorValueType: 465 item.ValueType = MetricDescriptor_VALUE_TYPE_UNSPECIFIED 466 case MetricDescriptor_FieldPathSelectorUnit: 467 item.Unit = "" 468 case MetricDescriptor_FieldPathSelectorDescription: 469 item.Description = "" 470 case MetricDescriptor_FieldPathSelectorDisplayName: 471 item.DisplayName = "" 472 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 473 item.MetricDescriptorMetadata = nil 474 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 475 item.DistributionBucketOptions = nil 476 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 477 item.PromotedLabelKeySets = nil 478 case MetricDescriptor_FieldPathSelectorIndexSpec: 479 item.IndexSpec = nil 480 case MetricDescriptor_FieldPathSelectorIndices: 481 item.Indices = nil 482 case MetricDescriptor_FieldPathSelectorStorageConfig: 483 item.StorageConfig = nil 484 case MetricDescriptor_FieldPathSelectorBinaryIndices: 485 item.BinaryIndices = nil 486 default: 487 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fp.selector)) 488 } 489 } 490 } 491 492 func (fp *MetricDescriptor_FieldTerminalPath) ClearValueRaw(item proto.Message) { 493 fp.ClearValue(item.(*MetricDescriptor)) 494 } 495 496 // IsLeaf - whether field path is holds simple value 497 func (fp *MetricDescriptor_FieldTerminalPath) IsLeaf() bool { 498 return fp.selector == MetricDescriptor_FieldPathSelectorName || 499 fp.selector == MetricDescriptor_FieldPathSelectorType || 500 fp.selector == MetricDescriptor_FieldPathSelectorResourceTypes || 501 fp.selector == MetricDescriptor_FieldPathSelectorMetricKind || 502 fp.selector == MetricDescriptor_FieldPathSelectorValueType || 503 fp.selector == MetricDescriptor_FieldPathSelectorUnit || 504 fp.selector == MetricDescriptor_FieldPathSelectorDescription || 505 fp.selector == MetricDescriptor_FieldPathSelectorDisplayName 506 } 507 508 func (fp *MetricDescriptor_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 509 return []gotenobject.FieldPath{fp} 510 } 511 512 func (fp *MetricDescriptor_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptor_FieldPathValue { 513 switch fp.selector { 514 case MetricDescriptor_FieldPathSelectorName: 515 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*Name)} 516 case MetricDescriptor_FieldPathSelectorMetadata: 517 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*meta.Meta)} 518 case MetricDescriptor_FieldPathSelectorType: 519 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(string)} 520 case MetricDescriptor_FieldPathSelectorResourceTypes: 521 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.([]string)} 522 case MetricDescriptor_FieldPathSelectorLabels: 523 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.([]*common.LabelDescriptor)} 524 case MetricDescriptor_FieldPathSelectorMetricKind: 525 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(MetricDescriptor_MetricKind)} 526 case MetricDescriptor_FieldPathSelectorValueType: 527 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(MetricDescriptor_ValueType)} 528 case MetricDescriptor_FieldPathSelectorUnit: 529 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(string)} 530 case MetricDescriptor_FieldPathSelectorDescription: 531 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(string)} 532 case MetricDescriptor_FieldPathSelectorDisplayName: 533 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(string)} 534 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 535 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_MetricDescriptorMetadata)} 536 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 537 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*common.Distribution_BucketOptions)} 538 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 539 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.([]*common.LabelKeySet)} 540 case MetricDescriptor_FieldPathSelectorIndexSpec: 541 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_IndexSpec)} 542 case MetricDescriptor_FieldPathSelectorIndices: 543 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices)} 544 case MetricDescriptor_FieldPathSelectorStorageConfig: 545 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_StorageConfig)} 546 case MetricDescriptor_FieldPathSelectorBinaryIndices: 547 return &MetricDescriptor_FieldTerminalPathValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_BinaryIndices)} 548 default: 549 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fp.selector)) 550 } 551 } 552 553 func (fp *MetricDescriptor_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 554 return fp.WithIValue(value) 555 } 556 557 func (fp *MetricDescriptor_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptor_FieldPathArrayOfValues { 558 fpaov := &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp} 559 switch fp.selector { 560 case MetricDescriptor_FieldPathSelectorName: 561 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]*Name)} 562 case MetricDescriptor_FieldPathSelectorMetadata: 563 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]*meta.Meta)} 564 case MetricDescriptor_FieldPathSelectorType: 565 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]string)} 566 case MetricDescriptor_FieldPathSelectorResourceTypes: 567 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([][]string)} 568 case MetricDescriptor_FieldPathSelectorLabels: 569 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([][]*common.LabelDescriptor)} 570 case MetricDescriptor_FieldPathSelectorMetricKind: 571 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]MetricDescriptor_MetricKind)} 572 case MetricDescriptor_FieldPathSelectorValueType: 573 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]MetricDescriptor_ValueType)} 574 case MetricDescriptor_FieldPathSelectorUnit: 575 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]string)} 576 case MetricDescriptor_FieldPathSelectorDescription: 577 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]string)} 578 case MetricDescriptor_FieldPathSelectorDisplayName: 579 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]string)} 580 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 581 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]*MetricDescriptor_MetricDescriptorMetadata)} 582 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 583 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]*common.Distribution_BucketOptions)} 584 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 585 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([][]*common.LabelKeySet)} 586 case MetricDescriptor_FieldPathSelectorIndexSpec: 587 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]*MetricDescriptor_IndexSpec)} 588 case MetricDescriptor_FieldPathSelectorIndices: 589 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]*MetricDescriptor_Indices)} 590 case MetricDescriptor_FieldPathSelectorStorageConfig: 591 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]*MetricDescriptor_StorageConfig)} 592 case MetricDescriptor_FieldPathSelectorBinaryIndices: 593 return &MetricDescriptor_FieldTerminalPathArrayOfValues{MetricDescriptor_FieldTerminalPath: *fp, values: values.([]*MetricDescriptor_BinaryIndices)} 594 default: 595 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fp.selector)) 596 } 597 return fpaov 598 } 599 600 func (fp *MetricDescriptor_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 601 return fp.WithIArrayOfValues(values) 602 } 603 604 func (fp *MetricDescriptor_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptor_FieldPathArrayItemValue { 605 switch fp.selector { 606 case MetricDescriptor_FieldPathSelectorResourceTypes: 607 return &MetricDescriptor_FieldTerminalPathArrayItemValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(string)} 608 case MetricDescriptor_FieldPathSelectorLabels: 609 return &MetricDescriptor_FieldTerminalPathArrayItemValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*common.LabelDescriptor)} 610 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 611 return &MetricDescriptor_FieldTerminalPathArrayItemValue{MetricDescriptor_FieldTerminalPath: *fp, value: value.(*common.LabelKeySet)} 612 default: 613 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fp.selector)) 614 } 615 } 616 617 func (fp *MetricDescriptor_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 618 return fp.WithIArrayItemValue(value) 619 } 620 621 type MetricDescriptor_FieldSubPath struct { 622 selector MetricDescriptor_FieldPathSelector 623 subPath gotenobject.FieldPath 624 } 625 626 var _ MetricDescriptor_FieldPath = (*MetricDescriptor_FieldSubPath)(nil) 627 628 func (fps *MetricDescriptor_FieldSubPath) Selector() MetricDescriptor_FieldPathSelector { 629 return fps.selector 630 } 631 func (fps *MetricDescriptor_FieldSubPath) AsMetadataSubPath() (meta.Meta_FieldPath, bool) { 632 res, ok := fps.subPath.(meta.Meta_FieldPath) 633 return res, ok 634 } 635 func (fps *MetricDescriptor_FieldSubPath) AsLabelsSubPath() (common.LabelDescriptor_FieldPath, bool) { 636 res, ok := fps.subPath.(common.LabelDescriptor_FieldPath) 637 return res, ok 638 } 639 func (fps *MetricDescriptor_FieldSubPath) AsMetricDescriptorMetadataSubPath() (MetricDescriptorMetricDescriptorMetadata_FieldPath, bool) { 640 res, ok := fps.subPath.(MetricDescriptorMetricDescriptorMetadata_FieldPath) 641 return res, ok 642 } 643 func (fps *MetricDescriptor_FieldSubPath) AsDistributionBucketOptionsSubPath() (common.DistributionBucketOptions_FieldPath, bool) { 644 res, ok := fps.subPath.(common.DistributionBucketOptions_FieldPath) 645 return res, ok 646 } 647 func (fps *MetricDescriptor_FieldSubPath) AsPromotedLabelKeySetsSubPath() (common.LabelKeySet_FieldPath, bool) { 648 res, ok := fps.subPath.(common.LabelKeySet_FieldPath) 649 return res, ok 650 } 651 func (fps *MetricDescriptor_FieldSubPath) AsIndexSpecSubPath() (MetricDescriptorIndexSpec_FieldPath, bool) { 652 res, ok := fps.subPath.(MetricDescriptorIndexSpec_FieldPath) 653 return res, ok 654 } 655 func (fps *MetricDescriptor_FieldSubPath) AsIndicesSubPath() (MetricDescriptorIndices_FieldPath, bool) { 656 res, ok := fps.subPath.(MetricDescriptorIndices_FieldPath) 657 return res, ok 658 } 659 func (fps *MetricDescriptor_FieldSubPath) AsStorageConfigSubPath() (MetricDescriptorStorageConfig_FieldPath, bool) { 660 res, ok := fps.subPath.(MetricDescriptorStorageConfig_FieldPath) 661 return res, ok 662 } 663 func (fps *MetricDescriptor_FieldSubPath) AsBinaryIndicesSubPath() (MetricDescriptorBinaryIndices_FieldPath, bool) { 664 res, ok := fps.subPath.(MetricDescriptorBinaryIndices_FieldPath) 665 return res, ok 666 } 667 668 // String returns path representation in proto convention 669 func (fps *MetricDescriptor_FieldSubPath) String() string { 670 return fps.selector.String() + "." + fps.subPath.String() 671 } 672 673 // JSONString returns path representation is JSON convention 674 func (fps *MetricDescriptor_FieldSubPath) JSONString() string { 675 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 676 } 677 678 // Get returns all values pointed by selected field from source MetricDescriptor 679 func (fps *MetricDescriptor_FieldSubPath) Get(source *MetricDescriptor) (values []interface{}) { 680 switch fps.selector { 681 case MetricDescriptor_FieldPathSelectorMetadata: 682 values = append(values, fps.subPath.GetRaw(source.GetMetadata())...) 683 case MetricDescriptor_FieldPathSelectorLabels: 684 for _, item := range source.GetLabels() { 685 values = append(values, fps.subPath.GetRaw(item)...) 686 } 687 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 688 values = append(values, fps.subPath.GetRaw(source.GetMetricDescriptorMetadata())...) 689 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 690 values = append(values, fps.subPath.GetRaw(source.GetDistributionBucketOptions())...) 691 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 692 for _, item := range source.GetPromotedLabelKeySets() { 693 values = append(values, fps.subPath.GetRaw(item)...) 694 } 695 case MetricDescriptor_FieldPathSelectorIndexSpec: 696 values = append(values, fps.subPath.GetRaw(source.GetIndexSpec())...) 697 case MetricDescriptor_FieldPathSelectorIndices: 698 values = append(values, fps.subPath.GetRaw(source.GetIndices())...) 699 case MetricDescriptor_FieldPathSelectorStorageConfig: 700 values = append(values, fps.subPath.GetRaw(source.GetStorageConfig())...) 701 case MetricDescriptor_FieldPathSelectorBinaryIndices: 702 values = append(values, fps.subPath.GetRaw(source.GetBinaryIndices())...) 703 default: 704 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fps.selector)) 705 } 706 return 707 } 708 709 func (fps *MetricDescriptor_FieldSubPath) GetRaw(source proto.Message) []interface{} { 710 return fps.Get(source.(*MetricDescriptor)) 711 } 712 713 // GetSingle returns value of selected field from source MetricDescriptor 714 func (fps *MetricDescriptor_FieldSubPath) GetSingle(source *MetricDescriptor) (interface{}, bool) { 715 switch fps.selector { 716 case MetricDescriptor_FieldPathSelectorMetadata: 717 if source.GetMetadata() == nil { 718 return nil, false 719 } 720 return fps.subPath.GetSingleRaw(source.GetMetadata()) 721 case MetricDescriptor_FieldPathSelectorLabels: 722 if len(source.GetLabels()) == 0 { 723 return nil, false 724 } 725 return fps.subPath.GetSingleRaw(source.GetLabels()[0]) 726 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 727 if source.GetMetricDescriptorMetadata() == nil { 728 return nil, false 729 } 730 return fps.subPath.GetSingleRaw(source.GetMetricDescriptorMetadata()) 731 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 732 if source.GetDistributionBucketOptions() == nil { 733 return nil, false 734 } 735 return fps.subPath.GetSingleRaw(source.GetDistributionBucketOptions()) 736 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 737 if len(source.GetPromotedLabelKeySets()) == 0 { 738 return nil, false 739 } 740 return fps.subPath.GetSingleRaw(source.GetPromotedLabelKeySets()[0]) 741 case MetricDescriptor_FieldPathSelectorIndexSpec: 742 if source.GetIndexSpec() == nil { 743 return nil, false 744 } 745 return fps.subPath.GetSingleRaw(source.GetIndexSpec()) 746 case MetricDescriptor_FieldPathSelectorIndices: 747 if source.GetIndices() == nil { 748 return nil, false 749 } 750 return fps.subPath.GetSingleRaw(source.GetIndices()) 751 case MetricDescriptor_FieldPathSelectorStorageConfig: 752 if source.GetStorageConfig() == nil { 753 return nil, false 754 } 755 return fps.subPath.GetSingleRaw(source.GetStorageConfig()) 756 case MetricDescriptor_FieldPathSelectorBinaryIndices: 757 if source.GetBinaryIndices() == nil { 758 return nil, false 759 } 760 return fps.subPath.GetSingleRaw(source.GetBinaryIndices()) 761 default: 762 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fps.selector)) 763 } 764 } 765 766 func (fps *MetricDescriptor_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 767 return fps.GetSingle(source.(*MetricDescriptor)) 768 } 769 770 // GetDefault returns a default value of the field type 771 func (fps *MetricDescriptor_FieldSubPath) GetDefault() interface{} { 772 return fps.subPath.GetDefault() 773 } 774 775 func (fps *MetricDescriptor_FieldSubPath) ClearValue(item *MetricDescriptor) { 776 if item != nil { 777 switch fps.selector { 778 case MetricDescriptor_FieldPathSelectorMetadata: 779 fps.subPath.ClearValueRaw(item.Metadata) 780 case MetricDescriptor_FieldPathSelectorLabels: 781 for _, subItem := range item.Labels { 782 fps.subPath.ClearValueRaw(subItem) 783 } 784 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 785 fps.subPath.ClearValueRaw(item.MetricDescriptorMetadata) 786 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 787 fps.subPath.ClearValueRaw(item.DistributionBucketOptions) 788 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 789 for _, subItem := range item.PromotedLabelKeySets { 790 fps.subPath.ClearValueRaw(subItem) 791 } 792 case MetricDescriptor_FieldPathSelectorIndexSpec: 793 fps.subPath.ClearValueRaw(item.IndexSpec) 794 case MetricDescriptor_FieldPathSelectorIndices: 795 fps.subPath.ClearValueRaw(item.Indices) 796 case MetricDescriptor_FieldPathSelectorStorageConfig: 797 fps.subPath.ClearValueRaw(item.StorageConfig) 798 case MetricDescriptor_FieldPathSelectorBinaryIndices: 799 fps.subPath.ClearValueRaw(item.BinaryIndices) 800 default: 801 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fps.selector)) 802 } 803 } 804 } 805 806 func (fps *MetricDescriptor_FieldSubPath) ClearValueRaw(item proto.Message) { 807 fps.ClearValue(item.(*MetricDescriptor)) 808 } 809 810 // IsLeaf - whether field path is holds simple value 811 func (fps *MetricDescriptor_FieldSubPath) IsLeaf() bool { 812 return fps.subPath.IsLeaf() 813 } 814 815 func (fps *MetricDescriptor_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 816 iPaths := []gotenobject.FieldPath{&MetricDescriptor_FieldTerminalPath{selector: fps.selector}} 817 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 818 return iPaths 819 } 820 821 func (fps *MetricDescriptor_FieldSubPath) WithIValue(value interface{}) MetricDescriptor_FieldPathValue { 822 return &MetricDescriptor_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 823 } 824 825 func (fps *MetricDescriptor_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 826 return fps.WithIValue(value) 827 } 828 829 func (fps *MetricDescriptor_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptor_FieldPathArrayOfValues { 830 return &MetricDescriptor_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 831 } 832 833 func (fps *MetricDescriptor_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 834 return fps.WithIArrayOfValues(values) 835 } 836 837 func (fps *MetricDescriptor_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptor_FieldPathArrayItemValue { 838 return &MetricDescriptor_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 839 } 840 841 func (fps *MetricDescriptor_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 842 return fps.WithIArrayItemValue(value) 843 } 844 845 // MetricDescriptor_FieldPathValue allows storing values for MetricDescriptor fields according to their type 846 type MetricDescriptor_FieldPathValue interface { 847 MetricDescriptor_FieldPath 848 gotenobject.FieldPathValue 849 SetTo(target **MetricDescriptor) 850 CompareWith(*MetricDescriptor) (cmp int, comparable bool) 851 } 852 853 func ParseMetricDescriptor_FieldPathValue(pathStr, valueStr string) (MetricDescriptor_FieldPathValue, error) { 854 fp, err := ParseMetricDescriptor_FieldPath(pathStr) 855 if err != nil { 856 return nil, err 857 } 858 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 859 if err != nil { 860 return nil, status.Errorf(codes.InvalidArgument, "error parsing MetricDescriptor field path value from %s: %v", valueStr, err) 861 } 862 return fpv.(MetricDescriptor_FieldPathValue), nil 863 } 864 865 func MustParseMetricDescriptor_FieldPathValue(pathStr, valueStr string) MetricDescriptor_FieldPathValue { 866 fpv, err := ParseMetricDescriptor_FieldPathValue(pathStr, valueStr) 867 if err != nil { 868 panic(err) 869 } 870 return fpv 871 } 872 873 type MetricDescriptor_FieldTerminalPathValue struct { 874 MetricDescriptor_FieldTerminalPath 875 value interface{} 876 } 877 878 var _ MetricDescriptor_FieldPathValue = (*MetricDescriptor_FieldTerminalPathValue)(nil) 879 880 // GetRawValue returns raw value stored under selected path for 'MetricDescriptor' as interface{} 881 func (fpv *MetricDescriptor_FieldTerminalPathValue) GetRawValue() interface{} { 882 return fpv.value 883 } 884 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsNameValue() (*Name, bool) { 885 res, ok := fpv.value.(*Name) 886 return res, ok 887 } 888 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsMetadataValue() (*meta.Meta, bool) { 889 res, ok := fpv.value.(*meta.Meta) 890 return res, ok 891 } 892 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsTypeValue() (string, bool) { 893 res, ok := fpv.value.(string) 894 return res, ok 895 } 896 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsResourceTypesValue() ([]string, bool) { 897 res, ok := fpv.value.([]string) 898 return res, ok 899 } 900 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsLabelsValue() ([]*common.LabelDescriptor, bool) { 901 res, ok := fpv.value.([]*common.LabelDescriptor) 902 return res, ok 903 } 904 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsMetricKindValue() (MetricDescriptor_MetricKind, bool) { 905 res, ok := fpv.value.(MetricDescriptor_MetricKind) 906 return res, ok 907 } 908 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsValueTypeValue() (MetricDescriptor_ValueType, bool) { 909 res, ok := fpv.value.(MetricDescriptor_ValueType) 910 return res, ok 911 } 912 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsUnitValue() (string, bool) { 913 res, ok := fpv.value.(string) 914 return res, ok 915 } 916 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsDescriptionValue() (string, bool) { 917 res, ok := fpv.value.(string) 918 return res, ok 919 } 920 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsDisplayNameValue() (string, bool) { 921 res, ok := fpv.value.(string) 922 return res, ok 923 } 924 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsMetricDescriptorMetadataValue() (*MetricDescriptor_MetricDescriptorMetadata, bool) { 925 res, ok := fpv.value.(*MetricDescriptor_MetricDescriptorMetadata) 926 return res, ok 927 } 928 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsDistributionBucketOptionsValue() (*common.Distribution_BucketOptions, bool) { 929 res, ok := fpv.value.(*common.Distribution_BucketOptions) 930 return res, ok 931 } 932 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsPromotedLabelKeySetsValue() ([]*common.LabelKeySet, bool) { 933 res, ok := fpv.value.([]*common.LabelKeySet) 934 return res, ok 935 } 936 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsIndexSpecValue() (*MetricDescriptor_IndexSpec, bool) { 937 res, ok := fpv.value.(*MetricDescriptor_IndexSpec) 938 return res, ok 939 } 940 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsIndicesValue() (*MetricDescriptor_Indices, bool) { 941 res, ok := fpv.value.(*MetricDescriptor_Indices) 942 return res, ok 943 } 944 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsStorageConfigValue() (*MetricDescriptor_StorageConfig, bool) { 945 res, ok := fpv.value.(*MetricDescriptor_StorageConfig) 946 return res, ok 947 } 948 func (fpv *MetricDescriptor_FieldTerminalPathValue) AsBinaryIndicesValue() (*MetricDescriptor_BinaryIndices, bool) { 949 res, ok := fpv.value.(*MetricDescriptor_BinaryIndices) 950 return res, ok 951 } 952 953 // SetTo stores value for selected field for object MetricDescriptor 954 func (fpv *MetricDescriptor_FieldTerminalPathValue) SetTo(target **MetricDescriptor) { 955 if *target == nil { 956 *target = new(MetricDescriptor) 957 } 958 switch fpv.selector { 959 case MetricDescriptor_FieldPathSelectorName: 960 (*target).Name = fpv.value.(*Name) 961 case MetricDescriptor_FieldPathSelectorMetadata: 962 (*target).Metadata = fpv.value.(*meta.Meta) 963 case MetricDescriptor_FieldPathSelectorType: 964 (*target).Type = fpv.value.(string) 965 case MetricDescriptor_FieldPathSelectorResourceTypes: 966 (*target).ResourceTypes = fpv.value.([]string) 967 case MetricDescriptor_FieldPathSelectorLabels: 968 (*target).Labels = fpv.value.([]*common.LabelDescriptor) 969 case MetricDescriptor_FieldPathSelectorMetricKind: 970 (*target).MetricKind = fpv.value.(MetricDescriptor_MetricKind) 971 case MetricDescriptor_FieldPathSelectorValueType: 972 (*target).ValueType = fpv.value.(MetricDescriptor_ValueType) 973 case MetricDescriptor_FieldPathSelectorUnit: 974 (*target).Unit = fpv.value.(string) 975 case MetricDescriptor_FieldPathSelectorDescription: 976 (*target).Description = fpv.value.(string) 977 case MetricDescriptor_FieldPathSelectorDisplayName: 978 (*target).DisplayName = fpv.value.(string) 979 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 980 (*target).MetricDescriptorMetadata = fpv.value.(*MetricDescriptor_MetricDescriptorMetadata) 981 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 982 (*target).DistributionBucketOptions = fpv.value.(*common.Distribution_BucketOptions) 983 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 984 (*target).PromotedLabelKeySets = fpv.value.([]*common.LabelKeySet) 985 case MetricDescriptor_FieldPathSelectorIndexSpec: 986 (*target).IndexSpec = fpv.value.(*MetricDescriptor_IndexSpec) 987 case MetricDescriptor_FieldPathSelectorIndices: 988 (*target).Indices = fpv.value.(*MetricDescriptor_Indices) 989 case MetricDescriptor_FieldPathSelectorStorageConfig: 990 (*target).StorageConfig = fpv.value.(*MetricDescriptor_StorageConfig) 991 case MetricDescriptor_FieldPathSelectorBinaryIndices: 992 (*target).BinaryIndices = fpv.value.(*MetricDescriptor_BinaryIndices) 993 default: 994 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fpv.selector)) 995 } 996 } 997 998 func (fpv *MetricDescriptor_FieldTerminalPathValue) SetToRaw(target proto.Message) { 999 typedObject := target.(*MetricDescriptor) 1000 fpv.SetTo(&typedObject) 1001 } 1002 1003 // CompareWith compares value in the 'MetricDescriptor_FieldTerminalPathValue' with the value under path in 'MetricDescriptor'. 1004 func (fpv *MetricDescriptor_FieldTerminalPathValue) CompareWith(source *MetricDescriptor) (int, bool) { 1005 switch fpv.selector { 1006 case MetricDescriptor_FieldPathSelectorName: 1007 leftValue := fpv.value.(*Name) 1008 rightValue := source.GetName() 1009 if leftValue == nil { 1010 if rightValue != nil { 1011 return -1, true 1012 } 1013 return 0, true 1014 } 1015 if rightValue == nil { 1016 return 1, true 1017 } 1018 if leftValue.String() == rightValue.String() { 1019 return 0, true 1020 } else if leftValue.String() < rightValue.String() { 1021 return -1, true 1022 } else { 1023 return 1, true 1024 } 1025 case MetricDescriptor_FieldPathSelectorMetadata: 1026 return 0, false 1027 case MetricDescriptor_FieldPathSelectorType: 1028 leftValue := fpv.value.(string) 1029 rightValue := source.GetType() 1030 if (leftValue) == (rightValue) { 1031 return 0, true 1032 } else if (leftValue) < (rightValue) { 1033 return -1, true 1034 } else { 1035 return 1, true 1036 } 1037 case MetricDescriptor_FieldPathSelectorResourceTypes: 1038 return 0, false 1039 case MetricDescriptor_FieldPathSelectorLabels: 1040 return 0, false 1041 case MetricDescriptor_FieldPathSelectorMetricKind: 1042 leftValue := fpv.value.(MetricDescriptor_MetricKind) 1043 rightValue := source.GetMetricKind() 1044 if (leftValue) == (rightValue) { 1045 return 0, true 1046 } else if (leftValue) < (rightValue) { 1047 return -1, true 1048 } else { 1049 return 1, true 1050 } 1051 case MetricDescriptor_FieldPathSelectorValueType: 1052 leftValue := fpv.value.(MetricDescriptor_ValueType) 1053 rightValue := source.GetValueType() 1054 if (leftValue) == (rightValue) { 1055 return 0, true 1056 } else if (leftValue) < (rightValue) { 1057 return -1, true 1058 } else { 1059 return 1, true 1060 } 1061 case MetricDescriptor_FieldPathSelectorUnit: 1062 leftValue := fpv.value.(string) 1063 rightValue := source.GetUnit() 1064 if (leftValue) == (rightValue) { 1065 return 0, true 1066 } else if (leftValue) < (rightValue) { 1067 return -1, true 1068 } else { 1069 return 1, true 1070 } 1071 case MetricDescriptor_FieldPathSelectorDescription: 1072 leftValue := fpv.value.(string) 1073 rightValue := source.GetDescription() 1074 if (leftValue) == (rightValue) { 1075 return 0, true 1076 } else if (leftValue) < (rightValue) { 1077 return -1, true 1078 } else { 1079 return 1, true 1080 } 1081 case MetricDescriptor_FieldPathSelectorDisplayName: 1082 leftValue := fpv.value.(string) 1083 rightValue := source.GetDisplayName() 1084 if (leftValue) == (rightValue) { 1085 return 0, true 1086 } else if (leftValue) < (rightValue) { 1087 return -1, true 1088 } else { 1089 return 1, true 1090 } 1091 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 1092 return 0, false 1093 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 1094 return 0, false 1095 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 1096 return 0, false 1097 case MetricDescriptor_FieldPathSelectorIndexSpec: 1098 return 0, false 1099 case MetricDescriptor_FieldPathSelectorIndices: 1100 return 0, false 1101 case MetricDescriptor_FieldPathSelectorStorageConfig: 1102 return 0, false 1103 case MetricDescriptor_FieldPathSelectorBinaryIndices: 1104 return 0, false 1105 default: 1106 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fpv.selector)) 1107 } 1108 } 1109 1110 func (fpv *MetricDescriptor_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1111 return fpv.CompareWith(source.(*MetricDescriptor)) 1112 } 1113 1114 type MetricDescriptor_FieldSubPathValue struct { 1115 MetricDescriptor_FieldPath 1116 subPathValue gotenobject.FieldPathValue 1117 } 1118 1119 var _ MetricDescriptor_FieldPathValue = (*MetricDescriptor_FieldSubPathValue)(nil) 1120 1121 func (fpvs *MetricDescriptor_FieldSubPathValue) AsMetadataPathValue() (meta.Meta_FieldPathValue, bool) { 1122 res, ok := fpvs.subPathValue.(meta.Meta_FieldPathValue) 1123 return res, ok 1124 } 1125 func (fpvs *MetricDescriptor_FieldSubPathValue) AsLabelsPathValue() (common.LabelDescriptor_FieldPathValue, bool) { 1126 res, ok := fpvs.subPathValue.(common.LabelDescriptor_FieldPathValue) 1127 return res, ok 1128 } 1129 func (fpvs *MetricDescriptor_FieldSubPathValue) AsMetricDescriptorMetadataPathValue() (MetricDescriptorMetricDescriptorMetadata_FieldPathValue, bool) { 1130 res, ok := fpvs.subPathValue.(MetricDescriptorMetricDescriptorMetadata_FieldPathValue) 1131 return res, ok 1132 } 1133 func (fpvs *MetricDescriptor_FieldSubPathValue) AsDistributionBucketOptionsPathValue() (common.DistributionBucketOptions_FieldPathValue, bool) { 1134 res, ok := fpvs.subPathValue.(common.DistributionBucketOptions_FieldPathValue) 1135 return res, ok 1136 } 1137 func (fpvs *MetricDescriptor_FieldSubPathValue) AsPromotedLabelKeySetsPathValue() (common.LabelKeySet_FieldPathValue, bool) { 1138 res, ok := fpvs.subPathValue.(common.LabelKeySet_FieldPathValue) 1139 return res, ok 1140 } 1141 func (fpvs *MetricDescriptor_FieldSubPathValue) AsIndexSpecPathValue() (MetricDescriptorIndexSpec_FieldPathValue, bool) { 1142 res, ok := fpvs.subPathValue.(MetricDescriptorIndexSpec_FieldPathValue) 1143 return res, ok 1144 } 1145 func (fpvs *MetricDescriptor_FieldSubPathValue) AsIndicesPathValue() (MetricDescriptorIndices_FieldPathValue, bool) { 1146 res, ok := fpvs.subPathValue.(MetricDescriptorIndices_FieldPathValue) 1147 return res, ok 1148 } 1149 func (fpvs *MetricDescriptor_FieldSubPathValue) AsStorageConfigPathValue() (MetricDescriptorStorageConfig_FieldPathValue, bool) { 1150 res, ok := fpvs.subPathValue.(MetricDescriptorStorageConfig_FieldPathValue) 1151 return res, ok 1152 } 1153 func (fpvs *MetricDescriptor_FieldSubPathValue) AsBinaryIndicesPathValue() (MetricDescriptorBinaryIndices_FieldPathValue, bool) { 1154 res, ok := fpvs.subPathValue.(MetricDescriptorBinaryIndices_FieldPathValue) 1155 return res, ok 1156 } 1157 1158 func (fpvs *MetricDescriptor_FieldSubPathValue) SetTo(target **MetricDescriptor) { 1159 if *target == nil { 1160 *target = new(MetricDescriptor) 1161 } 1162 switch fpvs.Selector() { 1163 case MetricDescriptor_FieldPathSelectorMetadata: 1164 fpvs.subPathValue.(meta.Meta_FieldPathValue).SetTo(&(*target).Metadata) 1165 case MetricDescriptor_FieldPathSelectorLabels: 1166 panic("FieldPath setter is unsupported for array subpaths") 1167 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 1168 fpvs.subPathValue.(MetricDescriptorMetricDescriptorMetadata_FieldPathValue).SetTo(&(*target).MetricDescriptorMetadata) 1169 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 1170 fpvs.subPathValue.(common.DistributionBucketOptions_FieldPathValue).SetTo(&(*target).DistributionBucketOptions) 1171 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 1172 panic("FieldPath setter is unsupported for array subpaths") 1173 case MetricDescriptor_FieldPathSelectorIndexSpec: 1174 fpvs.subPathValue.(MetricDescriptorIndexSpec_FieldPathValue).SetTo(&(*target).IndexSpec) 1175 case MetricDescriptor_FieldPathSelectorIndices: 1176 fpvs.subPathValue.(MetricDescriptorIndices_FieldPathValue).SetTo(&(*target).Indices) 1177 case MetricDescriptor_FieldPathSelectorStorageConfig: 1178 fpvs.subPathValue.(MetricDescriptorStorageConfig_FieldPathValue).SetTo(&(*target).StorageConfig) 1179 case MetricDescriptor_FieldPathSelectorBinaryIndices: 1180 fpvs.subPathValue.(MetricDescriptorBinaryIndices_FieldPathValue).SetTo(&(*target).BinaryIndices) 1181 default: 1182 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fpvs.Selector())) 1183 } 1184 } 1185 1186 func (fpvs *MetricDescriptor_FieldSubPathValue) SetToRaw(target proto.Message) { 1187 typedObject := target.(*MetricDescriptor) 1188 fpvs.SetTo(&typedObject) 1189 } 1190 1191 func (fpvs *MetricDescriptor_FieldSubPathValue) GetRawValue() interface{} { 1192 return fpvs.subPathValue.GetRawValue() 1193 } 1194 1195 func (fpvs *MetricDescriptor_FieldSubPathValue) CompareWith(source *MetricDescriptor) (int, bool) { 1196 switch fpvs.Selector() { 1197 case MetricDescriptor_FieldPathSelectorMetadata: 1198 return fpvs.subPathValue.(meta.Meta_FieldPathValue).CompareWith(source.GetMetadata()) 1199 case MetricDescriptor_FieldPathSelectorLabels: 1200 return 0, false // repeated field 1201 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 1202 return fpvs.subPathValue.(MetricDescriptorMetricDescriptorMetadata_FieldPathValue).CompareWith(source.GetMetricDescriptorMetadata()) 1203 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 1204 return fpvs.subPathValue.(common.DistributionBucketOptions_FieldPathValue).CompareWith(source.GetDistributionBucketOptions()) 1205 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 1206 return 0, false // repeated field 1207 case MetricDescriptor_FieldPathSelectorIndexSpec: 1208 return fpvs.subPathValue.(MetricDescriptorIndexSpec_FieldPathValue).CompareWith(source.GetIndexSpec()) 1209 case MetricDescriptor_FieldPathSelectorIndices: 1210 return fpvs.subPathValue.(MetricDescriptorIndices_FieldPathValue).CompareWith(source.GetIndices()) 1211 case MetricDescriptor_FieldPathSelectorStorageConfig: 1212 return fpvs.subPathValue.(MetricDescriptorStorageConfig_FieldPathValue).CompareWith(source.GetStorageConfig()) 1213 case MetricDescriptor_FieldPathSelectorBinaryIndices: 1214 return fpvs.subPathValue.(MetricDescriptorBinaryIndices_FieldPathValue).CompareWith(source.GetBinaryIndices()) 1215 default: 1216 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fpvs.Selector())) 1217 } 1218 } 1219 1220 func (fpvs *MetricDescriptor_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1221 return fpvs.CompareWith(source.(*MetricDescriptor)) 1222 } 1223 1224 // MetricDescriptor_FieldPathArrayItemValue allows storing single item in Path-specific values for MetricDescriptor according to their type 1225 // Present only for array (repeated) types. 1226 type MetricDescriptor_FieldPathArrayItemValue interface { 1227 gotenobject.FieldPathArrayItemValue 1228 MetricDescriptor_FieldPath 1229 ContainsValue(*MetricDescriptor) bool 1230 } 1231 1232 // ParseMetricDescriptor_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1233 func ParseMetricDescriptor_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptor_FieldPathArrayItemValue, error) { 1234 fp, err := ParseMetricDescriptor_FieldPath(pathStr) 1235 if err != nil { 1236 return nil, err 1237 } 1238 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1239 if err != nil { 1240 return nil, status.Errorf(codes.InvalidArgument, "error parsing MetricDescriptor field path array item value from %s: %v", valueStr, err) 1241 } 1242 return fpaiv.(MetricDescriptor_FieldPathArrayItemValue), nil 1243 } 1244 1245 func MustParseMetricDescriptor_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptor_FieldPathArrayItemValue { 1246 fpaiv, err := ParseMetricDescriptor_FieldPathArrayItemValue(pathStr, valueStr) 1247 if err != nil { 1248 panic(err) 1249 } 1250 return fpaiv 1251 } 1252 1253 type MetricDescriptor_FieldTerminalPathArrayItemValue struct { 1254 MetricDescriptor_FieldTerminalPath 1255 value interface{} 1256 } 1257 1258 var _ MetricDescriptor_FieldPathArrayItemValue = (*MetricDescriptor_FieldTerminalPathArrayItemValue)(nil) 1259 1260 // GetRawValue returns stored element value for array in object MetricDescriptor as interface{} 1261 func (fpaiv *MetricDescriptor_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1262 return fpaiv.value 1263 } 1264 func (fpaiv *MetricDescriptor_FieldTerminalPathArrayItemValue) AsResourceTypesItemValue() (string, bool) { 1265 res, ok := fpaiv.value.(string) 1266 return res, ok 1267 } 1268 func (fpaiv *MetricDescriptor_FieldTerminalPathArrayItemValue) AsLabelsItemValue() (*common.LabelDescriptor, bool) { 1269 res, ok := fpaiv.value.(*common.LabelDescriptor) 1270 return res, ok 1271 } 1272 func (fpaiv *MetricDescriptor_FieldTerminalPathArrayItemValue) AsPromotedLabelKeySetsItemValue() (*common.LabelKeySet, bool) { 1273 res, ok := fpaiv.value.(*common.LabelKeySet) 1274 return res, ok 1275 } 1276 1277 func (fpaiv *MetricDescriptor_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor) (interface{}, bool) { 1278 return nil, false 1279 } 1280 1281 func (fpaiv *MetricDescriptor_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1282 return fpaiv.GetSingle(source.(*MetricDescriptor)) 1283 } 1284 1285 // Contains returns a boolean indicating if value that is being held is present in given 'MetricDescriptor' 1286 func (fpaiv *MetricDescriptor_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor) bool { 1287 slice := fpaiv.MetricDescriptor_FieldTerminalPath.Get(source) 1288 for _, v := range slice { 1289 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1290 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1291 return true 1292 } 1293 } else if reflect.DeepEqual(v, fpaiv.value) { 1294 return true 1295 } 1296 } 1297 return false 1298 } 1299 1300 type MetricDescriptor_FieldSubPathArrayItemValue struct { 1301 MetricDescriptor_FieldPath 1302 subPathItemValue gotenobject.FieldPathArrayItemValue 1303 } 1304 1305 // GetRawValue returns stored array item value 1306 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 1307 return fpaivs.subPathItemValue.GetRawItemValue() 1308 } 1309 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) AsMetadataPathItemValue() (meta.Meta_FieldPathArrayItemValue, bool) { 1310 res, ok := fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue) 1311 return res, ok 1312 } 1313 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) AsLabelsPathItemValue() (common.LabelDescriptor_FieldPathArrayItemValue, bool) { 1314 res, ok := fpaivs.subPathItemValue.(common.LabelDescriptor_FieldPathArrayItemValue) 1315 return res, ok 1316 } 1317 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) AsMetricDescriptorMetadataPathItemValue() (MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue, bool) { 1318 res, ok := fpaivs.subPathItemValue.(MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue) 1319 return res, ok 1320 } 1321 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) AsDistributionBucketOptionsPathItemValue() (common.DistributionBucketOptions_FieldPathArrayItemValue, bool) { 1322 res, ok := fpaivs.subPathItemValue.(common.DistributionBucketOptions_FieldPathArrayItemValue) 1323 return res, ok 1324 } 1325 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) AsPromotedLabelKeySetsPathItemValue() (common.LabelKeySet_FieldPathArrayItemValue, bool) { 1326 res, ok := fpaivs.subPathItemValue.(common.LabelKeySet_FieldPathArrayItemValue) 1327 return res, ok 1328 } 1329 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) AsIndexSpecPathItemValue() (MetricDescriptorIndexSpec_FieldPathArrayItemValue, bool) { 1330 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndexSpec_FieldPathArrayItemValue) 1331 return res, ok 1332 } 1333 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) AsIndicesPathItemValue() (MetricDescriptorIndices_FieldPathArrayItemValue, bool) { 1334 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndices_FieldPathArrayItemValue) 1335 return res, ok 1336 } 1337 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) AsStorageConfigPathItemValue() (MetricDescriptorStorageConfig_FieldPathArrayItemValue, bool) { 1338 res, ok := fpaivs.subPathItemValue.(MetricDescriptorStorageConfig_FieldPathArrayItemValue) 1339 return res, ok 1340 } 1341 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) AsBinaryIndicesPathItemValue() (MetricDescriptorBinaryIndices_FieldPathArrayItemValue, bool) { 1342 res, ok := fpaivs.subPathItemValue.(MetricDescriptorBinaryIndices_FieldPathArrayItemValue) 1343 return res, ok 1344 } 1345 1346 // Contains returns a boolean indicating if value that is being held is present in given 'MetricDescriptor' 1347 func (fpaivs *MetricDescriptor_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor) bool { 1348 switch fpaivs.Selector() { 1349 case MetricDescriptor_FieldPathSelectorMetadata: 1350 return fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue).ContainsValue(source.GetMetadata()) 1351 case MetricDescriptor_FieldPathSelectorLabels: 1352 return false // repeated/map field 1353 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 1354 return fpaivs.subPathItemValue.(MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue).ContainsValue(source.GetMetricDescriptorMetadata()) 1355 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 1356 return fpaivs.subPathItemValue.(common.DistributionBucketOptions_FieldPathArrayItemValue).ContainsValue(source.GetDistributionBucketOptions()) 1357 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 1358 return false // repeated/map field 1359 case MetricDescriptor_FieldPathSelectorIndexSpec: 1360 return fpaivs.subPathItemValue.(MetricDescriptorIndexSpec_FieldPathArrayItemValue).ContainsValue(source.GetIndexSpec()) 1361 case MetricDescriptor_FieldPathSelectorIndices: 1362 return fpaivs.subPathItemValue.(MetricDescriptorIndices_FieldPathArrayItemValue).ContainsValue(source.GetIndices()) 1363 case MetricDescriptor_FieldPathSelectorStorageConfig: 1364 return fpaivs.subPathItemValue.(MetricDescriptorStorageConfig_FieldPathArrayItemValue).ContainsValue(source.GetStorageConfig()) 1365 case MetricDescriptor_FieldPathSelectorBinaryIndices: 1366 return fpaivs.subPathItemValue.(MetricDescriptorBinaryIndices_FieldPathArrayItemValue).ContainsValue(source.GetBinaryIndices()) 1367 default: 1368 panic(fmt.Sprintf("Invalid selector for MetricDescriptor: %d", fpaivs.Selector())) 1369 } 1370 } 1371 1372 // MetricDescriptor_FieldPathArrayOfValues allows storing slice of values for MetricDescriptor fields according to their type 1373 type MetricDescriptor_FieldPathArrayOfValues interface { 1374 gotenobject.FieldPathArrayOfValues 1375 MetricDescriptor_FieldPath 1376 } 1377 1378 func ParseMetricDescriptor_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptor_FieldPathArrayOfValues, error) { 1379 fp, err := ParseMetricDescriptor_FieldPath(pathStr) 1380 if err != nil { 1381 return nil, err 1382 } 1383 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1384 if err != nil { 1385 return nil, status.Errorf(codes.InvalidArgument, "error parsing MetricDescriptor field path array of values from %s: %v", valuesStr, err) 1386 } 1387 return fpaov.(MetricDescriptor_FieldPathArrayOfValues), nil 1388 } 1389 1390 func MustParseMetricDescriptor_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptor_FieldPathArrayOfValues { 1391 fpaov, err := ParseMetricDescriptor_FieldPathArrayOfValues(pathStr, valuesStr) 1392 if err != nil { 1393 panic(err) 1394 } 1395 return fpaov 1396 } 1397 1398 type MetricDescriptor_FieldTerminalPathArrayOfValues struct { 1399 MetricDescriptor_FieldTerminalPath 1400 values interface{} 1401 } 1402 1403 var _ MetricDescriptor_FieldPathArrayOfValues = (*MetricDescriptor_FieldTerminalPathArrayOfValues)(nil) 1404 1405 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1406 switch fpaov.selector { 1407 case MetricDescriptor_FieldPathSelectorName: 1408 for _, v := range fpaov.values.([]*Name) { 1409 values = append(values, v) 1410 } 1411 case MetricDescriptor_FieldPathSelectorMetadata: 1412 for _, v := range fpaov.values.([]*meta.Meta) { 1413 values = append(values, v) 1414 } 1415 case MetricDescriptor_FieldPathSelectorType: 1416 for _, v := range fpaov.values.([]string) { 1417 values = append(values, v) 1418 } 1419 case MetricDescriptor_FieldPathSelectorResourceTypes: 1420 for _, v := range fpaov.values.([][]string) { 1421 values = append(values, v) 1422 } 1423 case MetricDescriptor_FieldPathSelectorLabels: 1424 for _, v := range fpaov.values.([][]*common.LabelDescriptor) { 1425 values = append(values, v) 1426 } 1427 case MetricDescriptor_FieldPathSelectorMetricKind: 1428 for _, v := range fpaov.values.([]MetricDescriptor_MetricKind) { 1429 values = append(values, v) 1430 } 1431 case MetricDescriptor_FieldPathSelectorValueType: 1432 for _, v := range fpaov.values.([]MetricDescriptor_ValueType) { 1433 values = append(values, v) 1434 } 1435 case MetricDescriptor_FieldPathSelectorUnit: 1436 for _, v := range fpaov.values.([]string) { 1437 values = append(values, v) 1438 } 1439 case MetricDescriptor_FieldPathSelectorDescription: 1440 for _, v := range fpaov.values.([]string) { 1441 values = append(values, v) 1442 } 1443 case MetricDescriptor_FieldPathSelectorDisplayName: 1444 for _, v := range fpaov.values.([]string) { 1445 values = append(values, v) 1446 } 1447 case MetricDescriptor_FieldPathSelectorMetricDescriptorMetadata: 1448 for _, v := range fpaov.values.([]*MetricDescriptor_MetricDescriptorMetadata) { 1449 values = append(values, v) 1450 } 1451 case MetricDescriptor_FieldPathSelectorDistributionBucketOptions: 1452 for _, v := range fpaov.values.([]*common.Distribution_BucketOptions) { 1453 values = append(values, v) 1454 } 1455 case MetricDescriptor_FieldPathSelectorPromotedLabelKeySets: 1456 for _, v := range fpaov.values.([][]*common.LabelKeySet) { 1457 values = append(values, v) 1458 } 1459 case MetricDescriptor_FieldPathSelectorIndexSpec: 1460 for _, v := range fpaov.values.([]*MetricDescriptor_IndexSpec) { 1461 values = append(values, v) 1462 } 1463 case MetricDescriptor_FieldPathSelectorIndices: 1464 for _, v := range fpaov.values.([]*MetricDescriptor_Indices) { 1465 values = append(values, v) 1466 } 1467 case MetricDescriptor_FieldPathSelectorStorageConfig: 1468 for _, v := range fpaov.values.([]*MetricDescriptor_StorageConfig) { 1469 values = append(values, v) 1470 } 1471 case MetricDescriptor_FieldPathSelectorBinaryIndices: 1472 for _, v := range fpaov.values.([]*MetricDescriptor_BinaryIndices) { 1473 values = append(values, v) 1474 } 1475 } 1476 return 1477 } 1478 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) { 1479 res, ok := fpaov.values.([]*Name) 1480 return res, ok 1481 } 1482 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsMetadataArrayOfValues() ([]*meta.Meta, bool) { 1483 res, ok := fpaov.values.([]*meta.Meta) 1484 return res, ok 1485 } 1486 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsTypeArrayOfValues() ([]string, bool) { 1487 res, ok := fpaov.values.([]string) 1488 return res, ok 1489 } 1490 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsResourceTypesArrayOfValues() ([][]string, bool) { 1491 res, ok := fpaov.values.([][]string) 1492 return res, ok 1493 } 1494 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsLabelsArrayOfValues() ([][]*common.LabelDescriptor, bool) { 1495 res, ok := fpaov.values.([][]*common.LabelDescriptor) 1496 return res, ok 1497 } 1498 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsMetricKindArrayOfValues() ([]MetricDescriptor_MetricKind, bool) { 1499 res, ok := fpaov.values.([]MetricDescriptor_MetricKind) 1500 return res, ok 1501 } 1502 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsValueTypeArrayOfValues() ([]MetricDescriptor_ValueType, bool) { 1503 res, ok := fpaov.values.([]MetricDescriptor_ValueType) 1504 return res, ok 1505 } 1506 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsUnitArrayOfValues() ([]string, bool) { 1507 res, ok := fpaov.values.([]string) 1508 return res, ok 1509 } 1510 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsDescriptionArrayOfValues() ([]string, bool) { 1511 res, ok := fpaov.values.([]string) 1512 return res, ok 1513 } 1514 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsDisplayNameArrayOfValues() ([]string, bool) { 1515 res, ok := fpaov.values.([]string) 1516 return res, ok 1517 } 1518 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsMetricDescriptorMetadataArrayOfValues() ([]*MetricDescriptor_MetricDescriptorMetadata, bool) { 1519 res, ok := fpaov.values.([]*MetricDescriptor_MetricDescriptorMetadata) 1520 return res, ok 1521 } 1522 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsDistributionBucketOptionsArrayOfValues() ([]*common.Distribution_BucketOptions, bool) { 1523 res, ok := fpaov.values.([]*common.Distribution_BucketOptions) 1524 return res, ok 1525 } 1526 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsPromotedLabelKeySetsArrayOfValues() ([][]*common.LabelKeySet, bool) { 1527 res, ok := fpaov.values.([][]*common.LabelKeySet) 1528 return res, ok 1529 } 1530 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsIndexSpecArrayOfValues() ([]*MetricDescriptor_IndexSpec, bool) { 1531 res, ok := fpaov.values.([]*MetricDescriptor_IndexSpec) 1532 return res, ok 1533 } 1534 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsIndicesArrayOfValues() ([]*MetricDescriptor_Indices, bool) { 1535 res, ok := fpaov.values.([]*MetricDescriptor_Indices) 1536 return res, ok 1537 } 1538 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsStorageConfigArrayOfValues() ([]*MetricDescriptor_StorageConfig, bool) { 1539 res, ok := fpaov.values.([]*MetricDescriptor_StorageConfig) 1540 return res, ok 1541 } 1542 func (fpaov *MetricDescriptor_FieldTerminalPathArrayOfValues) AsBinaryIndicesArrayOfValues() ([]*MetricDescriptor_BinaryIndices, bool) { 1543 res, ok := fpaov.values.([]*MetricDescriptor_BinaryIndices) 1544 return res, ok 1545 } 1546 1547 type MetricDescriptor_FieldSubPathArrayOfValues struct { 1548 MetricDescriptor_FieldPath 1549 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 1550 } 1551 1552 var _ MetricDescriptor_FieldPathArrayOfValues = (*MetricDescriptor_FieldSubPathArrayOfValues)(nil) 1553 1554 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 1555 return fpsaov.subPathArrayOfValues.GetRawValues() 1556 } 1557 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) AsMetadataPathArrayOfValues() (meta.Meta_FieldPathArrayOfValues, bool) { 1558 res, ok := fpsaov.subPathArrayOfValues.(meta.Meta_FieldPathArrayOfValues) 1559 return res, ok 1560 } 1561 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) AsLabelsPathArrayOfValues() (common.LabelDescriptor_FieldPathArrayOfValues, bool) { 1562 res, ok := fpsaov.subPathArrayOfValues.(common.LabelDescriptor_FieldPathArrayOfValues) 1563 return res, ok 1564 } 1565 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) AsMetricDescriptorMetadataPathArrayOfValues() (MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues, bool) { 1566 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues) 1567 return res, ok 1568 } 1569 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) AsDistributionBucketOptionsPathArrayOfValues() (common.DistributionBucketOptions_FieldPathArrayOfValues, bool) { 1570 res, ok := fpsaov.subPathArrayOfValues.(common.DistributionBucketOptions_FieldPathArrayOfValues) 1571 return res, ok 1572 } 1573 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) AsPromotedLabelKeySetsPathArrayOfValues() (common.LabelKeySet_FieldPathArrayOfValues, bool) { 1574 res, ok := fpsaov.subPathArrayOfValues.(common.LabelKeySet_FieldPathArrayOfValues) 1575 return res, ok 1576 } 1577 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) AsIndexSpecPathArrayOfValues() (MetricDescriptorIndexSpec_FieldPathArrayOfValues, bool) { 1578 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndexSpec_FieldPathArrayOfValues) 1579 return res, ok 1580 } 1581 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) AsIndicesPathArrayOfValues() (MetricDescriptorIndices_FieldPathArrayOfValues, bool) { 1582 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndices_FieldPathArrayOfValues) 1583 return res, ok 1584 } 1585 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) AsStorageConfigPathArrayOfValues() (MetricDescriptorStorageConfig_FieldPathArrayOfValues, bool) { 1586 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorStorageConfig_FieldPathArrayOfValues) 1587 return res, ok 1588 } 1589 func (fpsaov *MetricDescriptor_FieldSubPathArrayOfValues) AsBinaryIndicesPathArrayOfValues() (MetricDescriptorBinaryIndices_FieldPathArrayOfValues, bool) { 1590 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorBinaryIndices_FieldPathArrayOfValues) 1591 return res, ok 1592 } 1593 1594 // FieldPath provides implementation to handle 1595 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1596 type MetricDescriptorMetricDescriptorMetadata_FieldPath interface { 1597 gotenobject.FieldPath 1598 Selector() MetricDescriptorMetricDescriptorMetadata_FieldPathSelector 1599 Get(source *MetricDescriptor_MetricDescriptorMetadata) []interface{} 1600 GetSingle(source *MetricDescriptor_MetricDescriptorMetadata) (interface{}, bool) 1601 ClearValue(item *MetricDescriptor_MetricDescriptorMetadata) 1602 1603 // Those methods build corresponding MetricDescriptorMetricDescriptorMetadata_FieldPathValue 1604 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1605 WithIValue(value interface{}) MetricDescriptorMetricDescriptorMetadata_FieldPathValue 1606 WithIArrayOfValues(values interface{}) MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues 1607 WithIArrayItemValue(value interface{}) MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue 1608 } 1609 1610 type MetricDescriptorMetricDescriptorMetadata_FieldPathSelector int32 1611 1612 const ( 1613 MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage MetricDescriptorMetricDescriptorMetadata_FieldPathSelector = 0 1614 ) 1615 1616 func (s MetricDescriptorMetricDescriptorMetadata_FieldPathSelector) String() string { 1617 switch s { 1618 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1619 return "launch_stage" 1620 default: 1621 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", s)) 1622 } 1623 } 1624 1625 func BuildMetricDescriptorMetricDescriptorMetadata_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorMetricDescriptorMetadata_FieldPath, error) { 1626 if len(fp) == 0 { 1627 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_MetricDescriptorMetadata") 1628 } 1629 if len(fp) == 1 { 1630 switch fp[0] { 1631 case "launch_stage", "launchStage", "launch-stage": 1632 return &MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath{selector: MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage}, nil 1633 } 1634 } 1635 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_MetricDescriptorMetadata", fp) 1636 } 1637 1638 func ParseMetricDescriptorMetricDescriptorMetadata_FieldPath(rawField string) (MetricDescriptorMetricDescriptorMetadata_FieldPath, error) { 1639 fp, err := gotenobject.ParseRawFieldPath(rawField) 1640 if err != nil { 1641 return nil, err 1642 } 1643 return BuildMetricDescriptorMetricDescriptorMetadata_FieldPath(fp) 1644 } 1645 1646 func MustParseMetricDescriptorMetricDescriptorMetadata_FieldPath(rawField string) MetricDescriptorMetricDescriptorMetadata_FieldPath { 1647 fp, err := ParseMetricDescriptorMetricDescriptorMetadata_FieldPath(rawField) 1648 if err != nil { 1649 panic(err) 1650 } 1651 return fp 1652 } 1653 1654 type MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath struct { 1655 selector MetricDescriptorMetricDescriptorMetadata_FieldPathSelector 1656 } 1657 1658 var _ MetricDescriptorMetricDescriptorMetadata_FieldPath = (*MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath)(nil) 1659 1660 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) Selector() MetricDescriptorMetricDescriptorMetadata_FieldPathSelector { 1661 return fp.selector 1662 } 1663 1664 // String returns path representation in proto convention 1665 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) String() string { 1666 return fp.selector.String() 1667 } 1668 1669 // JSONString returns path representation is JSON convention 1670 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) JSONString() string { 1671 return strcase.ToLowerCamel(fp.String()) 1672 } 1673 1674 // Get returns all values pointed by specific field from source MetricDescriptor_MetricDescriptorMetadata 1675 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) Get(source *MetricDescriptor_MetricDescriptorMetadata) (values []interface{}) { 1676 if source != nil { 1677 switch fp.selector { 1678 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1679 values = append(values, source.LaunchStage) 1680 default: 1681 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", fp.selector)) 1682 } 1683 } 1684 return 1685 } 1686 1687 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1688 return fp.Get(source.(*MetricDescriptor_MetricDescriptorMetadata)) 1689 } 1690 1691 // GetSingle returns value pointed by specific field of from source MetricDescriptor_MetricDescriptorMetadata 1692 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) GetSingle(source *MetricDescriptor_MetricDescriptorMetadata) (interface{}, bool) { 1693 switch fp.selector { 1694 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1695 return source.GetLaunchStage(), source != nil 1696 default: 1697 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", fp.selector)) 1698 } 1699 } 1700 1701 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1702 return fp.GetSingle(source.(*MetricDescriptor_MetricDescriptorMetadata)) 1703 } 1704 1705 // GetDefault returns a default value of the field type 1706 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) GetDefault() interface{} { 1707 switch fp.selector { 1708 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1709 return api.LaunchStage_LAUNCH_STAGE_UNSPECIFIED 1710 default: 1711 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", fp.selector)) 1712 } 1713 } 1714 1715 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) ClearValue(item *MetricDescriptor_MetricDescriptorMetadata) { 1716 if item != nil { 1717 switch fp.selector { 1718 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1719 item.LaunchStage = api.LaunchStage_LAUNCH_STAGE_UNSPECIFIED 1720 default: 1721 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", fp.selector)) 1722 } 1723 } 1724 } 1725 1726 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1727 fp.ClearValue(item.(*MetricDescriptor_MetricDescriptorMetadata)) 1728 } 1729 1730 // IsLeaf - whether field path is holds simple value 1731 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) IsLeaf() bool { 1732 return fp.selector == MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage 1733 } 1734 1735 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1736 return []gotenobject.FieldPath{fp} 1737 } 1738 1739 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorMetricDescriptorMetadata_FieldPathValue { 1740 switch fp.selector { 1741 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1742 return &MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue{MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath: *fp, value: value.(api.LaunchStage)} 1743 default: 1744 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", fp.selector)) 1745 } 1746 } 1747 1748 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1749 return fp.WithIValue(value) 1750 } 1751 1752 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues { 1753 fpaov := &MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayOfValues{MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath: *fp} 1754 switch fp.selector { 1755 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1756 return &MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayOfValues{MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath: *fp, values: values.([]api.LaunchStage)} 1757 default: 1758 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", fp.selector)) 1759 } 1760 return fpaov 1761 } 1762 1763 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1764 return fp.WithIArrayOfValues(values) 1765 } 1766 1767 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue { 1768 switch fp.selector { 1769 default: 1770 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", fp.selector)) 1771 } 1772 } 1773 1774 func (fp *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1775 return fp.WithIArrayItemValue(value) 1776 } 1777 1778 // MetricDescriptorMetricDescriptorMetadata_FieldPathValue allows storing values for MetricDescriptorMetadata fields according to their type 1779 type MetricDescriptorMetricDescriptorMetadata_FieldPathValue interface { 1780 MetricDescriptorMetricDescriptorMetadata_FieldPath 1781 gotenobject.FieldPathValue 1782 SetTo(target **MetricDescriptor_MetricDescriptorMetadata) 1783 CompareWith(*MetricDescriptor_MetricDescriptorMetadata) (cmp int, comparable bool) 1784 } 1785 1786 func ParseMetricDescriptorMetricDescriptorMetadata_FieldPathValue(pathStr, valueStr string) (MetricDescriptorMetricDescriptorMetadata_FieldPathValue, error) { 1787 fp, err := ParseMetricDescriptorMetricDescriptorMetadata_FieldPath(pathStr) 1788 if err != nil { 1789 return nil, err 1790 } 1791 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1792 if err != nil { 1793 return nil, status.Errorf(codes.InvalidArgument, "error parsing MetricDescriptorMetadata field path value from %s: %v", valueStr, err) 1794 } 1795 return fpv.(MetricDescriptorMetricDescriptorMetadata_FieldPathValue), nil 1796 } 1797 1798 func MustParseMetricDescriptorMetricDescriptorMetadata_FieldPathValue(pathStr, valueStr string) MetricDescriptorMetricDescriptorMetadata_FieldPathValue { 1799 fpv, err := ParseMetricDescriptorMetricDescriptorMetadata_FieldPathValue(pathStr, valueStr) 1800 if err != nil { 1801 panic(err) 1802 } 1803 return fpv 1804 } 1805 1806 type MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue struct { 1807 MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath 1808 value interface{} 1809 } 1810 1811 var _ MetricDescriptorMetricDescriptorMetadata_FieldPathValue = (*MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue)(nil) 1812 1813 // GetRawValue returns raw value stored under selected path for 'MetricDescriptorMetadata' as interface{} 1814 func (fpv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue) GetRawValue() interface{} { 1815 return fpv.value 1816 } 1817 func (fpv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue) AsLaunchStageValue() (api.LaunchStage, bool) { 1818 res, ok := fpv.value.(api.LaunchStage) 1819 return res, ok 1820 } 1821 1822 // SetTo stores value for selected field for object MetricDescriptorMetadata 1823 func (fpv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue) SetTo(target **MetricDescriptor_MetricDescriptorMetadata) { 1824 if *target == nil { 1825 *target = new(MetricDescriptor_MetricDescriptorMetadata) 1826 } 1827 switch fpv.selector { 1828 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1829 (*target).LaunchStage = fpv.value.(api.LaunchStage) 1830 default: 1831 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", fpv.selector)) 1832 } 1833 } 1834 1835 func (fpv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1836 typedObject := target.(*MetricDescriptor_MetricDescriptorMetadata) 1837 fpv.SetTo(&typedObject) 1838 } 1839 1840 // CompareWith compares value in the 'MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_MetricDescriptorMetadata'. 1841 func (fpv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_MetricDescriptorMetadata) (int, bool) { 1842 switch fpv.selector { 1843 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1844 leftValue := fpv.value.(api.LaunchStage) 1845 rightValue := source.GetLaunchStage() 1846 if (leftValue) == (rightValue) { 1847 return 0, true 1848 } else if (leftValue) < (rightValue) { 1849 return -1, true 1850 } else { 1851 return 1, true 1852 } 1853 default: 1854 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_MetricDescriptorMetadata: %d", fpv.selector)) 1855 } 1856 } 1857 1858 func (fpv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1859 return fpv.CompareWith(source.(*MetricDescriptor_MetricDescriptorMetadata)) 1860 } 1861 1862 // MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue allows storing single item in Path-specific values for MetricDescriptorMetadata according to their type 1863 // Present only for array (repeated) types. 1864 type MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue interface { 1865 gotenobject.FieldPathArrayItemValue 1866 MetricDescriptorMetricDescriptorMetadata_FieldPath 1867 ContainsValue(*MetricDescriptor_MetricDescriptorMetadata) bool 1868 } 1869 1870 // ParseMetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1871 func ParseMetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue, error) { 1872 fp, err := ParseMetricDescriptorMetricDescriptorMetadata_FieldPath(pathStr) 1873 if err != nil { 1874 return nil, err 1875 } 1876 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1877 if err != nil { 1878 return nil, status.Errorf(codes.InvalidArgument, "error parsing MetricDescriptorMetadata field path array item value from %s: %v", valueStr, err) 1879 } 1880 return fpaiv.(MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue), nil 1881 } 1882 1883 func MustParseMetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue { 1884 fpaiv, err := ParseMetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue(pathStr, valueStr) 1885 if err != nil { 1886 panic(err) 1887 } 1888 return fpaiv 1889 } 1890 1891 type MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayItemValue struct { 1892 MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath 1893 value interface{} 1894 } 1895 1896 var _ MetricDescriptorMetricDescriptorMetadata_FieldPathArrayItemValue = (*MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayItemValue)(nil) 1897 1898 // GetRawValue returns stored element value for array in object MetricDescriptor_MetricDescriptorMetadata as interface{} 1899 func (fpaiv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1900 return fpaiv.value 1901 } 1902 1903 func (fpaiv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_MetricDescriptorMetadata) (interface{}, bool) { 1904 return nil, false 1905 } 1906 1907 func (fpaiv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1908 return fpaiv.GetSingle(source.(*MetricDescriptor_MetricDescriptorMetadata)) 1909 } 1910 1911 // Contains returns a boolean indicating if value that is being held is present in given 'MetricDescriptorMetadata' 1912 func (fpaiv *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_MetricDescriptorMetadata) bool { 1913 slice := fpaiv.MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath.Get(source) 1914 for _, v := range slice { 1915 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1916 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1917 return true 1918 } 1919 } else if reflect.DeepEqual(v, fpaiv.value) { 1920 return true 1921 } 1922 } 1923 return false 1924 } 1925 1926 // MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues allows storing slice of values for MetricDescriptorMetadata fields according to their type 1927 type MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues interface { 1928 gotenobject.FieldPathArrayOfValues 1929 MetricDescriptorMetricDescriptorMetadata_FieldPath 1930 } 1931 1932 func ParseMetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues, error) { 1933 fp, err := ParseMetricDescriptorMetricDescriptorMetadata_FieldPath(pathStr) 1934 if err != nil { 1935 return nil, err 1936 } 1937 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1938 if err != nil { 1939 return nil, status.Errorf(codes.InvalidArgument, "error parsing MetricDescriptorMetadata field path array of values from %s: %v", valuesStr, err) 1940 } 1941 return fpaov.(MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues), nil 1942 } 1943 1944 func MustParseMetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues { 1945 fpaov, err := ParseMetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues(pathStr, valuesStr) 1946 if err != nil { 1947 panic(err) 1948 } 1949 return fpaov 1950 } 1951 1952 type MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayOfValues struct { 1953 MetricDescriptorMetricDescriptorMetadata_FieldTerminalPath 1954 values interface{} 1955 } 1956 1957 var _ MetricDescriptorMetricDescriptorMetadata_FieldPathArrayOfValues = (*MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayOfValues)(nil) 1958 1959 func (fpaov *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1960 switch fpaov.selector { 1961 case MetricDescriptorMetricDescriptorMetadata_FieldPathSelectorLaunchStage: 1962 for _, v := range fpaov.values.([]api.LaunchStage) { 1963 values = append(values, v) 1964 } 1965 } 1966 return 1967 } 1968 func (fpaov *MetricDescriptorMetricDescriptorMetadata_FieldTerminalPathArrayOfValues) AsLaunchStageArrayOfValues() ([]api.LaunchStage, bool) { 1969 res, ok := fpaov.values.([]api.LaunchStage) 1970 return res, ok 1971 } 1972 1973 // FieldPath provides implementation to handle 1974 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1975 type MetricDescriptorIndexSpec_FieldPath interface { 1976 gotenobject.FieldPath 1977 Selector() MetricDescriptorIndexSpec_FieldPathSelector 1978 Get(source *MetricDescriptor_IndexSpec) []interface{} 1979 GetSingle(source *MetricDescriptor_IndexSpec) (interface{}, bool) 1980 ClearValue(item *MetricDescriptor_IndexSpec) 1981 1982 // Those methods build corresponding MetricDescriptorIndexSpec_FieldPathValue 1983 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1984 WithIValue(value interface{}) MetricDescriptorIndexSpec_FieldPathValue 1985 WithIArrayOfValues(values interface{}) MetricDescriptorIndexSpec_FieldPathArrayOfValues 1986 WithIArrayItemValue(value interface{}) MetricDescriptorIndexSpec_FieldPathArrayItemValue 1987 } 1988 1989 type MetricDescriptorIndexSpec_FieldPathSelector int32 1990 1991 const ( 1992 MetricDescriptorIndexSpec_FieldPathSelectorPerResource MetricDescriptorIndexSpec_FieldPathSelector = 0 1993 ) 1994 1995 func (s MetricDescriptorIndexSpec_FieldPathSelector) String() string { 1996 switch s { 1997 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 1998 return "per_resource" 1999 default: 2000 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", s)) 2001 } 2002 } 2003 2004 func BuildMetricDescriptorIndexSpec_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndexSpec_FieldPath, error) { 2005 if len(fp) == 0 { 2006 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_IndexSpec") 2007 } 2008 if len(fp) == 1 { 2009 switch fp[0] { 2010 case "per_resource", "perResource", "per-resource": 2011 return &MetricDescriptorIndexSpec_FieldTerminalPath{selector: MetricDescriptorIndexSpec_FieldPathSelectorPerResource}, nil 2012 } 2013 } else { 2014 switch fp[0] { 2015 case "per_resource", "perResource", "per-resource": 2016 if subpath, err := BuildMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(fp[1:]); err != nil { 2017 return nil, err 2018 } else { 2019 return &MetricDescriptorIndexSpec_FieldSubPath{selector: MetricDescriptorIndexSpec_FieldPathSelectorPerResource, subPath: subpath}, nil 2020 } 2021 } 2022 } 2023 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_IndexSpec", fp) 2024 } 2025 2026 func ParseMetricDescriptorIndexSpec_FieldPath(rawField string) (MetricDescriptorIndexSpec_FieldPath, error) { 2027 fp, err := gotenobject.ParseRawFieldPath(rawField) 2028 if err != nil { 2029 return nil, err 2030 } 2031 return BuildMetricDescriptorIndexSpec_FieldPath(fp) 2032 } 2033 2034 func MustParseMetricDescriptorIndexSpec_FieldPath(rawField string) MetricDescriptorIndexSpec_FieldPath { 2035 fp, err := ParseMetricDescriptorIndexSpec_FieldPath(rawField) 2036 if err != nil { 2037 panic(err) 2038 } 2039 return fp 2040 } 2041 2042 type MetricDescriptorIndexSpec_FieldTerminalPath struct { 2043 selector MetricDescriptorIndexSpec_FieldPathSelector 2044 } 2045 2046 var _ MetricDescriptorIndexSpec_FieldPath = (*MetricDescriptorIndexSpec_FieldTerminalPath)(nil) 2047 2048 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) Selector() MetricDescriptorIndexSpec_FieldPathSelector { 2049 return fp.selector 2050 } 2051 2052 // String returns path representation in proto convention 2053 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) String() string { 2054 return fp.selector.String() 2055 } 2056 2057 // JSONString returns path representation is JSON convention 2058 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) JSONString() string { 2059 return strcase.ToLowerCamel(fp.String()) 2060 } 2061 2062 // Get returns all values pointed by specific field from source MetricDescriptor_IndexSpec 2063 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) Get(source *MetricDescriptor_IndexSpec) (values []interface{}) { 2064 if source != nil { 2065 switch fp.selector { 2066 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2067 for _, value := range source.GetPerResource() { 2068 values = append(values, value) 2069 } 2070 default: 2071 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fp.selector)) 2072 } 2073 } 2074 return 2075 } 2076 2077 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2078 return fp.Get(source.(*MetricDescriptor_IndexSpec)) 2079 } 2080 2081 // GetSingle returns value pointed by specific field of from source MetricDescriptor_IndexSpec 2082 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) GetSingle(source *MetricDescriptor_IndexSpec) (interface{}, bool) { 2083 switch fp.selector { 2084 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2085 res := source.GetPerResource() 2086 return res, res != nil 2087 default: 2088 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fp.selector)) 2089 } 2090 } 2091 2092 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2093 return fp.GetSingle(source.(*MetricDescriptor_IndexSpec)) 2094 } 2095 2096 // GetDefault returns a default value of the field type 2097 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) GetDefault() interface{} { 2098 switch fp.selector { 2099 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2100 return ([]*MetricDescriptor_IndexSpec_PerMonitoredResource)(nil) 2101 default: 2102 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fp.selector)) 2103 } 2104 } 2105 2106 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) ClearValue(item *MetricDescriptor_IndexSpec) { 2107 if item != nil { 2108 switch fp.selector { 2109 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2110 item.PerResource = nil 2111 default: 2112 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fp.selector)) 2113 } 2114 } 2115 } 2116 2117 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2118 fp.ClearValue(item.(*MetricDescriptor_IndexSpec)) 2119 } 2120 2121 // IsLeaf - whether field path is holds simple value 2122 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) IsLeaf() bool { 2123 return false 2124 } 2125 2126 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2127 return []gotenobject.FieldPath{fp} 2128 } 2129 2130 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndexSpec_FieldPathValue { 2131 switch fp.selector { 2132 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2133 return &MetricDescriptorIndexSpec_FieldTerminalPathValue{MetricDescriptorIndexSpec_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_IndexSpec_PerMonitoredResource)} 2134 default: 2135 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fp.selector)) 2136 } 2137 } 2138 2139 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2140 return fp.WithIValue(value) 2141 } 2142 2143 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndexSpec_FieldPathArrayOfValues { 2144 fpaov := &MetricDescriptorIndexSpec_FieldTerminalPathArrayOfValues{MetricDescriptorIndexSpec_FieldTerminalPath: *fp} 2145 switch fp.selector { 2146 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2147 return &MetricDescriptorIndexSpec_FieldTerminalPathArrayOfValues{MetricDescriptorIndexSpec_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_IndexSpec_PerMonitoredResource)} 2148 default: 2149 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fp.selector)) 2150 } 2151 return fpaov 2152 } 2153 2154 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2155 return fp.WithIArrayOfValues(values) 2156 } 2157 2158 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndexSpec_FieldPathArrayItemValue { 2159 switch fp.selector { 2160 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2161 return &MetricDescriptorIndexSpec_FieldTerminalPathArrayItemValue{MetricDescriptorIndexSpec_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_IndexSpec_PerMonitoredResource)} 2162 default: 2163 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fp.selector)) 2164 } 2165 } 2166 2167 func (fp *MetricDescriptorIndexSpec_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2168 return fp.WithIArrayItemValue(value) 2169 } 2170 2171 type MetricDescriptorIndexSpec_FieldSubPath struct { 2172 selector MetricDescriptorIndexSpec_FieldPathSelector 2173 subPath gotenobject.FieldPath 2174 } 2175 2176 var _ MetricDescriptorIndexSpec_FieldPath = (*MetricDescriptorIndexSpec_FieldSubPath)(nil) 2177 2178 func (fps *MetricDescriptorIndexSpec_FieldSubPath) Selector() MetricDescriptorIndexSpec_FieldPathSelector { 2179 return fps.selector 2180 } 2181 func (fps *MetricDescriptorIndexSpec_FieldSubPath) AsPerResourceSubPath() (MetricDescriptorIndexSpecPerMonitoredResource_FieldPath, bool) { 2182 res, ok := fps.subPath.(MetricDescriptorIndexSpecPerMonitoredResource_FieldPath) 2183 return res, ok 2184 } 2185 2186 // String returns path representation in proto convention 2187 func (fps *MetricDescriptorIndexSpec_FieldSubPath) String() string { 2188 return fps.selector.String() + "." + fps.subPath.String() 2189 } 2190 2191 // JSONString returns path representation is JSON convention 2192 func (fps *MetricDescriptorIndexSpec_FieldSubPath) JSONString() string { 2193 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 2194 } 2195 2196 // Get returns all values pointed by selected field from source MetricDescriptor_IndexSpec 2197 func (fps *MetricDescriptorIndexSpec_FieldSubPath) Get(source *MetricDescriptor_IndexSpec) (values []interface{}) { 2198 switch fps.selector { 2199 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2200 for _, item := range source.GetPerResource() { 2201 values = append(values, fps.subPath.GetRaw(item)...) 2202 } 2203 default: 2204 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fps.selector)) 2205 } 2206 return 2207 } 2208 2209 func (fps *MetricDescriptorIndexSpec_FieldSubPath) GetRaw(source proto.Message) []interface{} { 2210 return fps.Get(source.(*MetricDescriptor_IndexSpec)) 2211 } 2212 2213 // GetSingle returns value of selected field from source MetricDescriptor_IndexSpec 2214 func (fps *MetricDescriptorIndexSpec_FieldSubPath) GetSingle(source *MetricDescriptor_IndexSpec) (interface{}, bool) { 2215 switch fps.selector { 2216 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2217 if len(source.GetPerResource()) == 0 { 2218 return nil, false 2219 } 2220 return fps.subPath.GetSingleRaw(source.GetPerResource()[0]) 2221 default: 2222 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fps.selector)) 2223 } 2224 } 2225 2226 func (fps *MetricDescriptorIndexSpec_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2227 return fps.GetSingle(source.(*MetricDescriptor_IndexSpec)) 2228 } 2229 2230 // GetDefault returns a default value of the field type 2231 func (fps *MetricDescriptorIndexSpec_FieldSubPath) GetDefault() interface{} { 2232 return fps.subPath.GetDefault() 2233 } 2234 2235 func (fps *MetricDescriptorIndexSpec_FieldSubPath) ClearValue(item *MetricDescriptor_IndexSpec) { 2236 if item != nil { 2237 switch fps.selector { 2238 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2239 for _, subItem := range item.PerResource { 2240 fps.subPath.ClearValueRaw(subItem) 2241 } 2242 default: 2243 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fps.selector)) 2244 } 2245 } 2246 } 2247 2248 func (fps *MetricDescriptorIndexSpec_FieldSubPath) ClearValueRaw(item proto.Message) { 2249 fps.ClearValue(item.(*MetricDescriptor_IndexSpec)) 2250 } 2251 2252 // IsLeaf - whether field path is holds simple value 2253 func (fps *MetricDescriptorIndexSpec_FieldSubPath) IsLeaf() bool { 2254 return fps.subPath.IsLeaf() 2255 } 2256 2257 func (fps *MetricDescriptorIndexSpec_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2258 iPaths := []gotenobject.FieldPath{&MetricDescriptorIndexSpec_FieldTerminalPath{selector: fps.selector}} 2259 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 2260 return iPaths 2261 } 2262 2263 func (fps *MetricDescriptorIndexSpec_FieldSubPath) WithIValue(value interface{}) MetricDescriptorIndexSpec_FieldPathValue { 2264 return &MetricDescriptorIndexSpec_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 2265 } 2266 2267 func (fps *MetricDescriptorIndexSpec_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2268 return fps.WithIValue(value) 2269 } 2270 2271 func (fps *MetricDescriptorIndexSpec_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndexSpec_FieldPathArrayOfValues { 2272 return &MetricDescriptorIndexSpec_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 2273 } 2274 2275 func (fps *MetricDescriptorIndexSpec_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2276 return fps.WithIArrayOfValues(values) 2277 } 2278 2279 func (fps *MetricDescriptorIndexSpec_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndexSpec_FieldPathArrayItemValue { 2280 return &MetricDescriptorIndexSpec_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 2281 } 2282 2283 func (fps *MetricDescriptorIndexSpec_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2284 return fps.WithIArrayItemValue(value) 2285 } 2286 2287 // MetricDescriptorIndexSpec_FieldPathValue allows storing values for IndexSpec fields according to their type 2288 type MetricDescriptorIndexSpec_FieldPathValue interface { 2289 MetricDescriptorIndexSpec_FieldPath 2290 gotenobject.FieldPathValue 2291 SetTo(target **MetricDescriptor_IndexSpec) 2292 CompareWith(*MetricDescriptor_IndexSpec) (cmp int, comparable bool) 2293 } 2294 2295 func ParseMetricDescriptorIndexSpec_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndexSpec_FieldPathValue, error) { 2296 fp, err := ParseMetricDescriptorIndexSpec_FieldPath(pathStr) 2297 if err != nil { 2298 return nil, err 2299 } 2300 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2301 if err != nil { 2302 return nil, status.Errorf(codes.InvalidArgument, "error parsing IndexSpec field path value from %s: %v", valueStr, err) 2303 } 2304 return fpv.(MetricDescriptorIndexSpec_FieldPathValue), nil 2305 } 2306 2307 func MustParseMetricDescriptorIndexSpec_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndexSpec_FieldPathValue { 2308 fpv, err := ParseMetricDescriptorIndexSpec_FieldPathValue(pathStr, valueStr) 2309 if err != nil { 2310 panic(err) 2311 } 2312 return fpv 2313 } 2314 2315 type MetricDescriptorIndexSpec_FieldTerminalPathValue struct { 2316 MetricDescriptorIndexSpec_FieldTerminalPath 2317 value interface{} 2318 } 2319 2320 var _ MetricDescriptorIndexSpec_FieldPathValue = (*MetricDescriptorIndexSpec_FieldTerminalPathValue)(nil) 2321 2322 // GetRawValue returns raw value stored under selected path for 'IndexSpec' as interface{} 2323 func (fpv *MetricDescriptorIndexSpec_FieldTerminalPathValue) GetRawValue() interface{} { 2324 return fpv.value 2325 } 2326 func (fpv *MetricDescriptorIndexSpec_FieldTerminalPathValue) AsPerResourceValue() ([]*MetricDescriptor_IndexSpec_PerMonitoredResource, bool) { 2327 res, ok := fpv.value.([]*MetricDescriptor_IndexSpec_PerMonitoredResource) 2328 return res, ok 2329 } 2330 2331 // SetTo stores value for selected field for object IndexSpec 2332 func (fpv *MetricDescriptorIndexSpec_FieldTerminalPathValue) SetTo(target **MetricDescriptor_IndexSpec) { 2333 if *target == nil { 2334 *target = new(MetricDescriptor_IndexSpec) 2335 } 2336 switch fpv.selector { 2337 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2338 (*target).PerResource = fpv.value.([]*MetricDescriptor_IndexSpec_PerMonitoredResource) 2339 default: 2340 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fpv.selector)) 2341 } 2342 } 2343 2344 func (fpv *MetricDescriptorIndexSpec_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2345 typedObject := target.(*MetricDescriptor_IndexSpec) 2346 fpv.SetTo(&typedObject) 2347 } 2348 2349 // CompareWith compares value in the 'MetricDescriptorIndexSpec_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_IndexSpec'. 2350 func (fpv *MetricDescriptorIndexSpec_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_IndexSpec) (int, bool) { 2351 switch fpv.selector { 2352 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2353 return 0, false 2354 default: 2355 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fpv.selector)) 2356 } 2357 } 2358 2359 func (fpv *MetricDescriptorIndexSpec_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2360 return fpv.CompareWith(source.(*MetricDescriptor_IndexSpec)) 2361 } 2362 2363 type MetricDescriptorIndexSpec_FieldSubPathValue struct { 2364 MetricDescriptorIndexSpec_FieldPath 2365 subPathValue gotenobject.FieldPathValue 2366 } 2367 2368 var _ MetricDescriptorIndexSpec_FieldPathValue = (*MetricDescriptorIndexSpec_FieldSubPathValue)(nil) 2369 2370 func (fpvs *MetricDescriptorIndexSpec_FieldSubPathValue) AsPerResourcePathValue() (MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue, bool) { 2371 res, ok := fpvs.subPathValue.(MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue) 2372 return res, ok 2373 } 2374 2375 func (fpvs *MetricDescriptorIndexSpec_FieldSubPathValue) SetTo(target **MetricDescriptor_IndexSpec) { 2376 if *target == nil { 2377 *target = new(MetricDescriptor_IndexSpec) 2378 } 2379 switch fpvs.Selector() { 2380 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2381 panic("FieldPath setter is unsupported for array subpaths") 2382 default: 2383 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fpvs.Selector())) 2384 } 2385 } 2386 2387 func (fpvs *MetricDescriptorIndexSpec_FieldSubPathValue) SetToRaw(target proto.Message) { 2388 typedObject := target.(*MetricDescriptor_IndexSpec) 2389 fpvs.SetTo(&typedObject) 2390 } 2391 2392 func (fpvs *MetricDescriptorIndexSpec_FieldSubPathValue) GetRawValue() interface{} { 2393 return fpvs.subPathValue.GetRawValue() 2394 } 2395 2396 func (fpvs *MetricDescriptorIndexSpec_FieldSubPathValue) CompareWith(source *MetricDescriptor_IndexSpec) (int, bool) { 2397 switch fpvs.Selector() { 2398 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2399 return 0, false // repeated field 2400 default: 2401 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fpvs.Selector())) 2402 } 2403 } 2404 2405 func (fpvs *MetricDescriptorIndexSpec_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2406 return fpvs.CompareWith(source.(*MetricDescriptor_IndexSpec)) 2407 } 2408 2409 // MetricDescriptorIndexSpec_FieldPathArrayItemValue allows storing single item in Path-specific values for IndexSpec according to their type 2410 // Present only for array (repeated) types. 2411 type MetricDescriptorIndexSpec_FieldPathArrayItemValue interface { 2412 gotenobject.FieldPathArrayItemValue 2413 MetricDescriptorIndexSpec_FieldPath 2414 ContainsValue(*MetricDescriptor_IndexSpec) bool 2415 } 2416 2417 // ParseMetricDescriptorIndexSpec_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2418 func ParseMetricDescriptorIndexSpec_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndexSpec_FieldPathArrayItemValue, error) { 2419 fp, err := ParseMetricDescriptorIndexSpec_FieldPath(pathStr) 2420 if err != nil { 2421 return nil, err 2422 } 2423 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2424 if err != nil { 2425 return nil, status.Errorf(codes.InvalidArgument, "error parsing IndexSpec field path array item value from %s: %v", valueStr, err) 2426 } 2427 return fpaiv.(MetricDescriptorIndexSpec_FieldPathArrayItemValue), nil 2428 } 2429 2430 func MustParseMetricDescriptorIndexSpec_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndexSpec_FieldPathArrayItemValue { 2431 fpaiv, err := ParseMetricDescriptorIndexSpec_FieldPathArrayItemValue(pathStr, valueStr) 2432 if err != nil { 2433 panic(err) 2434 } 2435 return fpaiv 2436 } 2437 2438 type MetricDescriptorIndexSpec_FieldTerminalPathArrayItemValue struct { 2439 MetricDescriptorIndexSpec_FieldTerminalPath 2440 value interface{} 2441 } 2442 2443 var _ MetricDescriptorIndexSpec_FieldPathArrayItemValue = (*MetricDescriptorIndexSpec_FieldTerminalPathArrayItemValue)(nil) 2444 2445 // GetRawValue returns stored element value for array in object MetricDescriptor_IndexSpec as interface{} 2446 func (fpaiv *MetricDescriptorIndexSpec_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2447 return fpaiv.value 2448 } 2449 func (fpaiv *MetricDescriptorIndexSpec_FieldTerminalPathArrayItemValue) AsPerResourceItemValue() (*MetricDescriptor_IndexSpec_PerMonitoredResource, bool) { 2450 res, ok := fpaiv.value.(*MetricDescriptor_IndexSpec_PerMonitoredResource) 2451 return res, ok 2452 } 2453 2454 func (fpaiv *MetricDescriptorIndexSpec_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_IndexSpec) (interface{}, bool) { 2455 return nil, false 2456 } 2457 2458 func (fpaiv *MetricDescriptorIndexSpec_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2459 return fpaiv.GetSingle(source.(*MetricDescriptor_IndexSpec)) 2460 } 2461 2462 // Contains returns a boolean indicating if value that is being held is present in given 'IndexSpec' 2463 func (fpaiv *MetricDescriptorIndexSpec_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_IndexSpec) bool { 2464 slice := fpaiv.MetricDescriptorIndexSpec_FieldTerminalPath.Get(source) 2465 for _, v := range slice { 2466 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2467 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2468 return true 2469 } 2470 } else if reflect.DeepEqual(v, fpaiv.value) { 2471 return true 2472 } 2473 } 2474 return false 2475 } 2476 2477 type MetricDescriptorIndexSpec_FieldSubPathArrayItemValue struct { 2478 MetricDescriptorIndexSpec_FieldPath 2479 subPathItemValue gotenobject.FieldPathArrayItemValue 2480 } 2481 2482 // GetRawValue returns stored array item value 2483 func (fpaivs *MetricDescriptorIndexSpec_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 2484 return fpaivs.subPathItemValue.GetRawItemValue() 2485 } 2486 func (fpaivs *MetricDescriptorIndexSpec_FieldSubPathArrayItemValue) AsPerResourcePathItemValue() (MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue, bool) { 2487 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue) 2488 return res, ok 2489 } 2490 2491 // Contains returns a boolean indicating if value that is being held is present in given 'IndexSpec' 2492 func (fpaivs *MetricDescriptorIndexSpec_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor_IndexSpec) bool { 2493 switch fpaivs.Selector() { 2494 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2495 return false // repeated/map field 2496 default: 2497 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec: %d", fpaivs.Selector())) 2498 } 2499 } 2500 2501 // MetricDescriptorIndexSpec_FieldPathArrayOfValues allows storing slice of values for IndexSpec fields according to their type 2502 type MetricDescriptorIndexSpec_FieldPathArrayOfValues interface { 2503 gotenobject.FieldPathArrayOfValues 2504 MetricDescriptorIndexSpec_FieldPath 2505 } 2506 2507 func ParseMetricDescriptorIndexSpec_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndexSpec_FieldPathArrayOfValues, error) { 2508 fp, err := ParseMetricDescriptorIndexSpec_FieldPath(pathStr) 2509 if err != nil { 2510 return nil, err 2511 } 2512 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2513 if err != nil { 2514 return nil, status.Errorf(codes.InvalidArgument, "error parsing IndexSpec field path array of values from %s: %v", valuesStr, err) 2515 } 2516 return fpaov.(MetricDescriptorIndexSpec_FieldPathArrayOfValues), nil 2517 } 2518 2519 func MustParseMetricDescriptorIndexSpec_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndexSpec_FieldPathArrayOfValues { 2520 fpaov, err := ParseMetricDescriptorIndexSpec_FieldPathArrayOfValues(pathStr, valuesStr) 2521 if err != nil { 2522 panic(err) 2523 } 2524 return fpaov 2525 } 2526 2527 type MetricDescriptorIndexSpec_FieldTerminalPathArrayOfValues struct { 2528 MetricDescriptorIndexSpec_FieldTerminalPath 2529 values interface{} 2530 } 2531 2532 var _ MetricDescriptorIndexSpec_FieldPathArrayOfValues = (*MetricDescriptorIndexSpec_FieldTerminalPathArrayOfValues)(nil) 2533 2534 func (fpaov *MetricDescriptorIndexSpec_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2535 switch fpaov.selector { 2536 case MetricDescriptorIndexSpec_FieldPathSelectorPerResource: 2537 for _, v := range fpaov.values.([][]*MetricDescriptor_IndexSpec_PerMonitoredResource) { 2538 values = append(values, v) 2539 } 2540 } 2541 return 2542 } 2543 func (fpaov *MetricDescriptorIndexSpec_FieldTerminalPathArrayOfValues) AsPerResourceArrayOfValues() ([][]*MetricDescriptor_IndexSpec_PerMonitoredResource, bool) { 2544 res, ok := fpaov.values.([][]*MetricDescriptor_IndexSpec_PerMonitoredResource) 2545 return res, ok 2546 } 2547 2548 type MetricDescriptorIndexSpec_FieldSubPathArrayOfValues struct { 2549 MetricDescriptorIndexSpec_FieldPath 2550 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 2551 } 2552 2553 var _ MetricDescriptorIndexSpec_FieldPathArrayOfValues = (*MetricDescriptorIndexSpec_FieldSubPathArrayOfValues)(nil) 2554 2555 func (fpsaov *MetricDescriptorIndexSpec_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 2556 return fpsaov.subPathArrayOfValues.GetRawValues() 2557 } 2558 func (fpsaov *MetricDescriptorIndexSpec_FieldSubPathArrayOfValues) AsPerResourcePathArrayOfValues() (MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues, bool) { 2559 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues) 2560 return res, ok 2561 } 2562 2563 // FieldPath provides implementation to handle 2564 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 2565 type MetricDescriptorIndices_FieldPath interface { 2566 gotenobject.FieldPath 2567 Selector() MetricDescriptorIndices_FieldPathSelector 2568 Get(source *MetricDescriptor_Indices) []interface{} 2569 GetSingle(source *MetricDescriptor_Indices) (interface{}, bool) 2570 ClearValue(item *MetricDescriptor_Indices) 2571 2572 // Those methods build corresponding MetricDescriptorIndices_FieldPathValue 2573 // (or array of values) and holds passed value. Panics if injected type is incorrect. 2574 WithIValue(value interface{}) MetricDescriptorIndices_FieldPathValue 2575 WithIArrayOfValues(values interface{}) MetricDescriptorIndices_FieldPathArrayOfValues 2576 WithIArrayItemValue(value interface{}) MetricDescriptorIndices_FieldPathArrayItemValue 2577 } 2578 2579 type MetricDescriptorIndices_FieldPathSelector int32 2580 2581 const ( 2582 MetricDescriptorIndices_FieldPathSelectorBuiltIn MetricDescriptorIndices_FieldPathSelector = 0 2583 MetricDescriptorIndices_FieldPathSelectorUserDefined MetricDescriptorIndices_FieldPathSelector = 1 2584 MetricDescriptorIndices_FieldPathSelectorLegacyMigrated MetricDescriptorIndices_FieldPathSelector = 2 2585 ) 2586 2587 func (s MetricDescriptorIndices_FieldPathSelector) String() string { 2588 switch s { 2589 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2590 return "built_in" 2591 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2592 return "user_defined" 2593 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2594 return "legacy_migrated" 2595 default: 2596 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", s)) 2597 } 2598 } 2599 2600 func BuildMetricDescriptorIndices_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndices_FieldPath, error) { 2601 if len(fp) == 0 { 2602 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_Indices") 2603 } 2604 if len(fp) == 1 { 2605 switch fp[0] { 2606 case "built_in", "builtIn", "built-in": 2607 return &MetricDescriptorIndices_FieldTerminalPath{selector: MetricDescriptorIndices_FieldPathSelectorBuiltIn}, nil 2608 case "user_defined", "userDefined", "user-defined": 2609 return &MetricDescriptorIndices_FieldTerminalPath{selector: MetricDescriptorIndices_FieldPathSelectorUserDefined}, nil 2610 case "legacy_migrated", "legacyMigrated", "legacy-migrated": 2611 return &MetricDescriptorIndices_FieldTerminalPath{selector: MetricDescriptorIndices_FieldPathSelectorLegacyMigrated}, nil 2612 } 2613 } else { 2614 switch fp[0] { 2615 case "built_in", "builtIn", "built-in": 2616 if subpath, err := BuildMetricDescriptorIndicesIndexGroups_FieldPath(fp[1:]); err != nil { 2617 return nil, err 2618 } else { 2619 return &MetricDescriptorIndices_FieldSubPath{selector: MetricDescriptorIndices_FieldPathSelectorBuiltIn, subPath: subpath}, nil 2620 } 2621 case "user_defined", "userDefined", "user-defined": 2622 if subpath, err := BuildMetricDescriptorIndicesIndexGroups_FieldPath(fp[1:]); err != nil { 2623 return nil, err 2624 } else { 2625 return &MetricDescriptorIndices_FieldSubPath{selector: MetricDescriptorIndices_FieldPathSelectorUserDefined, subPath: subpath}, nil 2626 } 2627 case "legacy_migrated", "legacyMigrated", "legacy-migrated": 2628 if subpath, err := BuildMetricDescriptorIndicesNonAggregatedIndices_FieldPath(fp[1:]); err != nil { 2629 return nil, err 2630 } else { 2631 return &MetricDescriptorIndices_FieldSubPath{selector: MetricDescriptorIndices_FieldPathSelectorLegacyMigrated, subPath: subpath}, nil 2632 } 2633 } 2634 } 2635 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_Indices", fp) 2636 } 2637 2638 func ParseMetricDescriptorIndices_FieldPath(rawField string) (MetricDescriptorIndices_FieldPath, error) { 2639 fp, err := gotenobject.ParseRawFieldPath(rawField) 2640 if err != nil { 2641 return nil, err 2642 } 2643 return BuildMetricDescriptorIndices_FieldPath(fp) 2644 } 2645 2646 func MustParseMetricDescriptorIndices_FieldPath(rawField string) MetricDescriptorIndices_FieldPath { 2647 fp, err := ParseMetricDescriptorIndices_FieldPath(rawField) 2648 if err != nil { 2649 panic(err) 2650 } 2651 return fp 2652 } 2653 2654 type MetricDescriptorIndices_FieldTerminalPath struct { 2655 selector MetricDescriptorIndices_FieldPathSelector 2656 } 2657 2658 var _ MetricDescriptorIndices_FieldPath = (*MetricDescriptorIndices_FieldTerminalPath)(nil) 2659 2660 func (fp *MetricDescriptorIndices_FieldTerminalPath) Selector() MetricDescriptorIndices_FieldPathSelector { 2661 return fp.selector 2662 } 2663 2664 // String returns path representation in proto convention 2665 func (fp *MetricDescriptorIndices_FieldTerminalPath) String() string { 2666 return fp.selector.String() 2667 } 2668 2669 // JSONString returns path representation is JSON convention 2670 func (fp *MetricDescriptorIndices_FieldTerminalPath) JSONString() string { 2671 return strcase.ToLowerCamel(fp.String()) 2672 } 2673 2674 // Get returns all values pointed by specific field from source MetricDescriptor_Indices 2675 func (fp *MetricDescriptorIndices_FieldTerminalPath) Get(source *MetricDescriptor_Indices) (values []interface{}) { 2676 if source != nil { 2677 switch fp.selector { 2678 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2679 if source.BuiltIn != nil { 2680 values = append(values, source.BuiltIn) 2681 } 2682 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2683 if source.UserDefined != nil { 2684 values = append(values, source.UserDefined) 2685 } 2686 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2687 for _, value := range source.GetLegacyMigrated() { 2688 values = append(values, value) 2689 } 2690 default: 2691 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fp.selector)) 2692 } 2693 } 2694 return 2695 } 2696 2697 func (fp *MetricDescriptorIndices_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2698 return fp.Get(source.(*MetricDescriptor_Indices)) 2699 } 2700 2701 // GetSingle returns value pointed by specific field of from source MetricDescriptor_Indices 2702 func (fp *MetricDescriptorIndices_FieldTerminalPath) GetSingle(source *MetricDescriptor_Indices) (interface{}, bool) { 2703 switch fp.selector { 2704 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2705 res := source.GetBuiltIn() 2706 return res, res != nil 2707 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2708 res := source.GetUserDefined() 2709 return res, res != nil 2710 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2711 res := source.GetLegacyMigrated() 2712 return res, res != nil 2713 default: 2714 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fp.selector)) 2715 } 2716 } 2717 2718 func (fp *MetricDescriptorIndices_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2719 return fp.GetSingle(source.(*MetricDescriptor_Indices)) 2720 } 2721 2722 // GetDefault returns a default value of the field type 2723 func (fp *MetricDescriptorIndices_FieldTerminalPath) GetDefault() interface{} { 2724 switch fp.selector { 2725 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2726 return (*MetricDescriptor_Indices_IndexGroups)(nil) 2727 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2728 return (*MetricDescriptor_Indices_IndexGroups)(nil) 2729 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2730 return ([]*MetricDescriptor_Indices_NonAggregatedIndices)(nil) 2731 default: 2732 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fp.selector)) 2733 } 2734 } 2735 2736 func (fp *MetricDescriptorIndices_FieldTerminalPath) ClearValue(item *MetricDescriptor_Indices) { 2737 if item != nil { 2738 switch fp.selector { 2739 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2740 item.BuiltIn = nil 2741 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2742 item.UserDefined = nil 2743 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2744 item.LegacyMigrated = nil 2745 default: 2746 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fp.selector)) 2747 } 2748 } 2749 } 2750 2751 func (fp *MetricDescriptorIndices_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2752 fp.ClearValue(item.(*MetricDescriptor_Indices)) 2753 } 2754 2755 // IsLeaf - whether field path is holds simple value 2756 func (fp *MetricDescriptorIndices_FieldTerminalPath) IsLeaf() bool { 2757 return false 2758 } 2759 2760 func (fp *MetricDescriptorIndices_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2761 return []gotenobject.FieldPath{fp} 2762 } 2763 2764 func (fp *MetricDescriptorIndices_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndices_FieldPathValue { 2765 switch fp.selector { 2766 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2767 return &MetricDescriptorIndices_FieldTerminalPathValue{MetricDescriptorIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_IndexGroups)} 2768 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2769 return &MetricDescriptorIndices_FieldTerminalPathValue{MetricDescriptorIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_IndexGroups)} 2770 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2771 return &MetricDescriptorIndices_FieldTerminalPathValue{MetricDescriptorIndices_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_NonAggregatedIndices)} 2772 default: 2773 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fp.selector)) 2774 } 2775 } 2776 2777 func (fp *MetricDescriptorIndices_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2778 return fp.WithIValue(value) 2779 } 2780 2781 func (fp *MetricDescriptorIndices_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndices_FieldPathArrayOfValues { 2782 fpaov := &MetricDescriptorIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndices_FieldTerminalPath: *fp} 2783 switch fp.selector { 2784 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2785 return &MetricDescriptorIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndices_FieldTerminalPath: *fp, values: values.([]*MetricDescriptor_Indices_IndexGroups)} 2786 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2787 return &MetricDescriptorIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndices_FieldTerminalPath: *fp, values: values.([]*MetricDescriptor_Indices_IndexGroups)} 2788 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2789 return &MetricDescriptorIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndices_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_NonAggregatedIndices)} 2790 default: 2791 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fp.selector)) 2792 } 2793 return fpaov 2794 } 2795 2796 func (fp *MetricDescriptorIndices_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2797 return fp.WithIArrayOfValues(values) 2798 } 2799 2800 func (fp *MetricDescriptorIndices_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndices_FieldPathArrayItemValue { 2801 switch fp.selector { 2802 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2803 return &MetricDescriptorIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_NonAggregatedIndices)} 2804 default: 2805 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fp.selector)) 2806 } 2807 } 2808 2809 func (fp *MetricDescriptorIndices_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2810 return fp.WithIArrayItemValue(value) 2811 } 2812 2813 type MetricDescriptorIndices_FieldSubPath struct { 2814 selector MetricDescriptorIndices_FieldPathSelector 2815 subPath gotenobject.FieldPath 2816 } 2817 2818 var _ MetricDescriptorIndices_FieldPath = (*MetricDescriptorIndices_FieldSubPath)(nil) 2819 2820 func (fps *MetricDescriptorIndices_FieldSubPath) Selector() MetricDescriptorIndices_FieldPathSelector { 2821 return fps.selector 2822 } 2823 func (fps *MetricDescriptorIndices_FieldSubPath) AsBuiltInSubPath() (MetricDescriptorIndicesIndexGroups_FieldPath, bool) { 2824 res, ok := fps.subPath.(MetricDescriptorIndicesIndexGroups_FieldPath) 2825 return res, ok 2826 } 2827 func (fps *MetricDescriptorIndices_FieldSubPath) AsUserDefinedSubPath() (MetricDescriptorIndicesIndexGroups_FieldPath, bool) { 2828 res, ok := fps.subPath.(MetricDescriptorIndicesIndexGroups_FieldPath) 2829 return res, ok 2830 } 2831 func (fps *MetricDescriptorIndices_FieldSubPath) AsLegacyMigratedSubPath() (MetricDescriptorIndicesNonAggregatedIndices_FieldPath, bool) { 2832 res, ok := fps.subPath.(MetricDescriptorIndicesNonAggregatedIndices_FieldPath) 2833 return res, ok 2834 } 2835 2836 // String returns path representation in proto convention 2837 func (fps *MetricDescriptorIndices_FieldSubPath) String() string { 2838 return fps.selector.String() + "." + fps.subPath.String() 2839 } 2840 2841 // JSONString returns path representation is JSON convention 2842 func (fps *MetricDescriptorIndices_FieldSubPath) JSONString() string { 2843 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 2844 } 2845 2846 // Get returns all values pointed by selected field from source MetricDescriptor_Indices 2847 func (fps *MetricDescriptorIndices_FieldSubPath) Get(source *MetricDescriptor_Indices) (values []interface{}) { 2848 switch fps.selector { 2849 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2850 values = append(values, fps.subPath.GetRaw(source.GetBuiltIn())...) 2851 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2852 values = append(values, fps.subPath.GetRaw(source.GetUserDefined())...) 2853 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2854 for _, item := range source.GetLegacyMigrated() { 2855 values = append(values, fps.subPath.GetRaw(item)...) 2856 } 2857 default: 2858 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fps.selector)) 2859 } 2860 return 2861 } 2862 2863 func (fps *MetricDescriptorIndices_FieldSubPath) GetRaw(source proto.Message) []interface{} { 2864 return fps.Get(source.(*MetricDescriptor_Indices)) 2865 } 2866 2867 // GetSingle returns value of selected field from source MetricDescriptor_Indices 2868 func (fps *MetricDescriptorIndices_FieldSubPath) GetSingle(source *MetricDescriptor_Indices) (interface{}, bool) { 2869 switch fps.selector { 2870 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2871 if source.GetBuiltIn() == nil { 2872 return nil, false 2873 } 2874 return fps.subPath.GetSingleRaw(source.GetBuiltIn()) 2875 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2876 if source.GetUserDefined() == nil { 2877 return nil, false 2878 } 2879 return fps.subPath.GetSingleRaw(source.GetUserDefined()) 2880 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2881 if len(source.GetLegacyMigrated()) == 0 { 2882 return nil, false 2883 } 2884 return fps.subPath.GetSingleRaw(source.GetLegacyMigrated()[0]) 2885 default: 2886 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fps.selector)) 2887 } 2888 } 2889 2890 func (fps *MetricDescriptorIndices_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2891 return fps.GetSingle(source.(*MetricDescriptor_Indices)) 2892 } 2893 2894 // GetDefault returns a default value of the field type 2895 func (fps *MetricDescriptorIndices_FieldSubPath) GetDefault() interface{} { 2896 return fps.subPath.GetDefault() 2897 } 2898 2899 func (fps *MetricDescriptorIndices_FieldSubPath) ClearValue(item *MetricDescriptor_Indices) { 2900 if item != nil { 2901 switch fps.selector { 2902 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 2903 fps.subPath.ClearValueRaw(item.BuiltIn) 2904 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 2905 fps.subPath.ClearValueRaw(item.UserDefined) 2906 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 2907 for _, subItem := range item.LegacyMigrated { 2908 fps.subPath.ClearValueRaw(subItem) 2909 } 2910 default: 2911 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fps.selector)) 2912 } 2913 } 2914 } 2915 2916 func (fps *MetricDescriptorIndices_FieldSubPath) ClearValueRaw(item proto.Message) { 2917 fps.ClearValue(item.(*MetricDescriptor_Indices)) 2918 } 2919 2920 // IsLeaf - whether field path is holds simple value 2921 func (fps *MetricDescriptorIndices_FieldSubPath) IsLeaf() bool { 2922 return fps.subPath.IsLeaf() 2923 } 2924 2925 func (fps *MetricDescriptorIndices_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2926 iPaths := []gotenobject.FieldPath{&MetricDescriptorIndices_FieldTerminalPath{selector: fps.selector}} 2927 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 2928 return iPaths 2929 } 2930 2931 func (fps *MetricDescriptorIndices_FieldSubPath) WithIValue(value interface{}) MetricDescriptorIndices_FieldPathValue { 2932 return &MetricDescriptorIndices_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 2933 } 2934 2935 func (fps *MetricDescriptorIndices_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2936 return fps.WithIValue(value) 2937 } 2938 2939 func (fps *MetricDescriptorIndices_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndices_FieldPathArrayOfValues { 2940 return &MetricDescriptorIndices_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 2941 } 2942 2943 func (fps *MetricDescriptorIndices_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2944 return fps.WithIArrayOfValues(values) 2945 } 2946 2947 func (fps *MetricDescriptorIndices_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndices_FieldPathArrayItemValue { 2948 return &MetricDescriptorIndices_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 2949 } 2950 2951 func (fps *MetricDescriptorIndices_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2952 return fps.WithIArrayItemValue(value) 2953 } 2954 2955 // MetricDescriptorIndices_FieldPathValue allows storing values for Indices fields according to their type 2956 type MetricDescriptorIndices_FieldPathValue interface { 2957 MetricDescriptorIndices_FieldPath 2958 gotenobject.FieldPathValue 2959 SetTo(target **MetricDescriptor_Indices) 2960 CompareWith(*MetricDescriptor_Indices) (cmp int, comparable bool) 2961 } 2962 2963 func ParseMetricDescriptorIndices_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndices_FieldPathValue, error) { 2964 fp, err := ParseMetricDescriptorIndices_FieldPath(pathStr) 2965 if err != nil { 2966 return nil, err 2967 } 2968 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2969 if err != nil { 2970 return nil, status.Errorf(codes.InvalidArgument, "error parsing Indices field path value from %s: %v", valueStr, err) 2971 } 2972 return fpv.(MetricDescriptorIndices_FieldPathValue), nil 2973 } 2974 2975 func MustParseMetricDescriptorIndices_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndices_FieldPathValue { 2976 fpv, err := ParseMetricDescriptorIndices_FieldPathValue(pathStr, valueStr) 2977 if err != nil { 2978 panic(err) 2979 } 2980 return fpv 2981 } 2982 2983 type MetricDescriptorIndices_FieldTerminalPathValue struct { 2984 MetricDescriptorIndices_FieldTerminalPath 2985 value interface{} 2986 } 2987 2988 var _ MetricDescriptorIndices_FieldPathValue = (*MetricDescriptorIndices_FieldTerminalPathValue)(nil) 2989 2990 // GetRawValue returns raw value stored under selected path for 'Indices' as interface{} 2991 func (fpv *MetricDescriptorIndices_FieldTerminalPathValue) GetRawValue() interface{} { 2992 return fpv.value 2993 } 2994 func (fpv *MetricDescriptorIndices_FieldTerminalPathValue) AsBuiltInValue() (*MetricDescriptor_Indices_IndexGroups, bool) { 2995 res, ok := fpv.value.(*MetricDescriptor_Indices_IndexGroups) 2996 return res, ok 2997 } 2998 func (fpv *MetricDescriptorIndices_FieldTerminalPathValue) AsUserDefinedValue() (*MetricDescriptor_Indices_IndexGroups, bool) { 2999 res, ok := fpv.value.(*MetricDescriptor_Indices_IndexGroups) 3000 return res, ok 3001 } 3002 func (fpv *MetricDescriptorIndices_FieldTerminalPathValue) AsLegacyMigratedValue() ([]*MetricDescriptor_Indices_NonAggregatedIndices, bool) { 3003 res, ok := fpv.value.([]*MetricDescriptor_Indices_NonAggregatedIndices) 3004 return res, ok 3005 } 3006 3007 // SetTo stores value for selected field for object Indices 3008 func (fpv *MetricDescriptorIndices_FieldTerminalPathValue) SetTo(target **MetricDescriptor_Indices) { 3009 if *target == nil { 3010 *target = new(MetricDescriptor_Indices) 3011 } 3012 switch fpv.selector { 3013 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 3014 (*target).BuiltIn = fpv.value.(*MetricDescriptor_Indices_IndexGroups) 3015 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 3016 (*target).UserDefined = fpv.value.(*MetricDescriptor_Indices_IndexGroups) 3017 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 3018 (*target).LegacyMigrated = fpv.value.([]*MetricDescriptor_Indices_NonAggregatedIndices) 3019 default: 3020 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fpv.selector)) 3021 } 3022 } 3023 3024 func (fpv *MetricDescriptorIndices_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3025 typedObject := target.(*MetricDescriptor_Indices) 3026 fpv.SetTo(&typedObject) 3027 } 3028 3029 // CompareWith compares value in the 'MetricDescriptorIndices_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_Indices'. 3030 func (fpv *MetricDescriptorIndices_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_Indices) (int, bool) { 3031 switch fpv.selector { 3032 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 3033 return 0, false 3034 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 3035 return 0, false 3036 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 3037 return 0, false 3038 default: 3039 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fpv.selector)) 3040 } 3041 } 3042 3043 func (fpv *MetricDescriptorIndices_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3044 return fpv.CompareWith(source.(*MetricDescriptor_Indices)) 3045 } 3046 3047 type MetricDescriptorIndices_FieldSubPathValue struct { 3048 MetricDescriptorIndices_FieldPath 3049 subPathValue gotenobject.FieldPathValue 3050 } 3051 3052 var _ MetricDescriptorIndices_FieldPathValue = (*MetricDescriptorIndices_FieldSubPathValue)(nil) 3053 3054 func (fpvs *MetricDescriptorIndices_FieldSubPathValue) AsBuiltInPathValue() (MetricDescriptorIndicesIndexGroups_FieldPathValue, bool) { 3055 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesIndexGroups_FieldPathValue) 3056 return res, ok 3057 } 3058 func (fpvs *MetricDescriptorIndices_FieldSubPathValue) AsUserDefinedPathValue() (MetricDescriptorIndicesIndexGroups_FieldPathValue, bool) { 3059 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesIndexGroups_FieldPathValue) 3060 return res, ok 3061 } 3062 func (fpvs *MetricDescriptorIndices_FieldSubPathValue) AsLegacyMigratedPathValue() (MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue, bool) { 3063 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue) 3064 return res, ok 3065 } 3066 3067 func (fpvs *MetricDescriptorIndices_FieldSubPathValue) SetTo(target **MetricDescriptor_Indices) { 3068 if *target == nil { 3069 *target = new(MetricDescriptor_Indices) 3070 } 3071 switch fpvs.Selector() { 3072 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 3073 fpvs.subPathValue.(MetricDescriptorIndicesIndexGroups_FieldPathValue).SetTo(&(*target).BuiltIn) 3074 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 3075 fpvs.subPathValue.(MetricDescriptorIndicesIndexGroups_FieldPathValue).SetTo(&(*target).UserDefined) 3076 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 3077 panic("FieldPath setter is unsupported for array subpaths") 3078 default: 3079 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fpvs.Selector())) 3080 } 3081 } 3082 3083 func (fpvs *MetricDescriptorIndices_FieldSubPathValue) SetToRaw(target proto.Message) { 3084 typedObject := target.(*MetricDescriptor_Indices) 3085 fpvs.SetTo(&typedObject) 3086 } 3087 3088 func (fpvs *MetricDescriptorIndices_FieldSubPathValue) GetRawValue() interface{} { 3089 return fpvs.subPathValue.GetRawValue() 3090 } 3091 3092 func (fpvs *MetricDescriptorIndices_FieldSubPathValue) CompareWith(source *MetricDescriptor_Indices) (int, bool) { 3093 switch fpvs.Selector() { 3094 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 3095 return fpvs.subPathValue.(MetricDescriptorIndicesIndexGroups_FieldPathValue).CompareWith(source.GetBuiltIn()) 3096 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 3097 return fpvs.subPathValue.(MetricDescriptorIndicesIndexGroups_FieldPathValue).CompareWith(source.GetUserDefined()) 3098 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 3099 return 0, false // repeated field 3100 default: 3101 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fpvs.Selector())) 3102 } 3103 } 3104 3105 func (fpvs *MetricDescriptorIndices_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3106 return fpvs.CompareWith(source.(*MetricDescriptor_Indices)) 3107 } 3108 3109 // MetricDescriptorIndices_FieldPathArrayItemValue allows storing single item in Path-specific values for Indices according to their type 3110 // Present only for array (repeated) types. 3111 type MetricDescriptorIndices_FieldPathArrayItemValue interface { 3112 gotenobject.FieldPathArrayItemValue 3113 MetricDescriptorIndices_FieldPath 3114 ContainsValue(*MetricDescriptor_Indices) bool 3115 } 3116 3117 // ParseMetricDescriptorIndices_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3118 func ParseMetricDescriptorIndices_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndices_FieldPathArrayItemValue, error) { 3119 fp, err := ParseMetricDescriptorIndices_FieldPath(pathStr) 3120 if err != nil { 3121 return nil, err 3122 } 3123 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3124 if err != nil { 3125 return nil, status.Errorf(codes.InvalidArgument, "error parsing Indices field path array item value from %s: %v", valueStr, err) 3126 } 3127 return fpaiv.(MetricDescriptorIndices_FieldPathArrayItemValue), nil 3128 } 3129 3130 func MustParseMetricDescriptorIndices_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndices_FieldPathArrayItemValue { 3131 fpaiv, err := ParseMetricDescriptorIndices_FieldPathArrayItemValue(pathStr, valueStr) 3132 if err != nil { 3133 panic(err) 3134 } 3135 return fpaiv 3136 } 3137 3138 type MetricDescriptorIndices_FieldTerminalPathArrayItemValue struct { 3139 MetricDescriptorIndices_FieldTerminalPath 3140 value interface{} 3141 } 3142 3143 var _ MetricDescriptorIndices_FieldPathArrayItemValue = (*MetricDescriptorIndices_FieldTerminalPathArrayItemValue)(nil) 3144 3145 // GetRawValue returns stored element value for array in object MetricDescriptor_Indices as interface{} 3146 func (fpaiv *MetricDescriptorIndices_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3147 return fpaiv.value 3148 } 3149 func (fpaiv *MetricDescriptorIndices_FieldTerminalPathArrayItemValue) AsLegacyMigratedItemValue() (*MetricDescriptor_Indices_NonAggregatedIndices, bool) { 3150 res, ok := fpaiv.value.(*MetricDescriptor_Indices_NonAggregatedIndices) 3151 return res, ok 3152 } 3153 3154 func (fpaiv *MetricDescriptorIndices_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_Indices) (interface{}, bool) { 3155 return nil, false 3156 } 3157 3158 func (fpaiv *MetricDescriptorIndices_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3159 return fpaiv.GetSingle(source.(*MetricDescriptor_Indices)) 3160 } 3161 3162 // Contains returns a boolean indicating if value that is being held is present in given 'Indices' 3163 func (fpaiv *MetricDescriptorIndices_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices) bool { 3164 slice := fpaiv.MetricDescriptorIndices_FieldTerminalPath.Get(source) 3165 for _, v := range slice { 3166 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3167 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3168 return true 3169 } 3170 } else if reflect.DeepEqual(v, fpaiv.value) { 3171 return true 3172 } 3173 } 3174 return false 3175 } 3176 3177 type MetricDescriptorIndices_FieldSubPathArrayItemValue struct { 3178 MetricDescriptorIndices_FieldPath 3179 subPathItemValue gotenobject.FieldPathArrayItemValue 3180 } 3181 3182 // GetRawValue returns stored array item value 3183 func (fpaivs *MetricDescriptorIndices_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 3184 return fpaivs.subPathItemValue.GetRawItemValue() 3185 } 3186 func (fpaivs *MetricDescriptorIndices_FieldSubPathArrayItemValue) AsBuiltInPathItemValue() (MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue, bool) { 3187 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue) 3188 return res, ok 3189 } 3190 func (fpaivs *MetricDescriptorIndices_FieldSubPathArrayItemValue) AsUserDefinedPathItemValue() (MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue, bool) { 3191 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue) 3192 return res, ok 3193 } 3194 func (fpaivs *MetricDescriptorIndices_FieldSubPathArrayItemValue) AsLegacyMigratedPathItemValue() (MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue, bool) { 3195 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue) 3196 return res, ok 3197 } 3198 3199 // Contains returns a boolean indicating if value that is being held is present in given 'Indices' 3200 func (fpaivs *MetricDescriptorIndices_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices) bool { 3201 switch fpaivs.Selector() { 3202 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 3203 return fpaivs.subPathItemValue.(MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue).ContainsValue(source.GetBuiltIn()) 3204 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 3205 return fpaivs.subPathItemValue.(MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue).ContainsValue(source.GetUserDefined()) 3206 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 3207 return false // repeated/map field 3208 default: 3209 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices: %d", fpaivs.Selector())) 3210 } 3211 } 3212 3213 // MetricDescriptorIndices_FieldPathArrayOfValues allows storing slice of values for Indices fields according to their type 3214 type MetricDescriptorIndices_FieldPathArrayOfValues interface { 3215 gotenobject.FieldPathArrayOfValues 3216 MetricDescriptorIndices_FieldPath 3217 } 3218 3219 func ParseMetricDescriptorIndices_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndices_FieldPathArrayOfValues, error) { 3220 fp, err := ParseMetricDescriptorIndices_FieldPath(pathStr) 3221 if err != nil { 3222 return nil, err 3223 } 3224 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3225 if err != nil { 3226 return nil, status.Errorf(codes.InvalidArgument, "error parsing Indices field path array of values from %s: %v", valuesStr, err) 3227 } 3228 return fpaov.(MetricDescriptorIndices_FieldPathArrayOfValues), nil 3229 } 3230 3231 func MustParseMetricDescriptorIndices_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndices_FieldPathArrayOfValues { 3232 fpaov, err := ParseMetricDescriptorIndices_FieldPathArrayOfValues(pathStr, valuesStr) 3233 if err != nil { 3234 panic(err) 3235 } 3236 return fpaov 3237 } 3238 3239 type MetricDescriptorIndices_FieldTerminalPathArrayOfValues struct { 3240 MetricDescriptorIndices_FieldTerminalPath 3241 values interface{} 3242 } 3243 3244 var _ MetricDescriptorIndices_FieldPathArrayOfValues = (*MetricDescriptorIndices_FieldTerminalPathArrayOfValues)(nil) 3245 3246 func (fpaov *MetricDescriptorIndices_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3247 switch fpaov.selector { 3248 case MetricDescriptorIndices_FieldPathSelectorBuiltIn: 3249 for _, v := range fpaov.values.([]*MetricDescriptor_Indices_IndexGroups) { 3250 values = append(values, v) 3251 } 3252 case MetricDescriptorIndices_FieldPathSelectorUserDefined: 3253 for _, v := range fpaov.values.([]*MetricDescriptor_Indices_IndexGroups) { 3254 values = append(values, v) 3255 } 3256 case MetricDescriptorIndices_FieldPathSelectorLegacyMigrated: 3257 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_NonAggregatedIndices) { 3258 values = append(values, v) 3259 } 3260 } 3261 return 3262 } 3263 func (fpaov *MetricDescriptorIndices_FieldTerminalPathArrayOfValues) AsBuiltInArrayOfValues() ([]*MetricDescriptor_Indices_IndexGroups, bool) { 3264 res, ok := fpaov.values.([]*MetricDescriptor_Indices_IndexGroups) 3265 return res, ok 3266 } 3267 func (fpaov *MetricDescriptorIndices_FieldTerminalPathArrayOfValues) AsUserDefinedArrayOfValues() ([]*MetricDescriptor_Indices_IndexGroups, bool) { 3268 res, ok := fpaov.values.([]*MetricDescriptor_Indices_IndexGroups) 3269 return res, ok 3270 } 3271 func (fpaov *MetricDescriptorIndices_FieldTerminalPathArrayOfValues) AsLegacyMigratedArrayOfValues() ([][]*MetricDescriptor_Indices_NonAggregatedIndices, bool) { 3272 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_NonAggregatedIndices) 3273 return res, ok 3274 } 3275 3276 type MetricDescriptorIndices_FieldSubPathArrayOfValues struct { 3277 MetricDescriptorIndices_FieldPath 3278 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 3279 } 3280 3281 var _ MetricDescriptorIndices_FieldPathArrayOfValues = (*MetricDescriptorIndices_FieldSubPathArrayOfValues)(nil) 3282 3283 func (fpsaov *MetricDescriptorIndices_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 3284 return fpsaov.subPathArrayOfValues.GetRawValues() 3285 } 3286 func (fpsaov *MetricDescriptorIndices_FieldSubPathArrayOfValues) AsBuiltInPathArrayOfValues() (MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues, bool) { 3287 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues) 3288 return res, ok 3289 } 3290 func (fpsaov *MetricDescriptorIndices_FieldSubPathArrayOfValues) AsUserDefinedPathArrayOfValues() (MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues, bool) { 3291 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues) 3292 return res, ok 3293 } 3294 func (fpsaov *MetricDescriptorIndices_FieldSubPathArrayOfValues) AsLegacyMigratedPathArrayOfValues() (MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues, bool) { 3295 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues) 3296 return res, ok 3297 } 3298 3299 // FieldPath provides implementation to handle 3300 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3301 type MetricDescriptorStorageConfig_FieldPath interface { 3302 gotenobject.FieldPath 3303 Selector() MetricDescriptorStorageConfig_FieldPathSelector 3304 Get(source *MetricDescriptor_StorageConfig) []interface{} 3305 GetSingle(source *MetricDescriptor_StorageConfig) (interface{}, bool) 3306 ClearValue(item *MetricDescriptor_StorageConfig) 3307 3308 // Those methods build corresponding MetricDescriptorStorageConfig_FieldPathValue 3309 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3310 WithIValue(value interface{}) MetricDescriptorStorageConfig_FieldPathValue 3311 WithIArrayOfValues(values interface{}) MetricDescriptorStorageConfig_FieldPathArrayOfValues 3312 WithIArrayItemValue(value interface{}) MetricDescriptorStorageConfig_FieldPathArrayItemValue 3313 } 3314 3315 type MetricDescriptorStorageConfig_FieldPathSelector int32 3316 3317 const ( 3318 MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints MetricDescriptorStorageConfig_FieldPathSelector = 0 3319 MetricDescriptorStorageConfig_FieldPathSelectorMaxAp MetricDescriptorStorageConfig_FieldPathSelector = 1 3320 ) 3321 3322 func (s MetricDescriptorStorageConfig_FieldPathSelector) String() string { 3323 switch s { 3324 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3325 return "store_raw_points" 3326 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3327 return "max_ap" 3328 default: 3329 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", s)) 3330 } 3331 } 3332 3333 func BuildMetricDescriptorStorageConfig_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorStorageConfig_FieldPath, error) { 3334 if len(fp) == 0 { 3335 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_StorageConfig") 3336 } 3337 if len(fp) == 1 { 3338 switch fp[0] { 3339 case "store_raw_points", "storeRawPoints", "store-raw-points": 3340 return &MetricDescriptorStorageConfig_FieldTerminalPath{selector: MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints}, nil 3341 case "max_ap", "maxAp", "max-ap": 3342 return &MetricDescriptorStorageConfig_FieldTerminalPath{selector: MetricDescriptorStorageConfig_FieldPathSelectorMaxAp}, nil 3343 } 3344 } 3345 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_StorageConfig", fp) 3346 } 3347 3348 func ParseMetricDescriptorStorageConfig_FieldPath(rawField string) (MetricDescriptorStorageConfig_FieldPath, error) { 3349 fp, err := gotenobject.ParseRawFieldPath(rawField) 3350 if err != nil { 3351 return nil, err 3352 } 3353 return BuildMetricDescriptorStorageConfig_FieldPath(fp) 3354 } 3355 3356 func MustParseMetricDescriptorStorageConfig_FieldPath(rawField string) MetricDescriptorStorageConfig_FieldPath { 3357 fp, err := ParseMetricDescriptorStorageConfig_FieldPath(rawField) 3358 if err != nil { 3359 panic(err) 3360 } 3361 return fp 3362 } 3363 3364 type MetricDescriptorStorageConfig_FieldTerminalPath struct { 3365 selector MetricDescriptorStorageConfig_FieldPathSelector 3366 } 3367 3368 var _ MetricDescriptorStorageConfig_FieldPath = (*MetricDescriptorStorageConfig_FieldTerminalPath)(nil) 3369 3370 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) Selector() MetricDescriptorStorageConfig_FieldPathSelector { 3371 return fp.selector 3372 } 3373 3374 // String returns path representation in proto convention 3375 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) String() string { 3376 return fp.selector.String() 3377 } 3378 3379 // JSONString returns path representation is JSON convention 3380 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) JSONString() string { 3381 return strcase.ToLowerCamel(fp.String()) 3382 } 3383 3384 // Get returns all values pointed by specific field from source MetricDescriptor_StorageConfig 3385 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) Get(source *MetricDescriptor_StorageConfig) (values []interface{}) { 3386 if source != nil { 3387 switch fp.selector { 3388 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3389 values = append(values, source.StoreRawPoints) 3390 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3391 if source.MaxAp != nil { 3392 values = append(values, source.MaxAp) 3393 } 3394 default: 3395 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", fp.selector)) 3396 } 3397 } 3398 return 3399 } 3400 3401 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3402 return fp.Get(source.(*MetricDescriptor_StorageConfig)) 3403 } 3404 3405 // GetSingle returns value pointed by specific field of from source MetricDescriptor_StorageConfig 3406 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) GetSingle(source *MetricDescriptor_StorageConfig) (interface{}, bool) { 3407 switch fp.selector { 3408 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3409 return source.GetStoreRawPoints(), source != nil 3410 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3411 res := source.GetMaxAp() 3412 return res, res != nil 3413 default: 3414 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", fp.selector)) 3415 } 3416 } 3417 3418 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3419 return fp.GetSingle(source.(*MetricDescriptor_StorageConfig)) 3420 } 3421 3422 // GetDefault returns a default value of the field type 3423 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) GetDefault() interface{} { 3424 switch fp.selector { 3425 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3426 return false 3427 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3428 return (*durationpb.Duration)(nil) 3429 default: 3430 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", fp.selector)) 3431 } 3432 } 3433 3434 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) ClearValue(item *MetricDescriptor_StorageConfig) { 3435 if item != nil { 3436 switch fp.selector { 3437 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3438 item.StoreRawPoints = false 3439 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3440 item.MaxAp = nil 3441 default: 3442 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", fp.selector)) 3443 } 3444 } 3445 } 3446 3447 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3448 fp.ClearValue(item.(*MetricDescriptor_StorageConfig)) 3449 } 3450 3451 // IsLeaf - whether field path is holds simple value 3452 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) IsLeaf() bool { 3453 return fp.selector == MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints || 3454 fp.selector == MetricDescriptorStorageConfig_FieldPathSelectorMaxAp 3455 } 3456 3457 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3458 return []gotenobject.FieldPath{fp} 3459 } 3460 3461 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorStorageConfig_FieldPathValue { 3462 switch fp.selector { 3463 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3464 return &MetricDescriptorStorageConfig_FieldTerminalPathValue{MetricDescriptorStorageConfig_FieldTerminalPath: *fp, value: value.(bool)} 3465 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3466 return &MetricDescriptorStorageConfig_FieldTerminalPathValue{MetricDescriptorStorageConfig_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 3467 default: 3468 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", fp.selector)) 3469 } 3470 } 3471 3472 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3473 return fp.WithIValue(value) 3474 } 3475 3476 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorStorageConfig_FieldPathArrayOfValues { 3477 fpaov := &MetricDescriptorStorageConfig_FieldTerminalPathArrayOfValues{MetricDescriptorStorageConfig_FieldTerminalPath: *fp} 3478 switch fp.selector { 3479 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3480 return &MetricDescriptorStorageConfig_FieldTerminalPathArrayOfValues{MetricDescriptorStorageConfig_FieldTerminalPath: *fp, values: values.([]bool)} 3481 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3482 return &MetricDescriptorStorageConfig_FieldTerminalPathArrayOfValues{MetricDescriptorStorageConfig_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 3483 default: 3484 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", fp.selector)) 3485 } 3486 return fpaov 3487 } 3488 3489 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3490 return fp.WithIArrayOfValues(values) 3491 } 3492 3493 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorStorageConfig_FieldPathArrayItemValue { 3494 switch fp.selector { 3495 default: 3496 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", fp.selector)) 3497 } 3498 } 3499 3500 func (fp *MetricDescriptorStorageConfig_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3501 return fp.WithIArrayItemValue(value) 3502 } 3503 3504 // MetricDescriptorStorageConfig_FieldPathValue allows storing values for StorageConfig fields according to their type 3505 type MetricDescriptorStorageConfig_FieldPathValue interface { 3506 MetricDescriptorStorageConfig_FieldPath 3507 gotenobject.FieldPathValue 3508 SetTo(target **MetricDescriptor_StorageConfig) 3509 CompareWith(*MetricDescriptor_StorageConfig) (cmp int, comparable bool) 3510 } 3511 3512 func ParseMetricDescriptorStorageConfig_FieldPathValue(pathStr, valueStr string) (MetricDescriptorStorageConfig_FieldPathValue, error) { 3513 fp, err := ParseMetricDescriptorStorageConfig_FieldPath(pathStr) 3514 if err != nil { 3515 return nil, err 3516 } 3517 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3518 if err != nil { 3519 return nil, status.Errorf(codes.InvalidArgument, "error parsing StorageConfig field path value from %s: %v", valueStr, err) 3520 } 3521 return fpv.(MetricDescriptorStorageConfig_FieldPathValue), nil 3522 } 3523 3524 func MustParseMetricDescriptorStorageConfig_FieldPathValue(pathStr, valueStr string) MetricDescriptorStorageConfig_FieldPathValue { 3525 fpv, err := ParseMetricDescriptorStorageConfig_FieldPathValue(pathStr, valueStr) 3526 if err != nil { 3527 panic(err) 3528 } 3529 return fpv 3530 } 3531 3532 type MetricDescriptorStorageConfig_FieldTerminalPathValue struct { 3533 MetricDescriptorStorageConfig_FieldTerminalPath 3534 value interface{} 3535 } 3536 3537 var _ MetricDescriptorStorageConfig_FieldPathValue = (*MetricDescriptorStorageConfig_FieldTerminalPathValue)(nil) 3538 3539 // GetRawValue returns raw value stored under selected path for 'StorageConfig' as interface{} 3540 func (fpv *MetricDescriptorStorageConfig_FieldTerminalPathValue) GetRawValue() interface{} { 3541 return fpv.value 3542 } 3543 func (fpv *MetricDescriptorStorageConfig_FieldTerminalPathValue) AsStoreRawPointsValue() (bool, bool) { 3544 res, ok := fpv.value.(bool) 3545 return res, ok 3546 } 3547 func (fpv *MetricDescriptorStorageConfig_FieldTerminalPathValue) AsMaxApValue() (*durationpb.Duration, bool) { 3548 res, ok := fpv.value.(*durationpb.Duration) 3549 return res, ok 3550 } 3551 3552 // SetTo stores value for selected field for object StorageConfig 3553 func (fpv *MetricDescriptorStorageConfig_FieldTerminalPathValue) SetTo(target **MetricDescriptor_StorageConfig) { 3554 if *target == nil { 3555 *target = new(MetricDescriptor_StorageConfig) 3556 } 3557 switch fpv.selector { 3558 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3559 (*target).StoreRawPoints = fpv.value.(bool) 3560 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3561 (*target).MaxAp = fpv.value.(*durationpb.Duration) 3562 default: 3563 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", fpv.selector)) 3564 } 3565 } 3566 3567 func (fpv *MetricDescriptorStorageConfig_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3568 typedObject := target.(*MetricDescriptor_StorageConfig) 3569 fpv.SetTo(&typedObject) 3570 } 3571 3572 // CompareWith compares value in the 'MetricDescriptorStorageConfig_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_StorageConfig'. 3573 func (fpv *MetricDescriptorStorageConfig_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_StorageConfig) (int, bool) { 3574 switch fpv.selector { 3575 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3576 leftValue := fpv.value.(bool) 3577 rightValue := source.GetStoreRawPoints() 3578 if (leftValue) == (rightValue) { 3579 return 0, true 3580 } else if !(leftValue) && (rightValue) { 3581 return -1, true 3582 } else { 3583 return 1, true 3584 } 3585 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3586 leftValue := fpv.value.(*durationpb.Duration) 3587 rightValue := source.GetMaxAp() 3588 if leftValue == nil { 3589 if rightValue != nil { 3590 return -1, true 3591 } 3592 return 0, true 3593 } 3594 if rightValue == nil { 3595 return 1, true 3596 } 3597 if leftValue.AsDuration() == rightValue.AsDuration() { 3598 return 0, true 3599 } else if leftValue.AsDuration() < rightValue.AsDuration() { 3600 return -1, true 3601 } else { 3602 return 1, true 3603 } 3604 default: 3605 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_StorageConfig: %d", fpv.selector)) 3606 } 3607 } 3608 3609 func (fpv *MetricDescriptorStorageConfig_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3610 return fpv.CompareWith(source.(*MetricDescriptor_StorageConfig)) 3611 } 3612 3613 // MetricDescriptorStorageConfig_FieldPathArrayItemValue allows storing single item in Path-specific values for StorageConfig according to their type 3614 // Present only for array (repeated) types. 3615 type MetricDescriptorStorageConfig_FieldPathArrayItemValue interface { 3616 gotenobject.FieldPathArrayItemValue 3617 MetricDescriptorStorageConfig_FieldPath 3618 ContainsValue(*MetricDescriptor_StorageConfig) bool 3619 } 3620 3621 // ParseMetricDescriptorStorageConfig_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3622 func ParseMetricDescriptorStorageConfig_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorStorageConfig_FieldPathArrayItemValue, error) { 3623 fp, err := ParseMetricDescriptorStorageConfig_FieldPath(pathStr) 3624 if err != nil { 3625 return nil, err 3626 } 3627 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3628 if err != nil { 3629 return nil, status.Errorf(codes.InvalidArgument, "error parsing StorageConfig field path array item value from %s: %v", valueStr, err) 3630 } 3631 return fpaiv.(MetricDescriptorStorageConfig_FieldPathArrayItemValue), nil 3632 } 3633 3634 func MustParseMetricDescriptorStorageConfig_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorStorageConfig_FieldPathArrayItemValue { 3635 fpaiv, err := ParseMetricDescriptorStorageConfig_FieldPathArrayItemValue(pathStr, valueStr) 3636 if err != nil { 3637 panic(err) 3638 } 3639 return fpaiv 3640 } 3641 3642 type MetricDescriptorStorageConfig_FieldTerminalPathArrayItemValue struct { 3643 MetricDescriptorStorageConfig_FieldTerminalPath 3644 value interface{} 3645 } 3646 3647 var _ MetricDescriptorStorageConfig_FieldPathArrayItemValue = (*MetricDescriptorStorageConfig_FieldTerminalPathArrayItemValue)(nil) 3648 3649 // GetRawValue returns stored element value for array in object MetricDescriptor_StorageConfig as interface{} 3650 func (fpaiv *MetricDescriptorStorageConfig_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3651 return fpaiv.value 3652 } 3653 3654 func (fpaiv *MetricDescriptorStorageConfig_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_StorageConfig) (interface{}, bool) { 3655 return nil, false 3656 } 3657 3658 func (fpaiv *MetricDescriptorStorageConfig_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3659 return fpaiv.GetSingle(source.(*MetricDescriptor_StorageConfig)) 3660 } 3661 3662 // Contains returns a boolean indicating if value that is being held is present in given 'StorageConfig' 3663 func (fpaiv *MetricDescriptorStorageConfig_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_StorageConfig) bool { 3664 slice := fpaiv.MetricDescriptorStorageConfig_FieldTerminalPath.Get(source) 3665 for _, v := range slice { 3666 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3667 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3668 return true 3669 } 3670 } else if reflect.DeepEqual(v, fpaiv.value) { 3671 return true 3672 } 3673 } 3674 return false 3675 } 3676 3677 // MetricDescriptorStorageConfig_FieldPathArrayOfValues allows storing slice of values for StorageConfig fields according to their type 3678 type MetricDescriptorStorageConfig_FieldPathArrayOfValues interface { 3679 gotenobject.FieldPathArrayOfValues 3680 MetricDescriptorStorageConfig_FieldPath 3681 } 3682 3683 func ParseMetricDescriptorStorageConfig_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorStorageConfig_FieldPathArrayOfValues, error) { 3684 fp, err := ParseMetricDescriptorStorageConfig_FieldPath(pathStr) 3685 if err != nil { 3686 return nil, err 3687 } 3688 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3689 if err != nil { 3690 return nil, status.Errorf(codes.InvalidArgument, "error parsing StorageConfig field path array of values from %s: %v", valuesStr, err) 3691 } 3692 return fpaov.(MetricDescriptorStorageConfig_FieldPathArrayOfValues), nil 3693 } 3694 3695 func MustParseMetricDescriptorStorageConfig_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorStorageConfig_FieldPathArrayOfValues { 3696 fpaov, err := ParseMetricDescriptorStorageConfig_FieldPathArrayOfValues(pathStr, valuesStr) 3697 if err != nil { 3698 panic(err) 3699 } 3700 return fpaov 3701 } 3702 3703 type MetricDescriptorStorageConfig_FieldTerminalPathArrayOfValues struct { 3704 MetricDescriptorStorageConfig_FieldTerminalPath 3705 values interface{} 3706 } 3707 3708 var _ MetricDescriptorStorageConfig_FieldPathArrayOfValues = (*MetricDescriptorStorageConfig_FieldTerminalPathArrayOfValues)(nil) 3709 3710 func (fpaov *MetricDescriptorStorageConfig_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3711 switch fpaov.selector { 3712 case MetricDescriptorStorageConfig_FieldPathSelectorStoreRawPoints: 3713 for _, v := range fpaov.values.([]bool) { 3714 values = append(values, v) 3715 } 3716 case MetricDescriptorStorageConfig_FieldPathSelectorMaxAp: 3717 for _, v := range fpaov.values.([]*durationpb.Duration) { 3718 values = append(values, v) 3719 } 3720 } 3721 return 3722 } 3723 func (fpaov *MetricDescriptorStorageConfig_FieldTerminalPathArrayOfValues) AsStoreRawPointsArrayOfValues() ([]bool, bool) { 3724 res, ok := fpaov.values.([]bool) 3725 return res, ok 3726 } 3727 func (fpaov *MetricDescriptorStorageConfig_FieldTerminalPathArrayOfValues) AsMaxApArrayOfValues() ([]*durationpb.Duration, bool) { 3728 res, ok := fpaov.values.([]*durationpb.Duration) 3729 return res, ok 3730 } 3731 3732 // FieldPath provides implementation to handle 3733 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3734 type MetricDescriptorBinaryIndices_FieldPath interface { 3735 gotenobject.FieldPath 3736 Selector() MetricDescriptorBinaryIndices_FieldPathSelector 3737 Get(source *MetricDescriptor_BinaryIndices) []interface{} 3738 GetSingle(source *MetricDescriptor_BinaryIndices) (interface{}, bool) 3739 ClearValue(item *MetricDescriptor_BinaryIndices) 3740 3741 // Those methods build corresponding MetricDescriptorBinaryIndices_FieldPathValue 3742 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3743 WithIValue(value interface{}) MetricDescriptorBinaryIndices_FieldPathValue 3744 WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndices_FieldPathArrayOfValues 3745 WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndices_FieldPathArrayItemValue 3746 } 3747 3748 type MetricDescriptorBinaryIndices_FieldPathSelector int32 3749 3750 const ( 3751 MetricDescriptorBinaryIndices_FieldPathSelectorByResources MetricDescriptorBinaryIndices_FieldPathSelector = 0 3752 MetricDescriptorBinaryIndices_FieldPathSelectorRegion MetricDescriptorBinaryIndices_FieldPathSelector = 1 3753 ) 3754 3755 func (s MetricDescriptorBinaryIndices_FieldPathSelector) String() string { 3756 switch s { 3757 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3758 return "by_resources" 3759 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 3760 return "region" 3761 default: 3762 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", s)) 3763 } 3764 } 3765 3766 func BuildMetricDescriptorBinaryIndices_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorBinaryIndices_FieldPath, error) { 3767 if len(fp) == 0 { 3768 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_BinaryIndices") 3769 } 3770 if len(fp) == 1 { 3771 switch fp[0] { 3772 case "by_resources", "byResources", "by-resources": 3773 return &MetricDescriptorBinaryIndices_FieldTerminalPath{selector: MetricDescriptorBinaryIndices_FieldPathSelectorByResources}, nil 3774 case "region": 3775 return &MetricDescriptorBinaryIndices_FieldTerminalPath{selector: MetricDescriptorBinaryIndices_FieldPathSelectorRegion}, nil 3776 } 3777 } else { 3778 switch fp[0] { 3779 case "by_resources", "byResources", "by-resources": 3780 if subpath, err := BuildMetricDescriptorBinaryIndicesByResourceType_FieldPath(fp[1:]); err != nil { 3781 return nil, err 3782 } else { 3783 return &MetricDescriptorBinaryIndices_FieldSubPath{selector: MetricDescriptorBinaryIndices_FieldPathSelectorByResources, subPath: subpath}, nil 3784 } 3785 } 3786 } 3787 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_BinaryIndices", fp) 3788 } 3789 3790 func ParseMetricDescriptorBinaryIndices_FieldPath(rawField string) (MetricDescriptorBinaryIndices_FieldPath, error) { 3791 fp, err := gotenobject.ParseRawFieldPath(rawField) 3792 if err != nil { 3793 return nil, err 3794 } 3795 return BuildMetricDescriptorBinaryIndices_FieldPath(fp) 3796 } 3797 3798 func MustParseMetricDescriptorBinaryIndices_FieldPath(rawField string) MetricDescriptorBinaryIndices_FieldPath { 3799 fp, err := ParseMetricDescriptorBinaryIndices_FieldPath(rawField) 3800 if err != nil { 3801 panic(err) 3802 } 3803 return fp 3804 } 3805 3806 type MetricDescriptorBinaryIndices_FieldTerminalPath struct { 3807 selector MetricDescriptorBinaryIndices_FieldPathSelector 3808 } 3809 3810 var _ MetricDescriptorBinaryIndices_FieldPath = (*MetricDescriptorBinaryIndices_FieldTerminalPath)(nil) 3811 3812 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) Selector() MetricDescriptorBinaryIndices_FieldPathSelector { 3813 return fp.selector 3814 } 3815 3816 // String returns path representation in proto convention 3817 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) String() string { 3818 return fp.selector.String() 3819 } 3820 3821 // JSONString returns path representation is JSON convention 3822 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) JSONString() string { 3823 return strcase.ToLowerCamel(fp.String()) 3824 } 3825 3826 // Get returns all values pointed by specific field from source MetricDescriptor_BinaryIndices 3827 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) Get(source *MetricDescriptor_BinaryIndices) (values []interface{}) { 3828 if source != nil { 3829 switch fp.selector { 3830 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3831 for _, value := range source.GetByResources() { 3832 values = append(values, value) 3833 } 3834 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 3835 values = append(values, source.Region) 3836 default: 3837 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fp.selector)) 3838 } 3839 } 3840 return 3841 } 3842 3843 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3844 return fp.Get(source.(*MetricDescriptor_BinaryIndices)) 3845 } 3846 3847 // GetSingle returns value pointed by specific field of from source MetricDescriptor_BinaryIndices 3848 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) GetSingle(source *MetricDescriptor_BinaryIndices) (interface{}, bool) { 3849 switch fp.selector { 3850 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3851 res := source.GetByResources() 3852 return res, res != nil 3853 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 3854 return source.GetRegion(), source != nil 3855 default: 3856 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fp.selector)) 3857 } 3858 } 3859 3860 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3861 return fp.GetSingle(source.(*MetricDescriptor_BinaryIndices)) 3862 } 3863 3864 // GetDefault returns a default value of the field type 3865 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) GetDefault() interface{} { 3866 switch fp.selector { 3867 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3868 return ([]*MetricDescriptor_BinaryIndices_ByResourceType)(nil) 3869 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 3870 return "" 3871 default: 3872 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fp.selector)) 3873 } 3874 } 3875 3876 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) ClearValue(item *MetricDescriptor_BinaryIndices) { 3877 if item != nil { 3878 switch fp.selector { 3879 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3880 item.ByResources = nil 3881 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 3882 item.Region = "" 3883 default: 3884 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fp.selector)) 3885 } 3886 } 3887 } 3888 3889 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3890 fp.ClearValue(item.(*MetricDescriptor_BinaryIndices)) 3891 } 3892 3893 // IsLeaf - whether field path is holds simple value 3894 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) IsLeaf() bool { 3895 return fp.selector == MetricDescriptorBinaryIndices_FieldPathSelectorRegion 3896 } 3897 3898 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3899 return []gotenobject.FieldPath{fp} 3900 } 3901 3902 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorBinaryIndices_FieldPathValue { 3903 switch fp.selector { 3904 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3905 return &MetricDescriptorBinaryIndices_FieldTerminalPathValue{MetricDescriptorBinaryIndices_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_BinaryIndices_ByResourceType)} 3906 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 3907 return &MetricDescriptorBinaryIndices_FieldTerminalPathValue{MetricDescriptorBinaryIndices_FieldTerminalPath: *fp, value: value.(string)} 3908 default: 3909 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fp.selector)) 3910 } 3911 } 3912 3913 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3914 return fp.WithIValue(value) 3915 } 3916 3917 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndices_FieldPathArrayOfValues { 3918 fpaov := &MetricDescriptorBinaryIndices_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndices_FieldTerminalPath: *fp} 3919 switch fp.selector { 3920 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3921 return &MetricDescriptorBinaryIndices_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndices_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_BinaryIndices_ByResourceType)} 3922 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 3923 return &MetricDescriptorBinaryIndices_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndices_FieldTerminalPath: *fp, values: values.([]string)} 3924 default: 3925 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fp.selector)) 3926 } 3927 return fpaov 3928 } 3929 3930 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3931 return fp.WithIArrayOfValues(values) 3932 } 3933 3934 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndices_FieldPathArrayItemValue { 3935 switch fp.selector { 3936 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3937 return &MetricDescriptorBinaryIndices_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_BinaryIndices_ByResourceType)} 3938 default: 3939 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fp.selector)) 3940 } 3941 } 3942 3943 func (fp *MetricDescriptorBinaryIndices_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3944 return fp.WithIArrayItemValue(value) 3945 } 3946 3947 type MetricDescriptorBinaryIndices_FieldSubPath struct { 3948 selector MetricDescriptorBinaryIndices_FieldPathSelector 3949 subPath gotenobject.FieldPath 3950 } 3951 3952 var _ MetricDescriptorBinaryIndices_FieldPath = (*MetricDescriptorBinaryIndices_FieldSubPath)(nil) 3953 3954 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) Selector() MetricDescriptorBinaryIndices_FieldPathSelector { 3955 return fps.selector 3956 } 3957 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) AsByResourcesSubPath() (MetricDescriptorBinaryIndicesByResourceType_FieldPath, bool) { 3958 res, ok := fps.subPath.(MetricDescriptorBinaryIndicesByResourceType_FieldPath) 3959 return res, ok 3960 } 3961 3962 // String returns path representation in proto convention 3963 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) String() string { 3964 return fps.selector.String() + "." + fps.subPath.String() 3965 } 3966 3967 // JSONString returns path representation is JSON convention 3968 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) JSONString() string { 3969 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 3970 } 3971 3972 // Get returns all values pointed by selected field from source MetricDescriptor_BinaryIndices 3973 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) Get(source *MetricDescriptor_BinaryIndices) (values []interface{}) { 3974 switch fps.selector { 3975 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3976 for _, item := range source.GetByResources() { 3977 values = append(values, fps.subPath.GetRaw(item)...) 3978 } 3979 default: 3980 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fps.selector)) 3981 } 3982 return 3983 } 3984 3985 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) GetRaw(source proto.Message) []interface{} { 3986 return fps.Get(source.(*MetricDescriptor_BinaryIndices)) 3987 } 3988 3989 // GetSingle returns value of selected field from source MetricDescriptor_BinaryIndices 3990 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) GetSingle(source *MetricDescriptor_BinaryIndices) (interface{}, bool) { 3991 switch fps.selector { 3992 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 3993 if len(source.GetByResources()) == 0 { 3994 return nil, false 3995 } 3996 return fps.subPath.GetSingleRaw(source.GetByResources()[0]) 3997 default: 3998 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fps.selector)) 3999 } 4000 } 4001 4002 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4003 return fps.GetSingle(source.(*MetricDescriptor_BinaryIndices)) 4004 } 4005 4006 // GetDefault returns a default value of the field type 4007 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) GetDefault() interface{} { 4008 return fps.subPath.GetDefault() 4009 } 4010 4011 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) ClearValue(item *MetricDescriptor_BinaryIndices) { 4012 if item != nil { 4013 switch fps.selector { 4014 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 4015 for _, subItem := range item.ByResources { 4016 fps.subPath.ClearValueRaw(subItem) 4017 } 4018 default: 4019 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fps.selector)) 4020 } 4021 } 4022 } 4023 4024 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) ClearValueRaw(item proto.Message) { 4025 fps.ClearValue(item.(*MetricDescriptor_BinaryIndices)) 4026 } 4027 4028 // IsLeaf - whether field path is holds simple value 4029 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) IsLeaf() bool { 4030 return fps.subPath.IsLeaf() 4031 } 4032 4033 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4034 iPaths := []gotenobject.FieldPath{&MetricDescriptorBinaryIndices_FieldTerminalPath{selector: fps.selector}} 4035 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 4036 return iPaths 4037 } 4038 4039 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) WithIValue(value interface{}) MetricDescriptorBinaryIndices_FieldPathValue { 4040 return &MetricDescriptorBinaryIndices_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 4041 } 4042 4043 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4044 return fps.WithIValue(value) 4045 } 4046 4047 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndices_FieldPathArrayOfValues { 4048 return &MetricDescriptorBinaryIndices_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 4049 } 4050 4051 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4052 return fps.WithIArrayOfValues(values) 4053 } 4054 4055 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndices_FieldPathArrayItemValue { 4056 return &MetricDescriptorBinaryIndices_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 4057 } 4058 4059 func (fps *MetricDescriptorBinaryIndices_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4060 return fps.WithIArrayItemValue(value) 4061 } 4062 4063 // MetricDescriptorBinaryIndices_FieldPathValue allows storing values for BinaryIndices fields according to their type 4064 type MetricDescriptorBinaryIndices_FieldPathValue interface { 4065 MetricDescriptorBinaryIndices_FieldPath 4066 gotenobject.FieldPathValue 4067 SetTo(target **MetricDescriptor_BinaryIndices) 4068 CompareWith(*MetricDescriptor_BinaryIndices) (cmp int, comparable bool) 4069 } 4070 4071 func ParseMetricDescriptorBinaryIndices_FieldPathValue(pathStr, valueStr string) (MetricDescriptorBinaryIndices_FieldPathValue, error) { 4072 fp, err := ParseMetricDescriptorBinaryIndices_FieldPath(pathStr) 4073 if err != nil { 4074 return nil, err 4075 } 4076 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4077 if err != nil { 4078 return nil, status.Errorf(codes.InvalidArgument, "error parsing BinaryIndices field path value from %s: %v", valueStr, err) 4079 } 4080 return fpv.(MetricDescriptorBinaryIndices_FieldPathValue), nil 4081 } 4082 4083 func MustParseMetricDescriptorBinaryIndices_FieldPathValue(pathStr, valueStr string) MetricDescriptorBinaryIndices_FieldPathValue { 4084 fpv, err := ParseMetricDescriptorBinaryIndices_FieldPathValue(pathStr, valueStr) 4085 if err != nil { 4086 panic(err) 4087 } 4088 return fpv 4089 } 4090 4091 type MetricDescriptorBinaryIndices_FieldTerminalPathValue struct { 4092 MetricDescriptorBinaryIndices_FieldTerminalPath 4093 value interface{} 4094 } 4095 4096 var _ MetricDescriptorBinaryIndices_FieldPathValue = (*MetricDescriptorBinaryIndices_FieldTerminalPathValue)(nil) 4097 4098 // GetRawValue returns raw value stored under selected path for 'BinaryIndices' as interface{} 4099 func (fpv *MetricDescriptorBinaryIndices_FieldTerminalPathValue) GetRawValue() interface{} { 4100 return fpv.value 4101 } 4102 func (fpv *MetricDescriptorBinaryIndices_FieldTerminalPathValue) AsByResourcesValue() ([]*MetricDescriptor_BinaryIndices_ByResourceType, bool) { 4103 res, ok := fpv.value.([]*MetricDescriptor_BinaryIndices_ByResourceType) 4104 return res, ok 4105 } 4106 func (fpv *MetricDescriptorBinaryIndices_FieldTerminalPathValue) AsRegionValue() (string, bool) { 4107 res, ok := fpv.value.(string) 4108 return res, ok 4109 } 4110 4111 // SetTo stores value for selected field for object BinaryIndices 4112 func (fpv *MetricDescriptorBinaryIndices_FieldTerminalPathValue) SetTo(target **MetricDescriptor_BinaryIndices) { 4113 if *target == nil { 4114 *target = new(MetricDescriptor_BinaryIndices) 4115 } 4116 switch fpv.selector { 4117 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 4118 (*target).ByResources = fpv.value.([]*MetricDescriptor_BinaryIndices_ByResourceType) 4119 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 4120 (*target).Region = fpv.value.(string) 4121 default: 4122 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fpv.selector)) 4123 } 4124 } 4125 4126 func (fpv *MetricDescriptorBinaryIndices_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4127 typedObject := target.(*MetricDescriptor_BinaryIndices) 4128 fpv.SetTo(&typedObject) 4129 } 4130 4131 // CompareWith compares value in the 'MetricDescriptorBinaryIndices_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_BinaryIndices'. 4132 func (fpv *MetricDescriptorBinaryIndices_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_BinaryIndices) (int, bool) { 4133 switch fpv.selector { 4134 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 4135 return 0, false 4136 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 4137 leftValue := fpv.value.(string) 4138 rightValue := source.GetRegion() 4139 if (leftValue) == (rightValue) { 4140 return 0, true 4141 } else if (leftValue) < (rightValue) { 4142 return -1, true 4143 } else { 4144 return 1, true 4145 } 4146 default: 4147 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fpv.selector)) 4148 } 4149 } 4150 4151 func (fpv *MetricDescriptorBinaryIndices_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4152 return fpv.CompareWith(source.(*MetricDescriptor_BinaryIndices)) 4153 } 4154 4155 type MetricDescriptorBinaryIndices_FieldSubPathValue struct { 4156 MetricDescriptorBinaryIndices_FieldPath 4157 subPathValue gotenobject.FieldPathValue 4158 } 4159 4160 var _ MetricDescriptorBinaryIndices_FieldPathValue = (*MetricDescriptorBinaryIndices_FieldSubPathValue)(nil) 4161 4162 func (fpvs *MetricDescriptorBinaryIndices_FieldSubPathValue) AsByResourcesPathValue() (MetricDescriptorBinaryIndicesByResourceType_FieldPathValue, bool) { 4163 res, ok := fpvs.subPathValue.(MetricDescriptorBinaryIndicesByResourceType_FieldPathValue) 4164 return res, ok 4165 } 4166 4167 func (fpvs *MetricDescriptorBinaryIndices_FieldSubPathValue) SetTo(target **MetricDescriptor_BinaryIndices) { 4168 if *target == nil { 4169 *target = new(MetricDescriptor_BinaryIndices) 4170 } 4171 switch fpvs.Selector() { 4172 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 4173 panic("FieldPath setter is unsupported for array subpaths") 4174 default: 4175 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fpvs.Selector())) 4176 } 4177 } 4178 4179 func (fpvs *MetricDescriptorBinaryIndices_FieldSubPathValue) SetToRaw(target proto.Message) { 4180 typedObject := target.(*MetricDescriptor_BinaryIndices) 4181 fpvs.SetTo(&typedObject) 4182 } 4183 4184 func (fpvs *MetricDescriptorBinaryIndices_FieldSubPathValue) GetRawValue() interface{} { 4185 return fpvs.subPathValue.GetRawValue() 4186 } 4187 4188 func (fpvs *MetricDescriptorBinaryIndices_FieldSubPathValue) CompareWith(source *MetricDescriptor_BinaryIndices) (int, bool) { 4189 switch fpvs.Selector() { 4190 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 4191 return 0, false // repeated field 4192 default: 4193 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fpvs.Selector())) 4194 } 4195 } 4196 4197 func (fpvs *MetricDescriptorBinaryIndices_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4198 return fpvs.CompareWith(source.(*MetricDescriptor_BinaryIndices)) 4199 } 4200 4201 // MetricDescriptorBinaryIndices_FieldPathArrayItemValue allows storing single item in Path-specific values for BinaryIndices according to their type 4202 // Present only for array (repeated) types. 4203 type MetricDescriptorBinaryIndices_FieldPathArrayItemValue interface { 4204 gotenobject.FieldPathArrayItemValue 4205 MetricDescriptorBinaryIndices_FieldPath 4206 ContainsValue(*MetricDescriptor_BinaryIndices) bool 4207 } 4208 4209 // ParseMetricDescriptorBinaryIndices_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4210 func ParseMetricDescriptorBinaryIndices_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorBinaryIndices_FieldPathArrayItemValue, error) { 4211 fp, err := ParseMetricDescriptorBinaryIndices_FieldPath(pathStr) 4212 if err != nil { 4213 return nil, err 4214 } 4215 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4216 if err != nil { 4217 return nil, status.Errorf(codes.InvalidArgument, "error parsing BinaryIndices field path array item value from %s: %v", valueStr, err) 4218 } 4219 return fpaiv.(MetricDescriptorBinaryIndices_FieldPathArrayItemValue), nil 4220 } 4221 4222 func MustParseMetricDescriptorBinaryIndices_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorBinaryIndices_FieldPathArrayItemValue { 4223 fpaiv, err := ParseMetricDescriptorBinaryIndices_FieldPathArrayItemValue(pathStr, valueStr) 4224 if err != nil { 4225 panic(err) 4226 } 4227 return fpaiv 4228 } 4229 4230 type MetricDescriptorBinaryIndices_FieldTerminalPathArrayItemValue struct { 4231 MetricDescriptorBinaryIndices_FieldTerminalPath 4232 value interface{} 4233 } 4234 4235 var _ MetricDescriptorBinaryIndices_FieldPathArrayItemValue = (*MetricDescriptorBinaryIndices_FieldTerminalPathArrayItemValue)(nil) 4236 4237 // GetRawValue returns stored element value for array in object MetricDescriptor_BinaryIndices as interface{} 4238 func (fpaiv *MetricDescriptorBinaryIndices_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4239 return fpaiv.value 4240 } 4241 func (fpaiv *MetricDescriptorBinaryIndices_FieldTerminalPathArrayItemValue) AsByResourcesItemValue() (*MetricDescriptor_BinaryIndices_ByResourceType, bool) { 4242 res, ok := fpaiv.value.(*MetricDescriptor_BinaryIndices_ByResourceType) 4243 return res, ok 4244 } 4245 4246 func (fpaiv *MetricDescriptorBinaryIndices_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_BinaryIndices) (interface{}, bool) { 4247 return nil, false 4248 } 4249 4250 func (fpaiv *MetricDescriptorBinaryIndices_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4251 return fpaiv.GetSingle(source.(*MetricDescriptor_BinaryIndices)) 4252 } 4253 4254 // Contains returns a boolean indicating if value that is being held is present in given 'BinaryIndices' 4255 func (fpaiv *MetricDescriptorBinaryIndices_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_BinaryIndices) bool { 4256 slice := fpaiv.MetricDescriptorBinaryIndices_FieldTerminalPath.Get(source) 4257 for _, v := range slice { 4258 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4259 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4260 return true 4261 } 4262 } else if reflect.DeepEqual(v, fpaiv.value) { 4263 return true 4264 } 4265 } 4266 return false 4267 } 4268 4269 type MetricDescriptorBinaryIndices_FieldSubPathArrayItemValue struct { 4270 MetricDescriptorBinaryIndices_FieldPath 4271 subPathItemValue gotenobject.FieldPathArrayItemValue 4272 } 4273 4274 // GetRawValue returns stored array item value 4275 func (fpaivs *MetricDescriptorBinaryIndices_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 4276 return fpaivs.subPathItemValue.GetRawItemValue() 4277 } 4278 func (fpaivs *MetricDescriptorBinaryIndices_FieldSubPathArrayItemValue) AsByResourcesPathItemValue() (MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue, bool) { 4279 res, ok := fpaivs.subPathItemValue.(MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue) 4280 return res, ok 4281 } 4282 4283 // Contains returns a boolean indicating if value that is being held is present in given 'BinaryIndices' 4284 func (fpaivs *MetricDescriptorBinaryIndices_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor_BinaryIndices) bool { 4285 switch fpaivs.Selector() { 4286 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 4287 return false // repeated/map field 4288 default: 4289 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices: %d", fpaivs.Selector())) 4290 } 4291 } 4292 4293 // MetricDescriptorBinaryIndices_FieldPathArrayOfValues allows storing slice of values for BinaryIndices fields according to their type 4294 type MetricDescriptorBinaryIndices_FieldPathArrayOfValues interface { 4295 gotenobject.FieldPathArrayOfValues 4296 MetricDescriptorBinaryIndices_FieldPath 4297 } 4298 4299 func ParseMetricDescriptorBinaryIndices_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorBinaryIndices_FieldPathArrayOfValues, error) { 4300 fp, err := ParseMetricDescriptorBinaryIndices_FieldPath(pathStr) 4301 if err != nil { 4302 return nil, err 4303 } 4304 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4305 if err != nil { 4306 return nil, status.Errorf(codes.InvalidArgument, "error parsing BinaryIndices field path array of values from %s: %v", valuesStr, err) 4307 } 4308 return fpaov.(MetricDescriptorBinaryIndices_FieldPathArrayOfValues), nil 4309 } 4310 4311 func MustParseMetricDescriptorBinaryIndices_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorBinaryIndices_FieldPathArrayOfValues { 4312 fpaov, err := ParseMetricDescriptorBinaryIndices_FieldPathArrayOfValues(pathStr, valuesStr) 4313 if err != nil { 4314 panic(err) 4315 } 4316 return fpaov 4317 } 4318 4319 type MetricDescriptorBinaryIndices_FieldTerminalPathArrayOfValues struct { 4320 MetricDescriptorBinaryIndices_FieldTerminalPath 4321 values interface{} 4322 } 4323 4324 var _ MetricDescriptorBinaryIndices_FieldPathArrayOfValues = (*MetricDescriptorBinaryIndices_FieldTerminalPathArrayOfValues)(nil) 4325 4326 func (fpaov *MetricDescriptorBinaryIndices_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4327 switch fpaov.selector { 4328 case MetricDescriptorBinaryIndices_FieldPathSelectorByResources: 4329 for _, v := range fpaov.values.([][]*MetricDescriptor_BinaryIndices_ByResourceType) { 4330 values = append(values, v) 4331 } 4332 case MetricDescriptorBinaryIndices_FieldPathSelectorRegion: 4333 for _, v := range fpaov.values.([]string) { 4334 values = append(values, v) 4335 } 4336 } 4337 return 4338 } 4339 func (fpaov *MetricDescriptorBinaryIndices_FieldTerminalPathArrayOfValues) AsByResourcesArrayOfValues() ([][]*MetricDescriptor_BinaryIndices_ByResourceType, bool) { 4340 res, ok := fpaov.values.([][]*MetricDescriptor_BinaryIndices_ByResourceType) 4341 return res, ok 4342 } 4343 func (fpaov *MetricDescriptorBinaryIndices_FieldTerminalPathArrayOfValues) AsRegionArrayOfValues() ([]string, bool) { 4344 res, ok := fpaov.values.([]string) 4345 return res, ok 4346 } 4347 4348 type MetricDescriptorBinaryIndices_FieldSubPathArrayOfValues struct { 4349 MetricDescriptorBinaryIndices_FieldPath 4350 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 4351 } 4352 4353 var _ MetricDescriptorBinaryIndices_FieldPathArrayOfValues = (*MetricDescriptorBinaryIndices_FieldSubPathArrayOfValues)(nil) 4354 4355 func (fpsaov *MetricDescriptorBinaryIndices_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 4356 return fpsaov.subPathArrayOfValues.GetRawValues() 4357 } 4358 func (fpsaov *MetricDescriptorBinaryIndices_FieldSubPathArrayOfValues) AsByResourcesPathArrayOfValues() (MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues, bool) { 4359 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues) 4360 return res, ok 4361 } 4362 4363 // FieldPath provides implementation to handle 4364 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 4365 type MetricDescriptorIndexSpecIndex_FieldPath interface { 4366 gotenobject.FieldPath 4367 Selector() MetricDescriptorIndexSpecIndex_FieldPathSelector 4368 Get(source *MetricDescriptor_IndexSpec_Index) []interface{} 4369 GetSingle(source *MetricDescriptor_IndexSpec_Index) (interface{}, bool) 4370 ClearValue(item *MetricDescriptor_IndexSpec_Index) 4371 4372 // Those methods build corresponding MetricDescriptorIndexSpecIndex_FieldPathValue 4373 // (or array of values) and holds passed value. Panics if injected type is incorrect. 4374 WithIValue(value interface{}) MetricDescriptorIndexSpecIndex_FieldPathValue 4375 WithIArrayOfValues(values interface{}) MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues 4376 WithIArrayItemValue(value interface{}) MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue 4377 } 4378 4379 type MetricDescriptorIndexSpecIndex_FieldPathSelector int32 4380 4381 const ( 4382 MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels MetricDescriptorIndexSpecIndex_FieldPathSelector = 0 4383 ) 4384 4385 func (s MetricDescriptorIndexSpecIndex_FieldPathSelector) String() string { 4386 switch s { 4387 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4388 return "promoted_labels" 4389 default: 4390 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", s)) 4391 } 4392 } 4393 4394 func BuildMetricDescriptorIndexSpecIndex_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndexSpecIndex_FieldPath, error) { 4395 if len(fp) == 0 { 4396 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_IndexSpec_Index") 4397 } 4398 if len(fp) == 1 { 4399 switch fp[0] { 4400 case "promoted_labels", "promotedLabels", "promoted-labels": 4401 return &MetricDescriptorIndexSpecIndex_FieldTerminalPath{selector: MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels}, nil 4402 } 4403 } 4404 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_IndexSpec_Index", fp) 4405 } 4406 4407 func ParseMetricDescriptorIndexSpecIndex_FieldPath(rawField string) (MetricDescriptorIndexSpecIndex_FieldPath, error) { 4408 fp, err := gotenobject.ParseRawFieldPath(rawField) 4409 if err != nil { 4410 return nil, err 4411 } 4412 return BuildMetricDescriptorIndexSpecIndex_FieldPath(fp) 4413 } 4414 4415 func MustParseMetricDescriptorIndexSpecIndex_FieldPath(rawField string) MetricDescriptorIndexSpecIndex_FieldPath { 4416 fp, err := ParseMetricDescriptorIndexSpecIndex_FieldPath(rawField) 4417 if err != nil { 4418 panic(err) 4419 } 4420 return fp 4421 } 4422 4423 type MetricDescriptorIndexSpecIndex_FieldTerminalPath struct { 4424 selector MetricDescriptorIndexSpecIndex_FieldPathSelector 4425 } 4426 4427 var _ MetricDescriptorIndexSpecIndex_FieldPath = (*MetricDescriptorIndexSpecIndex_FieldTerminalPath)(nil) 4428 4429 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) Selector() MetricDescriptorIndexSpecIndex_FieldPathSelector { 4430 return fp.selector 4431 } 4432 4433 // String returns path representation in proto convention 4434 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) String() string { 4435 return fp.selector.String() 4436 } 4437 4438 // JSONString returns path representation is JSON convention 4439 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) JSONString() string { 4440 return strcase.ToLowerCamel(fp.String()) 4441 } 4442 4443 // Get returns all values pointed by specific field from source MetricDescriptor_IndexSpec_Index 4444 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) Get(source *MetricDescriptor_IndexSpec_Index) (values []interface{}) { 4445 if source != nil { 4446 switch fp.selector { 4447 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4448 for _, value := range source.GetPromotedLabels() { 4449 values = append(values, value) 4450 } 4451 default: 4452 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", fp.selector)) 4453 } 4454 } 4455 return 4456 } 4457 4458 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 4459 return fp.Get(source.(*MetricDescriptor_IndexSpec_Index)) 4460 } 4461 4462 // GetSingle returns value pointed by specific field of from source MetricDescriptor_IndexSpec_Index 4463 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) GetSingle(source *MetricDescriptor_IndexSpec_Index) (interface{}, bool) { 4464 switch fp.selector { 4465 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4466 res := source.GetPromotedLabels() 4467 return res, res != nil 4468 default: 4469 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", fp.selector)) 4470 } 4471 } 4472 4473 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4474 return fp.GetSingle(source.(*MetricDescriptor_IndexSpec_Index)) 4475 } 4476 4477 // GetDefault returns a default value of the field type 4478 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) GetDefault() interface{} { 4479 switch fp.selector { 4480 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4481 return ([]string)(nil) 4482 default: 4483 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", fp.selector)) 4484 } 4485 } 4486 4487 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) ClearValue(item *MetricDescriptor_IndexSpec_Index) { 4488 if item != nil { 4489 switch fp.selector { 4490 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4491 item.PromotedLabels = nil 4492 default: 4493 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", fp.selector)) 4494 } 4495 } 4496 } 4497 4498 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) ClearValueRaw(item proto.Message) { 4499 fp.ClearValue(item.(*MetricDescriptor_IndexSpec_Index)) 4500 } 4501 4502 // IsLeaf - whether field path is holds simple value 4503 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) IsLeaf() bool { 4504 return fp.selector == MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels 4505 } 4506 4507 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4508 return []gotenobject.FieldPath{fp} 4509 } 4510 4511 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndexSpecIndex_FieldPathValue { 4512 switch fp.selector { 4513 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4514 return &MetricDescriptorIndexSpecIndex_FieldTerminalPathValue{MetricDescriptorIndexSpecIndex_FieldTerminalPath: *fp, value: value.([]string)} 4515 default: 4516 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", fp.selector)) 4517 } 4518 } 4519 4520 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4521 return fp.WithIValue(value) 4522 } 4523 4524 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues { 4525 fpaov := &MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayOfValues{MetricDescriptorIndexSpecIndex_FieldTerminalPath: *fp} 4526 switch fp.selector { 4527 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4528 return &MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayOfValues{MetricDescriptorIndexSpecIndex_FieldTerminalPath: *fp, values: values.([][]string)} 4529 default: 4530 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", fp.selector)) 4531 } 4532 return fpaov 4533 } 4534 4535 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4536 return fp.WithIArrayOfValues(values) 4537 } 4538 4539 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue { 4540 switch fp.selector { 4541 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4542 return &MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayItemValue{MetricDescriptorIndexSpecIndex_FieldTerminalPath: *fp, value: value.(string)} 4543 default: 4544 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", fp.selector)) 4545 } 4546 } 4547 4548 func (fp *MetricDescriptorIndexSpecIndex_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4549 return fp.WithIArrayItemValue(value) 4550 } 4551 4552 // MetricDescriptorIndexSpecIndex_FieldPathValue allows storing values for Index fields according to their type 4553 type MetricDescriptorIndexSpecIndex_FieldPathValue interface { 4554 MetricDescriptorIndexSpecIndex_FieldPath 4555 gotenobject.FieldPathValue 4556 SetTo(target **MetricDescriptor_IndexSpec_Index) 4557 CompareWith(*MetricDescriptor_IndexSpec_Index) (cmp int, comparable bool) 4558 } 4559 4560 func ParseMetricDescriptorIndexSpecIndex_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndexSpecIndex_FieldPathValue, error) { 4561 fp, err := ParseMetricDescriptorIndexSpecIndex_FieldPath(pathStr) 4562 if err != nil { 4563 return nil, err 4564 } 4565 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4566 if err != nil { 4567 return nil, status.Errorf(codes.InvalidArgument, "error parsing Index field path value from %s: %v", valueStr, err) 4568 } 4569 return fpv.(MetricDescriptorIndexSpecIndex_FieldPathValue), nil 4570 } 4571 4572 func MustParseMetricDescriptorIndexSpecIndex_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndexSpecIndex_FieldPathValue { 4573 fpv, err := ParseMetricDescriptorIndexSpecIndex_FieldPathValue(pathStr, valueStr) 4574 if err != nil { 4575 panic(err) 4576 } 4577 return fpv 4578 } 4579 4580 type MetricDescriptorIndexSpecIndex_FieldTerminalPathValue struct { 4581 MetricDescriptorIndexSpecIndex_FieldTerminalPath 4582 value interface{} 4583 } 4584 4585 var _ MetricDescriptorIndexSpecIndex_FieldPathValue = (*MetricDescriptorIndexSpecIndex_FieldTerminalPathValue)(nil) 4586 4587 // GetRawValue returns raw value stored under selected path for 'Index' as interface{} 4588 func (fpv *MetricDescriptorIndexSpecIndex_FieldTerminalPathValue) GetRawValue() interface{} { 4589 return fpv.value 4590 } 4591 func (fpv *MetricDescriptorIndexSpecIndex_FieldTerminalPathValue) AsPromotedLabelsValue() ([]string, bool) { 4592 res, ok := fpv.value.([]string) 4593 return res, ok 4594 } 4595 4596 // SetTo stores value for selected field for object Index 4597 func (fpv *MetricDescriptorIndexSpecIndex_FieldTerminalPathValue) SetTo(target **MetricDescriptor_IndexSpec_Index) { 4598 if *target == nil { 4599 *target = new(MetricDescriptor_IndexSpec_Index) 4600 } 4601 switch fpv.selector { 4602 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4603 (*target).PromotedLabels = fpv.value.([]string) 4604 default: 4605 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", fpv.selector)) 4606 } 4607 } 4608 4609 func (fpv *MetricDescriptorIndexSpecIndex_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4610 typedObject := target.(*MetricDescriptor_IndexSpec_Index) 4611 fpv.SetTo(&typedObject) 4612 } 4613 4614 // CompareWith compares value in the 'MetricDescriptorIndexSpecIndex_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_IndexSpec_Index'. 4615 func (fpv *MetricDescriptorIndexSpecIndex_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_IndexSpec_Index) (int, bool) { 4616 switch fpv.selector { 4617 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4618 return 0, false 4619 default: 4620 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_Index: %d", fpv.selector)) 4621 } 4622 } 4623 4624 func (fpv *MetricDescriptorIndexSpecIndex_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4625 return fpv.CompareWith(source.(*MetricDescriptor_IndexSpec_Index)) 4626 } 4627 4628 // MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue allows storing single item in Path-specific values for Index according to their type 4629 // Present only for array (repeated) types. 4630 type MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue interface { 4631 gotenobject.FieldPathArrayItemValue 4632 MetricDescriptorIndexSpecIndex_FieldPath 4633 ContainsValue(*MetricDescriptor_IndexSpec_Index) bool 4634 } 4635 4636 // ParseMetricDescriptorIndexSpecIndex_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4637 func ParseMetricDescriptorIndexSpecIndex_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue, error) { 4638 fp, err := ParseMetricDescriptorIndexSpecIndex_FieldPath(pathStr) 4639 if err != nil { 4640 return nil, err 4641 } 4642 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4643 if err != nil { 4644 return nil, status.Errorf(codes.InvalidArgument, "error parsing Index field path array item value from %s: %v", valueStr, err) 4645 } 4646 return fpaiv.(MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue), nil 4647 } 4648 4649 func MustParseMetricDescriptorIndexSpecIndex_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue { 4650 fpaiv, err := ParseMetricDescriptorIndexSpecIndex_FieldPathArrayItemValue(pathStr, valueStr) 4651 if err != nil { 4652 panic(err) 4653 } 4654 return fpaiv 4655 } 4656 4657 type MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayItemValue struct { 4658 MetricDescriptorIndexSpecIndex_FieldTerminalPath 4659 value interface{} 4660 } 4661 4662 var _ MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue = (*MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayItemValue)(nil) 4663 4664 // GetRawValue returns stored element value for array in object MetricDescriptor_IndexSpec_Index as interface{} 4665 func (fpaiv *MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4666 return fpaiv.value 4667 } 4668 func (fpaiv *MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayItemValue) AsPromotedLabelsItemValue() (string, bool) { 4669 res, ok := fpaiv.value.(string) 4670 return res, ok 4671 } 4672 4673 func (fpaiv *MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_IndexSpec_Index) (interface{}, bool) { 4674 return nil, false 4675 } 4676 4677 func (fpaiv *MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4678 return fpaiv.GetSingle(source.(*MetricDescriptor_IndexSpec_Index)) 4679 } 4680 4681 // Contains returns a boolean indicating if value that is being held is present in given 'Index' 4682 func (fpaiv *MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_IndexSpec_Index) bool { 4683 slice := fpaiv.MetricDescriptorIndexSpecIndex_FieldTerminalPath.Get(source) 4684 for _, v := range slice { 4685 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4686 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4687 return true 4688 } 4689 } else if reflect.DeepEqual(v, fpaiv.value) { 4690 return true 4691 } 4692 } 4693 return false 4694 } 4695 4696 // MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues allows storing slice of values for Index fields according to their type 4697 type MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues interface { 4698 gotenobject.FieldPathArrayOfValues 4699 MetricDescriptorIndexSpecIndex_FieldPath 4700 } 4701 4702 func ParseMetricDescriptorIndexSpecIndex_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues, error) { 4703 fp, err := ParseMetricDescriptorIndexSpecIndex_FieldPath(pathStr) 4704 if err != nil { 4705 return nil, err 4706 } 4707 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4708 if err != nil { 4709 return nil, status.Errorf(codes.InvalidArgument, "error parsing Index field path array of values from %s: %v", valuesStr, err) 4710 } 4711 return fpaov.(MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues), nil 4712 } 4713 4714 func MustParseMetricDescriptorIndexSpecIndex_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues { 4715 fpaov, err := ParseMetricDescriptorIndexSpecIndex_FieldPathArrayOfValues(pathStr, valuesStr) 4716 if err != nil { 4717 panic(err) 4718 } 4719 return fpaov 4720 } 4721 4722 type MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayOfValues struct { 4723 MetricDescriptorIndexSpecIndex_FieldTerminalPath 4724 values interface{} 4725 } 4726 4727 var _ MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues = (*MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayOfValues)(nil) 4728 4729 func (fpaov *MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4730 switch fpaov.selector { 4731 case MetricDescriptorIndexSpecIndex_FieldPathSelectorPromotedLabels: 4732 for _, v := range fpaov.values.([][]string) { 4733 values = append(values, v) 4734 } 4735 } 4736 return 4737 } 4738 func (fpaov *MetricDescriptorIndexSpecIndex_FieldTerminalPathArrayOfValues) AsPromotedLabelsArrayOfValues() ([][]string, bool) { 4739 res, ok := fpaov.values.([][]string) 4740 return res, ok 4741 } 4742 4743 // FieldPath provides implementation to handle 4744 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 4745 type MetricDescriptorIndexSpecPerMonitoredResource_FieldPath interface { 4746 gotenobject.FieldPath 4747 Selector() MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector 4748 Get(source *MetricDescriptor_IndexSpec_PerMonitoredResource) []interface{} 4749 GetSingle(source *MetricDescriptor_IndexSpec_PerMonitoredResource) (interface{}, bool) 4750 ClearValue(item *MetricDescriptor_IndexSpec_PerMonitoredResource) 4751 4752 // Those methods build corresponding MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue 4753 // (or array of values) and holds passed value. Panics if injected type is incorrect. 4754 WithIValue(value interface{}) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue 4755 WithIArrayOfValues(values interface{}) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues 4756 WithIArrayItemValue(value interface{}) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue 4757 } 4758 4759 type MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector int32 4760 4761 const ( 4762 MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector = 0 4763 MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector = 1 4764 ) 4765 4766 func (s MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector) String() string { 4767 switch s { 4768 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 4769 return "resource" 4770 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 4771 return "indices" 4772 default: 4773 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", s)) 4774 } 4775 } 4776 4777 func BuildMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndexSpecPerMonitoredResource_FieldPath, error) { 4778 if len(fp) == 0 { 4779 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_IndexSpec_PerMonitoredResource") 4780 } 4781 if len(fp) == 1 { 4782 switch fp[0] { 4783 case "resource": 4784 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath{selector: MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource}, nil 4785 case "indices": 4786 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath{selector: MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices}, nil 4787 } 4788 } else { 4789 switch fp[0] { 4790 case "indices": 4791 if subpath, err := BuildMetricDescriptorIndexSpecIndex_FieldPath(fp[1:]); err != nil { 4792 return nil, err 4793 } else { 4794 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath{selector: MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices, subPath: subpath}, nil 4795 } 4796 } 4797 } 4798 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_IndexSpec_PerMonitoredResource", fp) 4799 } 4800 4801 func ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(rawField string) (MetricDescriptorIndexSpecPerMonitoredResource_FieldPath, error) { 4802 fp, err := gotenobject.ParseRawFieldPath(rawField) 4803 if err != nil { 4804 return nil, err 4805 } 4806 return BuildMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(fp) 4807 } 4808 4809 func MustParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(rawField string) MetricDescriptorIndexSpecPerMonitoredResource_FieldPath { 4810 fp, err := ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(rawField) 4811 if err != nil { 4812 panic(err) 4813 } 4814 return fp 4815 } 4816 4817 type MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath struct { 4818 selector MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector 4819 } 4820 4821 var _ MetricDescriptorIndexSpecPerMonitoredResource_FieldPath = (*MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath)(nil) 4822 4823 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) Selector() MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector { 4824 return fp.selector 4825 } 4826 4827 // String returns path representation in proto convention 4828 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) String() string { 4829 return fp.selector.String() 4830 } 4831 4832 // JSONString returns path representation is JSON convention 4833 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) JSONString() string { 4834 return strcase.ToLowerCamel(fp.String()) 4835 } 4836 4837 // Get returns all values pointed by specific field from source MetricDescriptor_IndexSpec_PerMonitoredResource 4838 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) Get(source *MetricDescriptor_IndexSpec_PerMonitoredResource) (values []interface{}) { 4839 if source != nil { 4840 switch fp.selector { 4841 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 4842 if source.Resource != nil { 4843 values = append(values, source.Resource) 4844 } 4845 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 4846 for _, value := range source.GetIndices() { 4847 values = append(values, value) 4848 } 4849 default: 4850 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fp.selector)) 4851 } 4852 } 4853 return 4854 } 4855 4856 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 4857 return fp.Get(source.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 4858 } 4859 4860 // GetSingle returns value pointed by specific field of from source MetricDescriptor_IndexSpec_PerMonitoredResource 4861 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) GetSingle(source *MetricDescriptor_IndexSpec_PerMonitoredResource) (interface{}, bool) { 4862 switch fp.selector { 4863 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 4864 res := source.GetResource() 4865 return res, res != nil 4866 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 4867 res := source.GetIndices() 4868 return res, res != nil 4869 default: 4870 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fp.selector)) 4871 } 4872 } 4873 4874 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4875 return fp.GetSingle(source.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 4876 } 4877 4878 // GetDefault returns a default value of the field type 4879 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) GetDefault() interface{} { 4880 switch fp.selector { 4881 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 4882 return (*monitored_resource_descriptor.Reference)(nil) 4883 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 4884 return ([]*MetricDescriptor_IndexSpec_Index)(nil) 4885 default: 4886 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fp.selector)) 4887 } 4888 } 4889 4890 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) ClearValue(item *MetricDescriptor_IndexSpec_PerMonitoredResource) { 4891 if item != nil { 4892 switch fp.selector { 4893 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 4894 item.Resource = nil 4895 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 4896 item.Indices = nil 4897 default: 4898 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fp.selector)) 4899 } 4900 } 4901 } 4902 4903 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) ClearValueRaw(item proto.Message) { 4904 fp.ClearValue(item.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 4905 } 4906 4907 // IsLeaf - whether field path is holds simple value 4908 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) IsLeaf() bool { 4909 return fp.selector == MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource 4910 } 4911 4912 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4913 return []gotenobject.FieldPath{fp} 4914 } 4915 4916 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue { 4917 switch fp.selector { 4918 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 4919 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue{MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath: *fp, value: value.(*monitored_resource_descriptor.Reference)} 4920 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 4921 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue{MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_IndexSpec_Index)} 4922 default: 4923 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fp.selector)) 4924 } 4925 } 4926 4927 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4928 return fp.WithIValue(value) 4929 } 4930 4931 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues { 4932 fpaov := &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayOfValues{MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath: *fp} 4933 switch fp.selector { 4934 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 4935 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayOfValues{MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath: *fp, values: values.([]*monitored_resource_descriptor.Reference)} 4936 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 4937 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayOfValues{MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_IndexSpec_Index)} 4938 default: 4939 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fp.selector)) 4940 } 4941 return fpaov 4942 } 4943 4944 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4945 return fp.WithIArrayOfValues(values) 4946 } 4947 4948 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue { 4949 switch fp.selector { 4950 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 4951 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayItemValue{MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_IndexSpec_Index)} 4952 default: 4953 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fp.selector)) 4954 } 4955 } 4956 4957 func (fp *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4958 return fp.WithIArrayItemValue(value) 4959 } 4960 4961 type MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath struct { 4962 selector MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector 4963 subPath gotenobject.FieldPath 4964 } 4965 4966 var _ MetricDescriptorIndexSpecPerMonitoredResource_FieldPath = (*MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath)(nil) 4967 4968 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) Selector() MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelector { 4969 return fps.selector 4970 } 4971 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) AsIndicesSubPath() (MetricDescriptorIndexSpecIndex_FieldPath, bool) { 4972 res, ok := fps.subPath.(MetricDescriptorIndexSpecIndex_FieldPath) 4973 return res, ok 4974 } 4975 4976 // String returns path representation in proto convention 4977 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) String() string { 4978 return fps.selector.String() + "." + fps.subPath.String() 4979 } 4980 4981 // JSONString returns path representation is JSON convention 4982 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) JSONString() string { 4983 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 4984 } 4985 4986 // Get returns all values pointed by selected field from source MetricDescriptor_IndexSpec_PerMonitoredResource 4987 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) Get(source *MetricDescriptor_IndexSpec_PerMonitoredResource) (values []interface{}) { 4988 switch fps.selector { 4989 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 4990 for _, item := range source.GetIndices() { 4991 values = append(values, fps.subPath.GetRaw(item)...) 4992 } 4993 default: 4994 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fps.selector)) 4995 } 4996 return 4997 } 4998 4999 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) GetRaw(source proto.Message) []interface{} { 5000 return fps.Get(source.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 5001 } 5002 5003 // GetSingle returns value of selected field from source MetricDescriptor_IndexSpec_PerMonitoredResource 5004 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) GetSingle(source *MetricDescriptor_IndexSpec_PerMonitoredResource) (interface{}, bool) { 5005 switch fps.selector { 5006 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 5007 if len(source.GetIndices()) == 0 { 5008 return nil, false 5009 } 5010 return fps.subPath.GetSingleRaw(source.GetIndices()[0]) 5011 default: 5012 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fps.selector)) 5013 } 5014 } 5015 5016 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 5017 return fps.GetSingle(source.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 5018 } 5019 5020 // GetDefault returns a default value of the field type 5021 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) GetDefault() interface{} { 5022 return fps.subPath.GetDefault() 5023 } 5024 5025 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) ClearValue(item *MetricDescriptor_IndexSpec_PerMonitoredResource) { 5026 if item != nil { 5027 switch fps.selector { 5028 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 5029 for _, subItem := range item.Indices { 5030 fps.subPath.ClearValueRaw(subItem) 5031 } 5032 default: 5033 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fps.selector)) 5034 } 5035 } 5036 } 5037 5038 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) ClearValueRaw(item proto.Message) { 5039 fps.ClearValue(item.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 5040 } 5041 5042 // IsLeaf - whether field path is holds simple value 5043 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) IsLeaf() bool { 5044 return fps.subPath.IsLeaf() 5045 } 5046 5047 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 5048 iPaths := []gotenobject.FieldPath{&MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath{selector: fps.selector}} 5049 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 5050 return iPaths 5051 } 5052 5053 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) WithIValue(value interface{}) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue { 5054 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 5055 } 5056 5057 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 5058 return fps.WithIValue(value) 5059 } 5060 5061 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues { 5062 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 5063 } 5064 5065 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 5066 return fps.WithIArrayOfValues(values) 5067 } 5068 5069 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue { 5070 return &MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 5071 } 5072 5073 func (fps *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 5074 return fps.WithIArrayItemValue(value) 5075 } 5076 5077 // MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue allows storing values for PerMonitoredResource fields according to their type 5078 type MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue interface { 5079 MetricDescriptorIndexSpecPerMonitoredResource_FieldPath 5080 gotenobject.FieldPathValue 5081 SetTo(target **MetricDescriptor_IndexSpec_PerMonitoredResource) 5082 CompareWith(*MetricDescriptor_IndexSpec_PerMonitoredResource) (cmp int, comparable bool) 5083 } 5084 5085 func ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue, error) { 5086 fp, err := ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(pathStr) 5087 if err != nil { 5088 return nil, err 5089 } 5090 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 5091 if err != nil { 5092 return nil, status.Errorf(codes.InvalidArgument, "error parsing PerMonitoredResource field path value from %s: %v", valueStr, err) 5093 } 5094 return fpv.(MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue), nil 5095 } 5096 5097 func MustParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue { 5098 fpv, err := ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue(pathStr, valueStr) 5099 if err != nil { 5100 panic(err) 5101 } 5102 return fpv 5103 } 5104 5105 type MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue struct { 5106 MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath 5107 value interface{} 5108 } 5109 5110 var _ MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue = (*MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue)(nil) 5111 5112 // GetRawValue returns raw value stored under selected path for 'PerMonitoredResource' as interface{} 5113 func (fpv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue) GetRawValue() interface{} { 5114 return fpv.value 5115 } 5116 func (fpv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue) AsResourceValue() (*monitored_resource_descriptor.Reference, bool) { 5117 res, ok := fpv.value.(*monitored_resource_descriptor.Reference) 5118 return res, ok 5119 } 5120 func (fpv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue) AsIndicesValue() ([]*MetricDescriptor_IndexSpec_Index, bool) { 5121 res, ok := fpv.value.([]*MetricDescriptor_IndexSpec_Index) 5122 return res, ok 5123 } 5124 5125 // SetTo stores value for selected field for object PerMonitoredResource 5126 func (fpv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue) SetTo(target **MetricDescriptor_IndexSpec_PerMonitoredResource) { 5127 if *target == nil { 5128 *target = new(MetricDescriptor_IndexSpec_PerMonitoredResource) 5129 } 5130 switch fpv.selector { 5131 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 5132 (*target).Resource = fpv.value.(*monitored_resource_descriptor.Reference) 5133 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 5134 (*target).Indices = fpv.value.([]*MetricDescriptor_IndexSpec_Index) 5135 default: 5136 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fpv.selector)) 5137 } 5138 } 5139 5140 func (fpv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue) SetToRaw(target proto.Message) { 5141 typedObject := target.(*MetricDescriptor_IndexSpec_PerMonitoredResource) 5142 fpv.SetTo(&typedObject) 5143 } 5144 5145 // CompareWith compares value in the 'MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_IndexSpec_PerMonitoredResource'. 5146 func (fpv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_IndexSpec_PerMonitoredResource) (int, bool) { 5147 switch fpv.selector { 5148 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 5149 leftValue := fpv.value.(*monitored_resource_descriptor.Reference) 5150 rightValue := source.GetResource() 5151 if leftValue == nil { 5152 if rightValue != nil { 5153 return -1, true 5154 } 5155 return 0, true 5156 } 5157 if rightValue == nil { 5158 return 1, true 5159 } 5160 if leftValue.String() == rightValue.String() { 5161 return 0, true 5162 } else if leftValue.String() < rightValue.String() { 5163 return -1, true 5164 } else { 5165 return 1, true 5166 } 5167 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 5168 return 0, false 5169 default: 5170 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fpv.selector)) 5171 } 5172 } 5173 5174 func (fpv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 5175 return fpv.CompareWith(source.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 5176 } 5177 5178 type MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathValue struct { 5179 MetricDescriptorIndexSpecPerMonitoredResource_FieldPath 5180 subPathValue gotenobject.FieldPathValue 5181 } 5182 5183 var _ MetricDescriptorIndexSpecPerMonitoredResource_FieldPathValue = (*MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathValue)(nil) 5184 5185 func (fpvs *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathValue) AsIndicesPathValue() (MetricDescriptorIndexSpecIndex_FieldPathValue, bool) { 5186 res, ok := fpvs.subPathValue.(MetricDescriptorIndexSpecIndex_FieldPathValue) 5187 return res, ok 5188 } 5189 5190 func (fpvs *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathValue) SetTo(target **MetricDescriptor_IndexSpec_PerMonitoredResource) { 5191 if *target == nil { 5192 *target = new(MetricDescriptor_IndexSpec_PerMonitoredResource) 5193 } 5194 switch fpvs.Selector() { 5195 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 5196 panic("FieldPath setter is unsupported for array subpaths") 5197 default: 5198 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fpvs.Selector())) 5199 } 5200 } 5201 5202 func (fpvs *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathValue) SetToRaw(target proto.Message) { 5203 typedObject := target.(*MetricDescriptor_IndexSpec_PerMonitoredResource) 5204 fpvs.SetTo(&typedObject) 5205 } 5206 5207 func (fpvs *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathValue) GetRawValue() interface{} { 5208 return fpvs.subPathValue.GetRawValue() 5209 } 5210 5211 func (fpvs *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathValue) CompareWith(source *MetricDescriptor_IndexSpec_PerMonitoredResource) (int, bool) { 5212 switch fpvs.Selector() { 5213 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 5214 return 0, false // repeated field 5215 default: 5216 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fpvs.Selector())) 5217 } 5218 } 5219 5220 func (fpvs *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 5221 return fpvs.CompareWith(source.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 5222 } 5223 5224 // MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue allows storing single item in Path-specific values for PerMonitoredResource according to their type 5225 // Present only for array (repeated) types. 5226 type MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue interface { 5227 gotenobject.FieldPathArrayItemValue 5228 MetricDescriptorIndexSpecPerMonitoredResource_FieldPath 5229 ContainsValue(*MetricDescriptor_IndexSpec_PerMonitoredResource) bool 5230 } 5231 5232 // ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 5233 func ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue, error) { 5234 fp, err := ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(pathStr) 5235 if err != nil { 5236 return nil, err 5237 } 5238 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 5239 if err != nil { 5240 return nil, status.Errorf(codes.InvalidArgument, "error parsing PerMonitoredResource field path array item value from %s: %v", valueStr, err) 5241 } 5242 return fpaiv.(MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue), nil 5243 } 5244 5245 func MustParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue { 5246 fpaiv, err := ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue(pathStr, valueStr) 5247 if err != nil { 5248 panic(err) 5249 } 5250 return fpaiv 5251 } 5252 5253 type MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayItemValue struct { 5254 MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath 5255 value interface{} 5256 } 5257 5258 var _ MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayItemValue = (*MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayItemValue)(nil) 5259 5260 // GetRawValue returns stored element value for array in object MetricDescriptor_IndexSpec_PerMonitoredResource as interface{} 5261 func (fpaiv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 5262 return fpaiv.value 5263 } 5264 func (fpaiv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayItemValue) AsIndicesItemValue() (*MetricDescriptor_IndexSpec_Index, bool) { 5265 res, ok := fpaiv.value.(*MetricDescriptor_IndexSpec_Index) 5266 return res, ok 5267 } 5268 5269 func (fpaiv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_IndexSpec_PerMonitoredResource) (interface{}, bool) { 5270 return nil, false 5271 } 5272 5273 func (fpaiv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 5274 return fpaiv.GetSingle(source.(*MetricDescriptor_IndexSpec_PerMonitoredResource)) 5275 } 5276 5277 // Contains returns a boolean indicating if value that is being held is present in given 'PerMonitoredResource' 5278 func (fpaiv *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_IndexSpec_PerMonitoredResource) bool { 5279 slice := fpaiv.MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath.Get(source) 5280 for _, v := range slice { 5281 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 5282 if proto.Equal(asProtoMsg, v.(proto.Message)) { 5283 return true 5284 } 5285 } else if reflect.DeepEqual(v, fpaiv.value) { 5286 return true 5287 } 5288 } 5289 return false 5290 } 5291 5292 type MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayItemValue struct { 5293 MetricDescriptorIndexSpecPerMonitoredResource_FieldPath 5294 subPathItemValue gotenobject.FieldPathArrayItemValue 5295 } 5296 5297 // GetRawValue returns stored array item value 5298 func (fpaivs *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 5299 return fpaivs.subPathItemValue.GetRawItemValue() 5300 } 5301 func (fpaivs *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayItemValue) AsIndicesPathItemValue() (MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue, bool) { 5302 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndexSpecIndex_FieldPathArrayItemValue) 5303 return res, ok 5304 } 5305 5306 // Contains returns a boolean indicating if value that is being held is present in given 'PerMonitoredResource' 5307 func (fpaivs *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor_IndexSpec_PerMonitoredResource) bool { 5308 switch fpaivs.Selector() { 5309 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 5310 return false // repeated/map field 5311 default: 5312 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_IndexSpec_PerMonitoredResource: %d", fpaivs.Selector())) 5313 } 5314 } 5315 5316 // MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues allows storing slice of values for PerMonitoredResource fields according to their type 5317 type MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues interface { 5318 gotenobject.FieldPathArrayOfValues 5319 MetricDescriptorIndexSpecPerMonitoredResource_FieldPath 5320 } 5321 5322 func ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues, error) { 5323 fp, err := ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPath(pathStr) 5324 if err != nil { 5325 return nil, err 5326 } 5327 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 5328 if err != nil { 5329 return nil, status.Errorf(codes.InvalidArgument, "error parsing PerMonitoredResource field path array of values from %s: %v", valuesStr, err) 5330 } 5331 return fpaov.(MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues), nil 5332 } 5333 5334 func MustParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues { 5335 fpaov, err := ParseMetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues(pathStr, valuesStr) 5336 if err != nil { 5337 panic(err) 5338 } 5339 return fpaov 5340 } 5341 5342 type MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayOfValues struct { 5343 MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPath 5344 values interface{} 5345 } 5346 5347 var _ MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues = (*MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayOfValues)(nil) 5348 5349 func (fpaov *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 5350 switch fpaov.selector { 5351 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorResource: 5352 for _, v := range fpaov.values.([]*monitored_resource_descriptor.Reference) { 5353 values = append(values, v) 5354 } 5355 case MetricDescriptorIndexSpecPerMonitoredResource_FieldPathSelectorIndices: 5356 for _, v := range fpaov.values.([][]*MetricDescriptor_IndexSpec_Index) { 5357 values = append(values, v) 5358 } 5359 } 5360 return 5361 } 5362 func (fpaov *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayOfValues) AsResourceArrayOfValues() ([]*monitored_resource_descriptor.Reference, bool) { 5363 res, ok := fpaov.values.([]*monitored_resource_descriptor.Reference) 5364 return res, ok 5365 } 5366 func (fpaov *MetricDescriptorIndexSpecPerMonitoredResource_FieldTerminalPathArrayOfValues) AsIndicesArrayOfValues() ([][]*MetricDescriptor_IndexSpec_Index, bool) { 5367 res, ok := fpaov.values.([][]*MetricDescriptor_IndexSpec_Index) 5368 return res, ok 5369 } 5370 5371 type MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayOfValues struct { 5372 MetricDescriptorIndexSpecPerMonitoredResource_FieldPath 5373 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 5374 } 5375 5376 var _ MetricDescriptorIndexSpecPerMonitoredResource_FieldPathArrayOfValues = (*MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayOfValues)(nil) 5377 5378 func (fpsaov *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 5379 return fpsaov.subPathArrayOfValues.GetRawValues() 5380 } 5381 func (fpsaov *MetricDescriptorIndexSpecPerMonitoredResource_FieldSubPathArrayOfValues) AsIndicesPathArrayOfValues() (MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues, bool) { 5382 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndexSpecIndex_FieldPathArrayOfValues) 5383 return res, ok 5384 } 5385 5386 // FieldPath provides implementation to handle 5387 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 5388 type MetricDescriptorIndicesLabelsGroup_FieldPath interface { 5389 gotenobject.FieldPath 5390 Selector() MetricDescriptorIndicesLabelsGroup_FieldPathSelector 5391 Get(source *MetricDescriptor_Indices_LabelsGroup) []interface{} 5392 GetSingle(source *MetricDescriptor_Indices_LabelsGroup) (interface{}, bool) 5393 ClearValue(item *MetricDescriptor_Indices_LabelsGroup) 5394 5395 // Those methods build corresponding MetricDescriptorIndicesLabelsGroup_FieldPathValue 5396 // (or array of values) and holds passed value. Panics if injected type is incorrect. 5397 WithIValue(value interface{}) MetricDescriptorIndicesLabelsGroup_FieldPathValue 5398 WithIArrayOfValues(values interface{}) MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues 5399 WithIArrayItemValue(value interface{}) MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue 5400 } 5401 5402 type MetricDescriptorIndicesLabelsGroup_FieldPathSelector int32 5403 5404 const ( 5405 MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName MetricDescriptorIndicesLabelsGroup_FieldPathSelector = 0 5406 MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys MetricDescriptorIndicesLabelsGroup_FieldPathSelector = 1 5407 MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys MetricDescriptorIndicesLabelsGroup_FieldPathSelector = 2 5408 MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus MetricDescriptorIndicesLabelsGroup_FieldPathSelector = 3 5409 ) 5410 5411 func (s MetricDescriptorIndicesLabelsGroup_FieldPathSelector) String() string { 5412 switch s { 5413 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5414 return "name" 5415 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5416 return "metric_keys" 5417 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5418 return "resource_keys" 5419 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5420 return "closing_status" 5421 default: 5422 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", s)) 5423 } 5424 } 5425 5426 func BuildMetricDescriptorIndicesLabelsGroup_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndicesLabelsGroup_FieldPath, error) { 5427 if len(fp) == 0 { 5428 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_Indices_LabelsGroup") 5429 } 5430 if len(fp) == 1 { 5431 switch fp[0] { 5432 case "name": 5433 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName}, nil 5434 case "metric_keys", "metricKeys", "metric-keys": 5435 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys}, nil 5436 case "resource_keys", "resourceKeys", "resource-keys": 5437 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys}, nil 5438 case "closing_status", "closingStatus", "closing-status": 5439 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus}, nil 5440 } 5441 } 5442 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_Indices_LabelsGroup", fp) 5443 } 5444 5445 func ParseMetricDescriptorIndicesLabelsGroup_FieldPath(rawField string) (MetricDescriptorIndicesLabelsGroup_FieldPath, error) { 5446 fp, err := gotenobject.ParseRawFieldPath(rawField) 5447 if err != nil { 5448 return nil, err 5449 } 5450 return BuildMetricDescriptorIndicesLabelsGroup_FieldPath(fp) 5451 } 5452 5453 func MustParseMetricDescriptorIndicesLabelsGroup_FieldPath(rawField string) MetricDescriptorIndicesLabelsGroup_FieldPath { 5454 fp, err := ParseMetricDescriptorIndicesLabelsGroup_FieldPath(rawField) 5455 if err != nil { 5456 panic(err) 5457 } 5458 return fp 5459 } 5460 5461 type MetricDescriptorIndicesLabelsGroup_FieldTerminalPath struct { 5462 selector MetricDescriptorIndicesLabelsGroup_FieldPathSelector 5463 } 5464 5465 var _ MetricDescriptorIndicesLabelsGroup_FieldPath = (*MetricDescriptorIndicesLabelsGroup_FieldTerminalPath)(nil) 5466 5467 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) Selector() MetricDescriptorIndicesLabelsGroup_FieldPathSelector { 5468 return fp.selector 5469 } 5470 5471 // String returns path representation in proto convention 5472 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) String() string { 5473 return fp.selector.String() 5474 } 5475 5476 // JSONString returns path representation is JSON convention 5477 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) JSONString() string { 5478 return strcase.ToLowerCamel(fp.String()) 5479 } 5480 5481 // Get returns all values pointed by specific field from source MetricDescriptor_Indices_LabelsGroup 5482 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) Get(source *MetricDescriptor_Indices_LabelsGroup) (values []interface{}) { 5483 if source != nil { 5484 switch fp.selector { 5485 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5486 values = append(values, source.Name) 5487 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5488 for _, value := range source.GetMetricKeys() { 5489 values = append(values, value) 5490 } 5491 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5492 for _, value := range source.GetResourceKeys() { 5493 values = append(values, value) 5494 } 5495 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5496 values = append(values, source.ClosingStatus) 5497 default: 5498 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", fp.selector)) 5499 } 5500 } 5501 return 5502 } 5503 5504 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 5505 return fp.Get(source.(*MetricDescriptor_Indices_LabelsGroup)) 5506 } 5507 5508 // GetSingle returns value pointed by specific field of from source MetricDescriptor_Indices_LabelsGroup 5509 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) GetSingle(source *MetricDescriptor_Indices_LabelsGroup) (interface{}, bool) { 5510 switch fp.selector { 5511 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5512 return source.GetName(), source != nil 5513 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5514 res := source.GetMetricKeys() 5515 return res, res != nil 5516 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5517 res := source.GetResourceKeys() 5518 return res, res != nil 5519 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5520 return source.GetClosingStatus(), source != nil 5521 default: 5522 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", fp.selector)) 5523 } 5524 } 5525 5526 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 5527 return fp.GetSingle(source.(*MetricDescriptor_Indices_LabelsGroup)) 5528 } 5529 5530 // GetDefault returns a default value of the field type 5531 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) GetDefault() interface{} { 5532 switch fp.selector { 5533 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5534 return "" 5535 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5536 return ([]string)(nil) 5537 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5538 return ([]string)(nil) 5539 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5540 return MetricDescriptor_Indices_UNDEFINED 5541 default: 5542 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", fp.selector)) 5543 } 5544 } 5545 5546 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) ClearValue(item *MetricDescriptor_Indices_LabelsGroup) { 5547 if item != nil { 5548 switch fp.selector { 5549 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5550 item.Name = "" 5551 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5552 item.MetricKeys = nil 5553 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5554 item.ResourceKeys = nil 5555 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5556 item.ClosingStatus = MetricDescriptor_Indices_UNDEFINED 5557 default: 5558 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", fp.selector)) 5559 } 5560 } 5561 } 5562 5563 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) ClearValueRaw(item proto.Message) { 5564 fp.ClearValue(item.(*MetricDescriptor_Indices_LabelsGroup)) 5565 } 5566 5567 // IsLeaf - whether field path is holds simple value 5568 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) IsLeaf() bool { 5569 return fp.selector == MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName || 5570 fp.selector == MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys || 5571 fp.selector == MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys || 5572 fp.selector == MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus 5573 } 5574 5575 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 5576 return []gotenobject.FieldPath{fp} 5577 } 5578 5579 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndicesLabelsGroup_FieldPathValue { 5580 switch fp.selector { 5581 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5582 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, value: value.(string)} 5583 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5584 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, value: value.([]string)} 5585 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5586 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, value: value.([]string)} 5587 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5588 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, value: value.(MetricDescriptor_Indices_CloseStatus)} 5589 default: 5590 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", fp.selector)) 5591 } 5592 } 5593 5594 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 5595 return fp.WithIValue(value) 5596 } 5597 5598 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues { 5599 fpaov := &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp} 5600 switch fp.selector { 5601 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5602 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, values: values.([]string)} 5603 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5604 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, values: values.([][]string)} 5605 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5606 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, values: values.([][]string)} 5607 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5608 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, values: values.([]MetricDescriptor_Indices_CloseStatus)} 5609 default: 5610 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", fp.selector)) 5611 } 5612 return fpaov 5613 } 5614 5615 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 5616 return fp.WithIArrayOfValues(values) 5617 } 5618 5619 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue { 5620 switch fp.selector { 5621 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5622 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, value: value.(string)} 5623 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5624 return &MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesLabelsGroup_FieldTerminalPath: *fp, value: value.(string)} 5625 default: 5626 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", fp.selector)) 5627 } 5628 } 5629 5630 func (fp *MetricDescriptorIndicesLabelsGroup_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 5631 return fp.WithIArrayItemValue(value) 5632 } 5633 5634 // MetricDescriptorIndicesLabelsGroup_FieldPathValue allows storing values for LabelsGroup fields according to their type 5635 type MetricDescriptorIndicesLabelsGroup_FieldPathValue interface { 5636 MetricDescriptorIndicesLabelsGroup_FieldPath 5637 gotenobject.FieldPathValue 5638 SetTo(target **MetricDescriptor_Indices_LabelsGroup) 5639 CompareWith(*MetricDescriptor_Indices_LabelsGroup) (cmp int, comparable bool) 5640 } 5641 5642 func ParseMetricDescriptorIndicesLabelsGroup_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndicesLabelsGroup_FieldPathValue, error) { 5643 fp, err := ParseMetricDescriptorIndicesLabelsGroup_FieldPath(pathStr) 5644 if err != nil { 5645 return nil, err 5646 } 5647 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 5648 if err != nil { 5649 return nil, status.Errorf(codes.InvalidArgument, "error parsing LabelsGroup field path value from %s: %v", valueStr, err) 5650 } 5651 return fpv.(MetricDescriptorIndicesLabelsGroup_FieldPathValue), nil 5652 } 5653 5654 func MustParseMetricDescriptorIndicesLabelsGroup_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndicesLabelsGroup_FieldPathValue { 5655 fpv, err := ParseMetricDescriptorIndicesLabelsGroup_FieldPathValue(pathStr, valueStr) 5656 if err != nil { 5657 panic(err) 5658 } 5659 return fpv 5660 } 5661 5662 type MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue struct { 5663 MetricDescriptorIndicesLabelsGroup_FieldTerminalPath 5664 value interface{} 5665 } 5666 5667 var _ MetricDescriptorIndicesLabelsGroup_FieldPathValue = (*MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue)(nil) 5668 5669 // GetRawValue returns raw value stored under selected path for 'LabelsGroup' as interface{} 5670 func (fpv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue) GetRawValue() interface{} { 5671 return fpv.value 5672 } 5673 func (fpv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue) AsNameValue() (string, bool) { 5674 res, ok := fpv.value.(string) 5675 return res, ok 5676 } 5677 func (fpv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue) AsMetricKeysValue() ([]string, bool) { 5678 res, ok := fpv.value.([]string) 5679 return res, ok 5680 } 5681 func (fpv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue) AsResourceKeysValue() ([]string, bool) { 5682 res, ok := fpv.value.([]string) 5683 return res, ok 5684 } 5685 func (fpv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue) AsClosingStatusValue() (MetricDescriptor_Indices_CloseStatus, bool) { 5686 res, ok := fpv.value.(MetricDescriptor_Indices_CloseStatus) 5687 return res, ok 5688 } 5689 5690 // SetTo stores value for selected field for object LabelsGroup 5691 func (fpv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue) SetTo(target **MetricDescriptor_Indices_LabelsGroup) { 5692 if *target == nil { 5693 *target = new(MetricDescriptor_Indices_LabelsGroup) 5694 } 5695 switch fpv.selector { 5696 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5697 (*target).Name = fpv.value.(string) 5698 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5699 (*target).MetricKeys = fpv.value.([]string) 5700 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5701 (*target).ResourceKeys = fpv.value.([]string) 5702 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5703 (*target).ClosingStatus = fpv.value.(MetricDescriptor_Indices_CloseStatus) 5704 default: 5705 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", fpv.selector)) 5706 } 5707 } 5708 5709 func (fpv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue) SetToRaw(target proto.Message) { 5710 typedObject := target.(*MetricDescriptor_Indices_LabelsGroup) 5711 fpv.SetTo(&typedObject) 5712 } 5713 5714 // CompareWith compares value in the 'MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_Indices_LabelsGroup'. 5715 func (fpv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_Indices_LabelsGroup) (int, bool) { 5716 switch fpv.selector { 5717 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5718 leftValue := fpv.value.(string) 5719 rightValue := source.GetName() 5720 if (leftValue) == (rightValue) { 5721 return 0, true 5722 } else if (leftValue) < (rightValue) { 5723 return -1, true 5724 } else { 5725 return 1, true 5726 } 5727 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5728 return 0, false 5729 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5730 return 0, false 5731 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5732 leftValue := fpv.value.(MetricDescriptor_Indices_CloseStatus) 5733 rightValue := source.GetClosingStatus() 5734 if (leftValue) == (rightValue) { 5735 return 0, true 5736 } else if (leftValue) < (rightValue) { 5737 return -1, true 5738 } else { 5739 return 1, true 5740 } 5741 default: 5742 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_LabelsGroup: %d", fpv.selector)) 5743 } 5744 } 5745 5746 func (fpv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 5747 return fpv.CompareWith(source.(*MetricDescriptor_Indices_LabelsGroup)) 5748 } 5749 5750 // MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue allows storing single item in Path-specific values for LabelsGroup according to their type 5751 // Present only for array (repeated) types. 5752 type MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue interface { 5753 gotenobject.FieldPathArrayItemValue 5754 MetricDescriptorIndicesLabelsGroup_FieldPath 5755 ContainsValue(*MetricDescriptor_Indices_LabelsGroup) bool 5756 } 5757 5758 // ParseMetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 5759 func ParseMetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue, error) { 5760 fp, err := ParseMetricDescriptorIndicesLabelsGroup_FieldPath(pathStr) 5761 if err != nil { 5762 return nil, err 5763 } 5764 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 5765 if err != nil { 5766 return nil, status.Errorf(codes.InvalidArgument, "error parsing LabelsGroup field path array item value from %s: %v", valueStr, err) 5767 } 5768 return fpaiv.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue), nil 5769 } 5770 5771 func MustParseMetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue { 5772 fpaiv, err := ParseMetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue(pathStr, valueStr) 5773 if err != nil { 5774 panic(err) 5775 } 5776 return fpaiv 5777 } 5778 5779 type MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue struct { 5780 MetricDescriptorIndicesLabelsGroup_FieldTerminalPath 5781 value interface{} 5782 } 5783 5784 var _ MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue = (*MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue)(nil) 5785 5786 // GetRawValue returns stored element value for array in object MetricDescriptor_Indices_LabelsGroup as interface{} 5787 func (fpaiv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 5788 return fpaiv.value 5789 } 5790 func (fpaiv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue) AsMetricKeysItemValue() (string, bool) { 5791 res, ok := fpaiv.value.(string) 5792 return res, ok 5793 } 5794 func (fpaiv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue) AsResourceKeysItemValue() (string, bool) { 5795 res, ok := fpaiv.value.(string) 5796 return res, ok 5797 } 5798 5799 func (fpaiv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_Indices_LabelsGroup) (interface{}, bool) { 5800 return nil, false 5801 } 5802 5803 func (fpaiv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 5804 return fpaiv.GetSingle(source.(*MetricDescriptor_Indices_LabelsGroup)) 5805 } 5806 5807 // Contains returns a boolean indicating if value that is being held is present in given 'LabelsGroup' 5808 func (fpaiv *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_LabelsGroup) bool { 5809 slice := fpaiv.MetricDescriptorIndicesLabelsGroup_FieldTerminalPath.Get(source) 5810 for _, v := range slice { 5811 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 5812 if proto.Equal(asProtoMsg, v.(proto.Message)) { 5813 return true 5814 } 5815 } else if reflect.DeepEqual(v, fpaiv.value) { 5816 return true 5817 } 5818 } 5819 return false 5820 } 5821 5822 // MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues allows storing slice of values for LabelsGroup fields according to their type 5823 type MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues interface { 5824 gotenobject.FieldPathArrayOfValues 5825 MetricDescriptorIndicesLabelsGroup_FieldPath 5826 } 5827 5828 func ParseMetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues, error) { 5829 fp, err := ParseMetricDescriptorIndicesLabelsGroup_FieldPath(pathStr) 5830 if err != nil { 5831 return nil, err 5832 } 5833 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 5834 if err != nil { 5835 return nil, status.Errorf(codes.InvalidArgument, "error parsing LabelsGroup field path array of values from %s: %v", valuesStr, err) 5836 } 5837 return fpaov.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues), nil 5838 } 5839 5840 func MustParseMetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues { 5841 fpaov, err := ParseMetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues(pathStr, valuesStr) 5842 if err != nil { 5843 panic(err) 5844 } 5845 return fpaov 5846 } 5847 5848 type MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues struct { 5849 MetricDescriptorIndicesLabelsGroup_FieldTerminalPath 5850 values interface{} 5851 } 5852 5853 var _ MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues = (*MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues)(nil) 5854 5855 func (fpaov *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 5856 switch fpaov.selector { 5857 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorName: 5858 for _, v := range fpaov.values.([]string) { 5859 values = append(values, v) 5860 } 5861 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorMetricKeys: 5862 for _, v := range fpaov.values.([][]string) { 5863 values = append(values, v) 5864 } 5865 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorResourceKeys: 5866 for _, v := range fpaov.values.([][]string) { 5867 values = append(values, v) 5868 } 5869 case MetricDescriptorIndicesLabelsGroup_FieldPathSelectorClosingStatus: 5870 for _, v := range fpaov.values.([]MetricDescriptor_Indices_CloseStatus) { 5871 values = append(values, v) 5872 } 5873 } 5874 return 5875 } 5876 func (fpaov *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]string, bool) { 5877 res, ok := fpaov.values.([]string) 5878 return res, ok 5879 } 5880 func (fpaov *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues) AsMetricKeysArrayOfValues() ([][]string, bool) { 5881 res, ok := fpaov.values.([][]string) 5882 return res, ok 5883 } 5884 func (fpaov *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues) AsResourceKeysArrayOfValues() ([][]string, bool) { 5885 res, ok := fpaov.values.([][]string) 5886 return res, ok 5887 } 5888 func (fpaov *MetricDescriptorIndicesLabelsGroup_FieldTerminalPathArrayOfValues) AsClosingStatusArrayOfValues() ([]MetricDescriptor_Indices_CloseStatus, bool) { 5889 res, ok := fpaov.values.([]MetricDescriptor_Indices_CloseStatus) 5890 return res, ok 5891 } 5892 5893 // FieldPath provides implementation to handle 5894 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 5895 type MetricDescriptorIndicesPaginationView_FieldPath interface { 5896 gotenobject.FieldPath 5897 Selector() MetricDescriptorIndicesPaginationView_FieldPathSelector 5898 Get(source *MetricDescriptor_Indices_PaginationView) []interface{} 5899 GetSingle(source *MetricDescriptor_Indices_PaginationView) (interface{}, bool) 5900 ClearValue(item *MetricDescriptor_Indices_PaginationView) 5901 5902 // Those methods build corresponding MetricDescriptorIndicesPaginationView_FieldPathValue 5903 // (or array of values) and holds passed value. Panics if injected type is incorrect. 5904 WithIValue(value interface{}) MetricDescriptorIndicesPaginationView_FieldPathValue 5905 WithIArrayOfValues(values interface{}) MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues 5906 WithIArrayItemValue(value interface{}) MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue 5907 } 5908 5909 type MetricDescriptorIndicesPaginationView_FieldPathSelector int32 5910 5911 const ( 5912 MetricDescriptorIndicesPaginationView_FieldPathSelectorName MetricDescriptorIndicesPaginationView_FieldPathSelector = 0 5913 MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys MetricDescriptorIndicesPaginationView_FieldPathSelector = 1 5914 MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys MetricDescriptorIndicesPaginationView_FieldPathSelector = 2 5915 MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys MetricDescriptorIndicesPaginationView_FieldPathSelector = 3 5916 MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys MetricDescriptorIndicesPaginationView_FieldPathSelector = 4 5917 MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus MetricDescriptorIndicesPaginationView_FieldPathSelector = 5 5918 ) 5919 5920 func (s MetricDescriptorIndicesPaginationView_FieldPathSelector) String() string { 5921 switch s { 5922 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 5923 return "name" 5924 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 5925 return "filterable_metric_keys" 5926 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 5927 return "filterable_resource_keys" 5928 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 5929 return "paginated_metric_keys" 5930 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 5931 return "paginated_resource_keys" 5932 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 5933 return "closing_status" 5934 default: 5935 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", s)) 5936 } 5937 } 5938 5939 func BuildMetricDescriptorIndicesPaginationView_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndicesPaginationView_FieldPath, error) { 5940 if len(fp) == 0 { 5941 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_Indices_PaginationView") 5942 } 5943 if len(fp) == 1 { 5944 switch fp[0] { 5945 case "name": 5946 return &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorName}, nil 5947 case "filterable_metric_keys", "filterableMetricKeys", "filterable-metric-keys": 5948 return &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys}, nil 5949 case "filterable_resource_keys", "filterableResourceKeys", "filterable-resource-keys": 5950 return &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys}, nil 5951 case "paginated_metric_keys", "paginatedMetricKeys", "paginated-metric-keys": 5952 return &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys}, nil 5953 case "paginated_resource_keys", "paginatedResourceKeys", "paginated-resource-keys": 5954 return &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys}, nil 5955 case "closing_status", "closingStatus", "closing-status": 5956 return &MetricDescriptorIndicesPaginationView_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus}, nil 5957 } 5958 } 5959 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_Indices_PaginationView", fp) 5960 } 5961 5962 func ParseMetricDescriptorIndicesPaginationView_FieldPath(rawField string) (MetricDescriptorIndicesPaginationView_FieldPath, error) { 5963 fp, err := gotenobject.ParseRawFieldPath(rawField) 5964 if err != nil { 5965 return nil, err 5966 } 5967 return BuildMetricDescriptorIndicesPaginationView_FieldPath(fp) 5968 } 5969 5970 func MustParseMetricDescriptorIndicesPaginationView_FieldPath(rawField string) MetricDescriptorIndicesPaginationView_FieldPath { 5971 fp, err := ParseMetricDescriptorIndicesPaginationView_FieldPath(rawField) 5972 if err != nil { 5973 panic(err) 5974 } 5975 return fp 5976 } 5977 5978 type MetricDescriptorIndicesPaginationView_FieldTerminalPath struct { 5979 selector MetricDescriptorIndicesPaginationView_FieldPathSelector 5980 } 5981 5982 var _ MetricDescriptorIndicesPaginationView_FieldPath = (*MetricDescriptorIndicesPaginationView_FieldTerminalPath)(nil) 5983 5984 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) Selector() MetricDescriptorIndicesPaginationView_FieldPathSelector { 5985 return fp.selector 5986 } 5987 5988 // String returns path representation in proto convention 5989 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) String() string { 5990 return fp.selector.String() 5991 } 5992 5993 // JSONString returns path representation is JSON convention 5994 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) JSONString() string { 5995 return strcase.ToLowerCamel(fp.String()) 5996 } 5997 5998 // Get returns all values pointed by specific field from source MetricDescriptor_Indices_PaginationView 5999 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) Get(source *MetricDescriptor_Indices_PaginationView) (values []interface{}) { 6000 if source != nil { 6001 switch fp.selector { 6002 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 6003 values = append(values, source.Name) 6004 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6005 for _, value := range source.GetFilterableMetricKeys() { 6006 values = append(values, value) 6007 } 6008 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6009 for _, value := range source.GetFilterableResourceKeys() { 6010 values = append(values, value) 6011 } 6012 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6013 for _, value := range source.GetPaginatedMetricKeys() { 6014 values = append(values, value) 6015 } 6016 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6017 for _, value := range source.GetPaginatedResourceKeys() { 6018 values = append(values, value) 6019 } 6020 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 6021 values = append(values, source.ClosingStatus) 6022 default: 6023 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", fp.selector)) 6024 } 6025 } 6026 return 6027 } 6028 6029 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 6030 return fp.Get(source.(*MetricDescriptor_Indices_PaginationView)) 6031 } 6032 6033 // GetSingle returns value pointed by specific field of from source MetricDescriptor_Indices_PaginationView 6034 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) GetSingle(source *MetricDescriptor_Indices_PaginationView) (interface{}, bool) { 6035 switch fp.selector { 6036 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 6037 return source.GetName(), source != nil 6038 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6039 res := source.GetFilterableMetricKeys() 6040 return res, res != nil 6041 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6042 res := source.GetFilterableResourceKeys() 6043 return res, res != nil 6044 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6045 res := source.GetPaginatedMetricKeys() 6046 return res, res != nil 6047 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6048 res := source.GetPaginatedResourceKeys() 6049 return res, res != nil 6050 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 6051 return source.GetClosingStatus(), source != nil 6052 default: 6053 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", fp.selector)) 6054 } 6055 } 6056 6057 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 6058 return fp.GetSingle(source.(*MetricDescriptor_Indices_PaginationView)) 6059 } 6060 6061 // GetDefault returns a default value of the field type 6062 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) GetDefault() interface{} { 6063 switch fp.selector { 6064 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 6065 return "" 6066 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6067 return ([]string)(nil) 6068 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6069 return ([]string)(nil) 6070 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6071 return ([]string)(nil) 6072 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6073 return ([]string)(nil) 6074 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 6075 return MetricDescriptor_Indices_UNDEFINED 6076 default: 6077 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", fp.selector)) 6078 } 6079 } 6080 6081 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) ClearValue(item *MetricDescriptor_Indices_PaginationView) { 6082 if item != nil { 6083 switch fp.selector { 6084 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 6085 item.Name = "" 6086 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6087 item.FilterableMetricKeys = nil 6088 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6089 item.FilterableResourceKeys = nil 6090 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6091 item.PaginatedMetricKeys = nil 6092 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6093 item.PaginatedResourceKeys = nil 6094 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 6095 item.ClosingStatus = MetricDescriptor_Indices_UNDEFINED 6096 default: 6097 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", fp.selector)) 6098 } 6099 } 6100 } 6101 6102 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) ClearValueRaw(item proto.Message) { 6103 fp.ClearValue(item.(*MetricDescriptor_Indices_PaginationView)) 6104 } 6105 6106 // IsLeaf - whether field path is holds simple value 6107 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) IsLeaf() bool { 6108 return fp.selector == MetricDescriptorIndicesPaginationView_FieldPathSelectorName || 6109 fp.selector == MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys || 6110 fp.selector == MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys || 6111 fp.selector == MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys || 6112 fp.selector == MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys || 6113 fp.selector == MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus 6114 } 6115 6116 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 6117 return []gotenobject.FieldPath{fp} 6118 } 6119 6120 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndicesPaginationView_FieldPathValue { 6121 switch fp.selector { 6122 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 6123 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.(string)} 6124 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6125 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.([]string)} 6126 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6127 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.([]string)} 6128 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6129 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.([]string)} 6130 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6131 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.([]string)} 6132 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 6133 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.(MetricDescriptor_Indices_CloseStatus)} 6134 default: 6135 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", fp.selector)) 6136 } 6137 } 6138 6139 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 6140 return fp.WithIValue(value) 6141 } 6142 6143 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues { 6144 fpaov := &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp} 6145 switch fp.selector { 6146 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 6147 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, values: values.([]string)} 6148 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6149 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, values: values.([][]string)} 6150 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6151 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, values: values.([][]string)} 6152 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6153 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, values: values.([][]string)} 6154 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6155 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, values: values.([][]string)} 6156 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 6157 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, values: values.([]MetricDescriptor_Indices_CloseStatus)} 6158 default: 6159 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", fp.selector)) 6160 } 6161 return fpaov 6162 } 6163 6164 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 6165 return fp.WithIArrayOfValues(values) 6166 } 6167 6168 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue { 6169 switch fp.selector { 6170 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6171 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.(string)} 6172 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6173 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.(string)} 6174 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6175 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.(string)} 6176 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6177 return &MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPaginationView_FieldTerminalPath: *fp, value: value.(string)} 6178 default: 6179 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", fp.selector)) 6180 } 6181 } 6182 6183 func (fp *MetricDescriptorIndicesPaginationView_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 6184 return fp.WithIArrayItemValue(value) 6185 } 6186 6187 // MetricDescriptorIndicesPaginationView_FieldPathValue allows storing values for PaginationView fields according to their type 6188 type MetricDescriptorIndicesPaginationView_FieldPathValue interface { 6189 MetricDescriptorIndicesPaginationView_FieldPath 6190 gotenobject.FieldPathValue 6191 SetTo(target **MetricDescriptor_Indices_PaginationView) 6192 CompareWith(*MetricDescriptor_Indices_PaginationView) (cmp int, comparable bool) 6193 } 6194 6195 func ParseMetricDescriptorIndicesPaginationView_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndicesPaginationView_FieldPathValue, error) { 6196 fp, err := ParseMetricDescriptorIndicesPaginationView_FieldPath(pathStr) 6197 if err != nil { 6198 return nil, err 6199 } 6200 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 6201 if err != nil { 6202 return nil, status.Errorf(codes.InvalidArgument, "error parsing PaginationView field path value from %s: %v", valueStr, err) 6203 } 6204 return fpv.(MetricDescriptorIndicesPaginationView_FieldPathValue), nil 6205 } 6206 6207 func MustParseMetricDescriptorIndicesPaginationView_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndicesPaginationView_FieldPathValue { 6208 fpv, err := ParseMetricDescriptorIndicesPaginationView_FieldPathValue(pathStr, valueStr) 6209 if err != nil { 6210 panic(err) 6211 } 6212 return fpv 6213 } 6214 6215 type MetricDescriptorIndicesPaginationView_FieldTerminalPathValue struct { 6216 MetricDescriptorIndicesPaginationView_FieldTerminalPath 6217 value interface{} 6218 } 6219 6220 var _ MetricDescriptorIndicesPaginationView_FieldPathValue = (*MetricDescriptorIndicesPaginationView_FieldTerminalPathValue)(nil) 6221 6222 // GetRawValue returns raw value stored under selected path for 'PaginationView' as interface{} 6223 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) GetRawValue() interface{} { 6224 return fpv.value 6225 } 6226 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) AsNameValue() (string, bool) { 6227 res, ok := fpv.value.(string) 6228 return res, ok 6229 } 6230 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) AsFilterableMetricKeysValue() ([]string, bool) { 6231 res, ok := fpv.value.([]string) 6232 return res, ok 6233 } 6234 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) AsFilterableResourceKeysValue() ([]string, bool) { 6235 res, ok := fpv.value.([]string) 6236 return res, ok 6237 } 6238 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) AsPaginatedMetricKeysValue() ([]string, bool) { 6239 res, ok := fpv.value.([]string) 6240 return res, ok 6241 } 6242 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) AsPaginatedResourceKeysValue() ([]string, bool) { 6243 res, ok := fpv.value.([]string) 6244 return res, ok 6245 } 6246 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) AsClosingStatusValue() (MetricDescriptor_Indices_CloseStatus, bool) { 6247 res, ok := fpv.value.(MetricDescriptor_Indices_CloseStatus) 6248 return res, ok 6249 } 6250 6251 // SetTo stores value for selected field for object PaginationView 6252 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) SetTo(target **MetricDescriptor_Indices_PaginationView) { 6253 if *target == nil { 6254 *target = new(MetricDescriptor_Indices_PaginationView) 6255 } 6256 switch fpv.selector { 6257 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 6258 (*target).Name = fpv.value.(string) 6259 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6260 (*target).FilterableMetricKeys = fpv.value.([]string) 6261 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6262 (*target).FilterableResourceKeys = fpv.value.([]string) 6263 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6264 (*target).PaginatedMetricKeys = fpv.value.([]string) 6265 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6266 (*target).PaginatedResourceKeys = fpv.value.([]string) 6267 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 6268 (*target).ClosingStatus = fpv.value.(MetricDescriptor_Indices_CloseStatus) 6269 default: 6270 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", fpv.selector)) 6271 } 6272 } 6273 6274 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) SetToRaw(target proto.Message) { 6275 typedObject := target.(*MetricDescriptor_Indices_PaginationView) 6276 fpv.SetTo(&typedObject) 6277 } 6278 6279 // CompareWith compares value in the 'MetricDescriptorIndicesPaginationView_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_Indices_PaginationView'. 6280 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_Indices_PaginationView) (int, bool) { 6281 switch fpv.selector { 6282 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 6283 leftValue := fpv.value.(string) 6284 rightValue := source.GetName() 6285 if (leftValue) == (rightValue) { 6286 return 0, true 6287 } else if (leftValue) < (rightValue) { 6288 return -1, true 6289 } else { 6290 return 1, true 6291 } 6292 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6293 return 0, false 6294 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6295 return 0, false 6296 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6297 return 0, false 6298 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6299 return 0, false 6300 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 6301 leftValue := fpv.value.(MetricDescriptor_Indices_CloseStatus) 6302 rightValue := source.GetClosingStatus() 6303 if (leftValue) == (rightValue) { 6304 return 0, true 6305 } else if (leftValue) < (rightValue) { 6306 return -1, true 6307 } else { 6308 return 1, true 6309 } 6310 default: 6311 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationView: %d", fpv.selector)) 6312 } 6313 } 6314 6315 func (fpv *MetricDescriptorIndicesPaginationView_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 6316 return fpv.CompareWith(source.(*MetricDescriptor_Indices_PaginationView)) 6317 } 6318 6319 // MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue allows storing single item in Path-specific values for PaginationView according to their type 6320 // Present only for array (repeated) types. 6321 type MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue interface { 6322 gotenobject.FieldPathArrayItemValue 6323 MetricDescriptorIndicesPaginationView_FieldPath 6324 ContainsValue(*MetricDescriptor_Indices_PaginationView) bool 6325 } 6326 6327 // ParseMetricDescriptorIndicesPaginationView_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 6328 func ParseMetricDescriptorIndicesPaginationView_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue, error) { 6329 fp, err := ParseMetricDescriptorIndicesPaginationView_FieldPath(pathStr) 6330 if err != nil { 6331 return nil, err 6332 } 6333 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 6334 if err != nil { 6335 return nil, status.Errorf(codes.InvalidArgument, "error parsing PaginationView field path array item value from %s: %v", valueStr, err) 6336 } 6337 return fpaiv.(MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue), nil 6338 } 6339 6340 func MustParseMetricDescriptorIndicesPaginationView_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue { 6341 fpaiv, err := ParseMetricDescriptorIndicesPaginationView_FieldPathArrayItemValue(pathStr, valueStr) 6342 if err != nil { 6343 panic(err) 6344 } 6345 return fpaiv 6346 } 6347 6348 type MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue struct { 6349 MetricDescriptorIndicesPaginationView_FieldTerminalPath 6350 value interface{} 6351 } 6352 6353 var _ MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue = (*MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue)(nil) 6354 6355 // GetRawValue returns stored element value for array in object MetricDescriptor_Indices_PaginationView as interface{} 6356 func (fpaiv *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 6357 return fpaiv.value 6358 } 6359 func (fpaiv *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue) AsFilterableMetricKeysItemValue() (string, bool) { 6360 res, ok := fpaiv.value.(string) 6361 return res, ok 6362 } 6363 func (fpaiv *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue) AsFilterableResourceKeysItemValue() (string, bool) { 6364 res, ok := fpaiv.value.(string) 6365 return res, ok 6366 } 6367 func (fpaiv *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue) AsPaginatedMetricKeysItemValue() (string, bool) { 6368 res, ok := fpaiv.value.(string) 6369 return res, ok 6370 } 6371 func (fpaiv *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue) AsPaginatedResourceKeysItemValue() (string, bool) { 6372 res, ok := fpaiv.value.(string) 6373 return res, ok 6374 } 6375 6376 func (fpaiv *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_Indices_PaginationView) (interface{}, bool) { 6377 return nil, false 6378 } 6379 6380 func (fpaiv *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 6381 return fpaiv.GetSingle(source.(*MetricDescriptor_Indices_PaginationView)) 6382 } 6383 6384 // Contains returns a boolean indicating if value that is being held is present in given 'PaginationView' 6385 func (fpaiv *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_PaginationView) bool { 6386 slice := fpaiv.MetricDescriptorIndicesPaginationView_FieldTerminalPath.Get(source) 6387 for _, v := range slice { 6388 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 6389 if proto.Equal(asProtoMsg, v.(proto.Message)) { 6390 return true 6391 } 6392 } else if reflect.DeepEqual(v, fpaiv.value) { 6393 return true 6394 } 6395 } 6396 return false 6397 } 6398 6399 // MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues allows storing slice of values for PaginationView fields according to their type 6400 type MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues interface { 6401 gotenobject.FieldPathArrayOfValues 6402 MetricDescriptorIndicesPaginationView_FieldPath 6403 } 6404 6405 func ParseMetricDescriptorIndicesPaginationView_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues, error) { 6406 fp, err := ParseMetricDescriptorIndicesPaginationView_FieldPath(pathStr) 6407 if err != nil { 6408 return nil, err 6409 } 6410 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 6411 if err != nil { 6412 return nil, status.Errorf(codes.InvalidArgument, "error parsing PaginationView field path array of values from %s: %v", valuesStr, err) 6413 } 6414 return fpaov.(MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues), nil 6415 } 6416 6417 func MustParseMetricDescriptorIndicesPaginationView_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues { 6418 fpaov, err := ParseMetricDescriptorIndicesPaginationView_FieldPathArrayOfValues(pathStr, valuesStr) 6419 if err != nil { 6420 panic(err) 6421 } 6422 return fpaov 6423 } 6424 6425 type MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues struct { 6426 MetricDescriptorIndicesPaginationView_FieldTerminalPath 6427 values interface{} 6428 } 6429 6430 var _ MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues = (*MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues)(nil) 6431 6432 func (fpaov *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 6433 switch fpaov.selector { 6434 case MetricDescriptorIndicesPaginationView_FieldPathSelectorName: 6435 for _, v := range fpaov.values.([]string) { 6436 values = append(values, v) 6437 } 6438 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableMetricKeys: 6439 for _, v := range fpaov.values.([][]string) { 6440 values = append(values, v) 6441 } 6442 case MetricDescriptorIndicesPaginationView_FieldPathSelectorFilterableResourceKeys: 6443 for _, v := range fpaov.values.([][]string) { 6444 values = append(values, v) 6445 } 6446 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedMetricKeys: 6447 for _, v := range fpaov.values.([][]string) { 6448 values = append(values, v) 6449 } 6450 case MetricDescriptorIndicesPaginationView_FieldPathSelectorPaginatedResourceKeys: 6451 for _, v := range fpaov.values.([][]string) { 6452 values = append(values, v) 6453 } 6454 case MetricDescriptorIndicesPaginationView_FieldPathSelectorClosingStatus: 6455 for _, v := range fpaov.values.([]MetricDescriptor_Indices_CloseStatus) { 6456 values = append(values, v) 6457 } 6458 } 6459 return 6460 } 6461 func (fpaov *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]string, bool) { 6462 res, ok := fpaov.values.([]string) 6463 return res, ok 6464 } 6465 func (fpaov *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues) AsFilterableMetricKeysArrayOfValues() ([][]string, bool) { 6466 res, ok := fpaov.values.([][]string) 6467 return res, ok 6468 } 6469 func (fpaov *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues) AsFilterableResourceKeysArrayOfValues() ([][]string, bool) { 6470 res, ok := fpaov.values.([][]string) 6471 return res, ok 6472 } 6473 func (fpaov *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues) AsPaginatedMetricKeysArrayOfValues() ([][]string, bool) { 6474 res, ok := fpaov.values.([][]string) 6475 return res, ok 6476 } 6477 func (fpaov *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues) AsPaginatedResourceKeysArrayOfValues() ([][]string, bool) { 6478 res, ok := fpaov.values.([][]string) 6479 return res, ok 6480 } 6481 func (fpaov *MetricDescriptorIndicesPaginationView_FieldTerminalPathArrayOfValues) AsClosingStatusArrayOfValues() ([]MetricDescriptor_Indices_CloseStatus, bool) { 6482 res, ok := fpaov.values.([]MetricDescriptor_Indices_CloseStatus) 6483 return res, ok 6484 } 6485 6486 // FieldPath provides implementation to handle 6487 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 6488 type MetricDescriptorIndicesAggregationsGroup_FieldPath interface { 6489 gotenobject.FieldPath 6490 Selector() MetricDescriptorIndicesAggregationsGroup_FieldPathSelector 6491 Get(source *MetricDescriptor_Indices_AggregationsGroup) []interface{} 6492 GetSingle(source *MetricDescriptor_Indices_AggregationsGroup) (interface{}, bool) 6493 ClearValue(item *MetricDescriptor_Indices_AggregationsGroup) 6494 6495 // Those methods build corresponding MetricDescriptorIndicesAggregationsGroup_FieldPathValue 6496 // (or array of values) and holds passed value. Panics if injected type is incorrect. 6497 WithIValue(value interface{}) MetricDescriptorIndicesAggregationsGroup_FieldPathValue 6498 WithIArrayOfValues(values interface{}) MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues 6499 WithIArrayItemValue(value interface{}) MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue 6500 } 6501 6502 type MetricDescriptorIndicesAggregationsGroup_FieldPathSelector int32 6503 6504 const ( 6505 MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName MetricDescriptorIndicesAggregationsGroup_FieldPathSelector = 0 6506 MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners MetricDescriptorIndicesAggregationsGroup_FieldPathSelector = 1 6507 MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers MetricDescriptorIndicesAggregationsGroup_FieldPathSelector = 2 6508 MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus MetricDescriptorIndicesAggregationsGroup_FieldPathSelector = 3 6509 MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners MetricDescriptorIndicesAggregationsGroup_FieldPathSelector = 4 6510 ) 6511 6512 func (s MetricDescriptorIndicesAggregationsGroup_FieldPathSelector) String() string { 6513 switch s { 6514 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6515 return "name" 6516 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6517 return "per_series_aligners" 6518 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6519 return "cross_series_reducers" 6520 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 6521 return "closing_status" 6522 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6523 return "storage_aligners" 6524 default: 6525 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", s)) 6526 } 6527 } 6528 6529 func BuildMetricDescriptorIndicesAggregationsGroup_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndicesAggregationsGroup_FieldPath, error) { 6530 if len(fp) == 0 { 6531 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_Indices_AggregationsGroup") 6532 } 6533 if len(fp) == 1 { 6534 switch fp[0] { 6535 case "name": 6536 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName}, nil 6537 case "per_series_aligners", "perSeriesAligners", "per-series-aligners": 6538 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners}, nil 6539 case "cross_series_reducers", "crossSeriesReducers", "cross-series-reducers": 6540 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers}, nil 6541 case "closing_status", "closingStatus", "closing-status": 6542 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus}, nil 6543 case "storage_aligners", "storageAligners", "storage-aligners": 6544 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath{selector: MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners}, nil 6545 } 6546 } 6547 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_Indices_AggregationsGroup", fp) 6548 } 6549 6550 func ParseMetricDescriptorIndicesAggregationsGroup_FieldPath(rawField string) (MetricDescriptorIndicesAggregationsGroup_FieldPath, error) { 6551 fp, err := gotenobject.ParseRawFieldPath(rawField) 6552 if err != nil { 6553 return nil, err 6554 } 6555 return BuildMetricDescriptorIndicesAggregationsGroup_FieldPath(fp) 6556 } 6557 6558 func MustParseMetricDescriptorIndicesAggregationsGroup_FieldPath(rawField string) MetricDescriptorIndicesAggregationsGroup_FieldPath { 6559 fp, err := ParseMetricDescriptorIndicesAggregationsGroup_FieldPath(rawField) 6560 if err != nil { 6561 panic(err) 6562 } 6563 return fp 6564 } 6565 6566 type MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath struct { 6567 selector MetricDescriptorIndicesAggregationsGroup_FieldPathSelector 6568 } 6569 6570 var _ MetricDescriptorIndicesAggregationsGroup_FieldPath = (*MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath)(nil) 6571 6572 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) Selector() MetricDescriptorIndicesAggregationsGroup_FieldPathSelector { 6573 return fp.selector 6574 } 6575 6576 // String returns path representation in proto convention 6577 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) String() string { 6578 return fp.selector.String() 6579 } 6580 6581 // JSONString returns path representation is JSON convention 6582 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) JSONString() string { 6583 return strcase.ToLowerCamel(fp.String()) 6584 } 6585 6586 // Get returns all values pointed by specific field from source MetricDescriptor_Indices_AggregationsGroup 6587 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) Get(source *MetricDescriptor_Indices_AggregationsGroup) (values []interface{}) { 6588 if source != nil { 6589 switch fp.selector { 6590 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6591 values = append(values, source.Name) 6592 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6593 for _, value := range source.GetPerSeriesAligners() { 6594 values = append(values, value) 6595 } 6596 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6597 for _, value := range source.GetCrossSeriesReducers() { 6598 values = append(values, value) 6599 } 6600 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 6601 values = append(values, source.ClosingStatus) 6602 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6603 for _, value := range source.GetStorageAligners() { 6604 values = append(values, value) 6605 } 6606 default: 6607 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", fp.selector)) 6608 } 6609 } 6610 return 6611 } 6612 6613 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 6614 return fp.Get(source.(*MetricDescriptor_Indices_AggregationsGroup)) 6615 } 6616 6617 // GetSingle returns value pointed by specific field of from source MetricDescriptor_Indices_AggregationsGroup 6618 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) GetSingle(source *MetricDescriptor_Indices_AggregationsGroup) (interface{}, bool) { 6619 switch fp.selector { 6620 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6621 return source.GetName(), source != nil 6622 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6623 res := source.GetPerSeriesAligners() 6624 return res, res != nil 6625 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6626 res := source.GetCrossSeriesReducers() 6627 return res, res != nil 6628 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 6629 return source.GetClosingStatus(), source != nil 6630 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6631 res := source.GetStorageAligners() 6632 return res, res != nil 6633 default: 6634 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", fp.selector)) 6635 } 6636 } 6637 6638 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 6639 return fp.GetSingle(source.(*MetricDescriptor_Indices_AggregationsGroup)) 6640 } 6641 6642 // GetDefault returns a default value of the field type 6643 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) GetDefault() interface{} { 6644 switch fp.selector { 6645 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6646 return "" 6647 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6648 return ([]common.Aggregation_Aligner)(nil) 6649 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6650 return ([]common.Aggregation_Reducer)(nil) 6651 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 6652 return MetricDescriptor_Indices_UNDEFINED 6653 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6654 return ([]common.Aggregation_Aligner)(nil) 6655 default: 6656 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", fp.selector)) 6657 } 6658 } 6659 6660 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) ClearValue(item *MetricDescriptor_Indices_AggregationsGroup) { 6661 if item != nil { 6662 switch fp.selector { 6663 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6664 item.Name = "" 6665 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6666 item.PerSeriesAligners = nil 6667 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6668 item.CrossSeriesReducers = nil 6669 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 6670 item.ClosingStatus = MetricDescriptor_Indices_UNDEFINED 6671 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6672 item.StorageAligners = nil 6673 default: 6674 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", fp.selector)) 6675 } 6676 } 6677 } 6678 6679 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) ClearValueRaw(item proto.Message) { 6680 fp.ClearValue(item.(*MetricDescriptor_Indices_AggregationsGroup)) 6681 } 6682 6683 // IsLeaf - whether field path is holds simple value 6684 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) IsLeaf() bool { 6685 return fp.selector == MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName || 6686 fp.selector == MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners || 6687 fp.selector == MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers || 6688 fp.selector == MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus || 6689 fp.selector == MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners 6690 } 6691 6692 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 6693 return []gotenobject.FieldPath{fp} 6694 } 6695 6696 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndicesAggregationsGroup_FieldPathValue { 6697 switch fp.selector { 6698 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6699 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, value: value.(string)} 6700 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6701 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, value: value.([]common.Aggregation_Aligner)} 6702 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6703 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, value: value.([]common.Aggregation_Reducer)} 6704 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 6705 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, value: value.(MetricDescriptor_Indices_CloseStatus)} 6706 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6707 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, value: value.([]common.Aggregation_Aligner)} 6708 default: 6709 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", fp.selector)) 6710 } 6711 } 6712 6713 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 6714 return fp.WithIValue(value) 6715 } 6716 6717 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues { 6718 fpaov := &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp} 6719 switch fp.selector { 6720 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6721 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, values: values.([]string)} 6722 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6723 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, values: values.([][]common.Aggregation_Aligner)} 6724 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6725 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, values: values.([][]common.Aggregation_Reducer)} 6726 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 6727 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, values: values.([]MetricDescriptor_Indices_CloseStatus)} 6728 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6729 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, values: values.([][]common.Aggregation_Aligner)} 6730 default: 6731 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", fp.selector)) 6732 } 6733 return fpaov 6734 } 6735 6736 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 6737 return fp.WithIArrayOfValues(values) 6738 } 6739 6740 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue { 6741 switch fp.selector { 6742 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6743 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, value: value.(common.Aggregation_Aligner)} 6744 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6745 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, value: value.(common.Aggregation_Reducer)} 6746 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6747 return &MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath: *fp, value: value.(common.Aggregation_Aligner)} 6748 default: 6749 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", fp.selector)) 6750 } 6751 } 6752 6753 func (fp *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 6754 return fp.WithIArrayItemValue(value) 6755 } 6756 6757 // MetricDescriptorIndicesAggregationsGroup_FieldPathValue allows storing values for AggregationsGroup fields according to their type 6758 type MetricDescriptorIndicesAggregationsGroup_FieldPathValue interface { 6759 MetricDescriptorIndicesAggregationsGroup_FieldPath 6760 gotenobject.FieldPathValue 6761 SetTo(target **MetricDescriptor_Indices_AggregationsGroup) 6762 CompareWith(*MetricDescriptor_Indices_AggregationsGroup) (cmp int, comparable bool) 6763 } 6764 6765 func ParseMetricDescriptorIndicesAggregationsGroup_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndicesAggregationsGroup_FieldPathValue, error) { 6766 fp, err := ParseMetricDescriptorIndicesAggregationsGroup_FieldPath(pathStr) 6767 if err != nil { 6768 return nil, err 6769 } 6770 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 6771 if err != nil { 6772 return nil, status.Errorf(codes.InvalidArgument, "error parsing AggregationsGroup field path value from %s: %v", valueStr, err) 6773 } 6774 return fpv.(MetricDescriptorIndicesAggregationsGroup_FieldPathValue), nil 6775 } 6776 6777 func MustParseMetricDescriptorIndicesAggregationsGroup_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndicesAggregationsGroup_FieldPathValue { 6778 fpv, err := ParseMetricDescriptorIndicesAggregationsGroup_FieldPathValue(pathStr, valueStr) 6779 if err != nil { 6780 panic(err) 6781 } 6782 return fpv 6783 } 6784 6785 type MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue struct { 6786 MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath 6787 value interface{} 6788 } 6789 6790 var _ MetricDescriptorIndicesAggregationsGroup_FieldPathValue = (*MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue)(nil) 6791 6792 // GetRawValue returns raw value stored under selected path for 'AggregationsGroup' as interface{} 6793 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) GetRawValue() interface{} { 6794 return fpv.value 6795 } 6796 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) AsNameValue() (string, bool) { 6797 res, ok := fpv.value.(string) 6798 return res, ok 6799 } 6800 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) AsPerSeriesAlignersValue() ([]common.Aggregation_Aligner, bool) { 6801 res, ok := fpv.value.([]common.Aggregation_Aligner) 6802 return res, ok 6803 } 6804 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) AsCrossSeriesReducersValue() ([]common.Aggregation_Reducer, bool) { 6805 res, ok := fpv.value.([]common.Aggregation_Reducer) 6806 return res, ok 6807 } 6808 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) AsClosingStatusValue() (MetricDescriptor_Indices_CloseStatus, bool) { 6809 res, ok := fpv.value.(MetricDescriptor_Indices_CloseStatus) 6810 return res, ok 6811 } 6812 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) AsStorageAlignersValue() ([]common.Aggregation_Aligner, bool) { 6813 res, ok := fpv.value.([]common.Aggregation_Aligner) 6814 return res, ok 6815 } 6816 6817 // SetTo stores value for selected field for object AggregationsGroup 6818 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) SetTo(target **MetricDescriptor_Indices_AggregationsGroup) { 6819 if *target == nil { 6820 *target = new(MetricDescriptor_Indices_AggregationsGroup) 6821 } 6822 switch fpv.selector { 6823 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6824 (*target).Name = fpv.value.(string) 6825 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6826 (*target).PerSeriesAligners = fpv.value.([]common.Aggregation_Aligner) 6827 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6828 (*target).CrossSeriesReducers = fpv.value.([]common.Aggregation_Reducer) 6829 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 6830 (*target).ClosingStatus = fpv.value.(MetricDescriptor_Indices_CloseStatus) 6831 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6832 (*target).StorageAligners = fpv.value.([]common.Aggregation_Aligner) 6833 default: 6834 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", fpv.selector)) 6835 } 6836 } 6837 6838 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) SetToRaw(target proto.Message) { 6839 typedObject := target.(*MetricDescriptor_Indices_AggregationsGroup) 6840 fpv.SetTo(&typedObject) 6841 } 6842 6843 // CompareWith compares value in the 'MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_Indices_AggregationsGroup'. 6844 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_Indices_AggregationsGroup) (int, bool) { 6845 switch fpv.selector { 6846 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6847 leftValue := fpv.value.(string) 6848 rightValue := source.GetName() 6849 if (leftValue) == (rightValue) { 6850 return 0, true 6851 } else if (leftValue) < (rightValue) { 6852 return -1, true 6853 } else { 6854 return 1, true 6855 } 6856 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6857 return 0, false 6858 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 6859 return 0, false 6860 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 6861 leftValue := fpv.value.(MetricDescriptor_Indices_CloseStatus) 6862 rightValue := source.GetClosingStatus() 6863 if (leftValue) == (rightValue) { 6864 return 0, true 6865 } else if (leftValue) < (rightValue) { 6866 return -1, true 6867 } else { 6868 return 1, true 6869 } 6870 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 6871 return 0, false 6872 default: 6873 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_AggregationsGroup: %d", fpv.selector)) 6874 } 6875 } 6876 6877 func (fpv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 6878 return fpv.CompareWith(source.(*MetricDescriptor_Indices_AggregationsGroup)) 6879 } 6880 6881 // MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue allows storing single item in Path-specific values for AggregationsGroup according to their type 6882 // Present only for array (repeated) types. 6883 type MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue interface { 6884 gotenobject.FieldPathArrayItemValue 6885 MetricDescriptorIndicesAggregationsGroup_FieldPath 6886 ContainsValue(*MetricDescriptor_Indices_AggregationsGroup) bool 6887 } 6888 6889 // ParseMetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 6890 func ParseMetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue, error) { 6891 fp, err := ParseMetricDescriptorIndicesAggregationsGroup_FieldPath(pathStr) 6892 if err != nil { 6893 return nil, err 6894 } 6895 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 6896 if err != nil { 6897 return nil, status.Errorf(codes.InvalidArgument, "error parsing AggregationsGroup field path array item value from %s: %v", valueStr, err) 6898 } 6899 return fpaiv.(MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue), nil 6900 } 6901 6902 func MustParseMetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue { 6903 fpaiv, err := ParseMetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue(pathStr, valueStr) 6904 if err != nil { 6905 panic(err) 6906 } 6907 return fpaiv 6908 } 6909 6910 type MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue struct { 6911 MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath 6912 value interface{} 6913 } 6914 6915 var _ MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue = (*MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue)(nil) 6916 6917 // GetRawValue returns stored element value for array in object MetricDescriptor_Indices_AggregationsGroup as interface{} 6918 func (fpaiv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 6919 return fpaiv.value 6920 } 6921 func (fpaiv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue) AsPerSeriesAlignersItemValue() (common.Aggregation_Aligner, bool) { 6922 res, ok := fpaiv.value.(common.Aggregation_Aligner) 6923 return res, ok 6924 } 6925 func (fpaiv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue) AsCrossSeriesReducersItemValue() (common.Aggregation_Reducer, bool) { 6926 res, ok := fpaiv.value.(common.Aggregation_Reducer) 6927 return res, ok 6928 } 6929 func (fpaiv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue) AsStorageAlignersItemValue() (common.Aggregation_Aligner, bool) { 6930 res, ok := fpaiv.value.(common.Aggregation_Aligner) 6931 return res, ok 6932 } 6933 6934 func (fpaiv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_Indices_AggregationsGroup) (interface{}, bool) { 6935 return nil, false 6936 } 6937 6938 func (fpaiv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 6939 return fpaiv.GetSingle(source.(*MetricDescriptor_Indices_AggregationsGroup)) 6940 } 6941 6942 // Contains returns a boolean indicating if value that is being held is present in given 'AggregationsGroup' 6943 func (fpaiv *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_AggregationsGroup) bool { 6944 slice := fpaiv.MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath.Get(source) 6945 for _, v := range slice { 6946 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 6947 if proto.Equal(asProtoMsg, v.(proto.Message)) { 6948 return true 6949 } 6950 } else if reflect.DeepEqual(v, fpaiv.value) { 6951 return true 6952 } 6953 } 6954 return false 6955 } 6956 6957 // MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues allows storing slice of values for AggregationsGroup fields according to their type 6958 type MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues interface { 6959 gotenobject.FieldPathArrayOfValues 6960 MetricDescriptorIndicesAggregationsGroup_FieldPath 6961 } 6962 6963 func ParseMetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues, error) { 6964 fp, err := ParseMetricDescriptorIndicesAggregationsGroup_FieldPath(pathStr) 6965 if err != nil { 6966 return nil, err 6967 } 6968 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 6969 if err != nil { 6970 return nil, status.Errorf(codes.InvalidArgument, "error parsing AggregationsGroup field path array of values from %s: %v", valuesStr, err) 6971 } 6972 return fpaov.(MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues), nil 6973 } 6974 6975 func MustParseMetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues { 6976 fpaov, err := ParseMetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues(pathStr, valuesStr) 6977 if err != nil { 6978 panic(err) 6979 } 6980 return fpaov 6981 } 6982 6983 type MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues struct { 6984 MetricDescriptorIndicesAggregationsGroup_FieldTerminalPath 6985 values interface{} 6986 } 6987 6988 var _ MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues = (*MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues)(nil) 6989 6990 func (fpaov *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 6991 switch fpaov.selector { 6992 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorName: 6993 for _, v := range fpaov.values.([]string) { 6994 values = append(values, v) 6995 } 6996 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorPerSeriesAligners: 6997 for _, v := range fpaov.values.([][]common.Aggregation_Aligner) { 6998 values = append(values, v) 6999 } 7000 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorCrossSeriesReducers: 7001 for _, v := range fpaov.values.([][]common.Aggregation_Reducer) { 7002 values = append(values, v) 7003 } 7004 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorClosingStatus: 7005 for _, v := range fpaov.values.([]MetricDescriptor_Indices_CloseStatus) { 7006 values = append(values, v) 7007 } 7008 case MetricDescriptorIndicesAggregationsGroup_FieldPathSelectorStorageAligners: 7009 for _, v := range fpaov.values.([][]common.Aggregation_Aligner) { 7010 values = append(values, v) 7011 } 7012 } 7013 return 7014 } 7015 func (fpaov *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]string, bool) { 7016 res, ok := fpaov.values.([]string) 7017 return res, ok 7018 } 7019 func (fpaov *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues) AsPerSeriesAlignersArrayOfValues() ([][]common.Aggregation_Aligner, bool) { 7020 res, ok := fpaov.values.([][]common.Aggregation_Aligner) 7021 return res, ok 7022 } 7023 func (fpaov *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues) AsCrossSeriesReducersArrayOfValues() ([][]common.Aggregation_Reducer, bool) { 7024 res, ok := fpaov.values.([][]common.Aggregation_Reducer) 7025 return res, ok 7026 } 7027 func (fpaov *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues) AsClosingStatusArrayOfValues() ([]MetricDescriptor_Indices_CloseStatus, bool) { 7028 res, ok := fpaov.values.([]MetricDescriptor_Indices_CloseStatus) 7029 return res, ok 7030 } 7031 func (fpaov *MetricDescriptorIndicesAggregationsGroup_FieldTerminalPathArrayOfValues) AsStorageAlignersArrayOfValues() ([][]common.Aggregation_Aligner, bool) { 7032 res, ok := fpaov.values.([][]common.Aggregation_Aligner) 7033 return res, ok 7034 } 7035 7036 // FieldPath provides implementation to handle 7037 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 7038 type MetricDescriptorIndicesSortingFunction_FieldPath interface { 7039 gotenobject.FieldPath 7040 Selector() MetricDescriptorIndicesSortingFunction_FieldPathSelector 7041 Get(source *MetricDescriptor_Indices_SortingFunction) []interface{} 7042 GetSingle(source *MetricDescriptor_Indices_SortingFunction) (interface{}, bool) 7043 ClearValue(item *MetricDescriptor_Indices_SortingFunction) 7044 7045 // Those methods build corresponding MetricDescriptorIndicesSortingFunction_FieldPathValue 7046 // (or array of values) and holds passed value. Panics if injected type is incorrect. 7047 WithIValue(value interface{}) MetricDescriptorIndicesSortingFunction_FieldPathValue 7048 WithIArrayOfValues(values interface{}) MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues 7049 WithIArrayItemValue(value interface{}) MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue 7050 } 7051 7052 type MetricDescriptorIndicesSortingFunction_FieldPathSelector int32 7053 7054 const ( 7055 MetricDescriptorIndicesSortingFunction_FieldPathSelectorName MetricDescriptorIndicesSortingFunction_FieldPathSelector = 0 7056 MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner MetricDescriptorIndicesSortingFunction_FieldPathSelector = 1 7057 MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer MetricDescriptorIndicesSortingFunction_FieldPathSelector = 2 7058 MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus MetricDescriptorIndicesSortingFunction_FieldPathSelector = 3 7059 MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting MetricDescriptorIndicesSortingFunction_FieldPathSelector = 4 7060 ) 7061 7062 func (s MetricDescriptorIndicesSortingFunction_FieldPathSelector) String() string { 7063 switch s { 7064 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7065 return "name" 7066 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7067 return "aligner" 7068 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7069 return "reducer" 7070 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7071 return "closing_status" 7072 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7073 return "sorting" 7074 default: 7075 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", s)) 7076 } 7077 } 7078 7079 func BuildMetricDescriptorIndicesSortingFunction_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndicesSortingFunction_FieldPath, error) { 7080 if len(fp) == 0 { 7081 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_Indices_SortingFunction") 7082 } 7083 if len(fp) == 1 { 7084 switch fp[0] { 7085 case "name": 7086 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorName}, nil 7087 case "aligner": 7088 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner}, nil 7089 case "reducer": 7090 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer}, nil 7091 case "closing_status", "closingStatus", "closing-status": 7092 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus}, nil 7093 case "sorting": 7094 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPath{selector: MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting}, nil 7095 } 7096 } 7097 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_Indices_SortingFunction", fp) 7098 } 7099 7100 func ParseMetricDescriptorIndicesSortingFunction_FieldPath(rawField string) (MetricDescriptorIndicesSortingFunction_FieldPath, error) { 7101 fp, err := gotenobject.ParseRawFieldPath(rawField) 7102 if err != nil { 7103 return nil, err 7104 } 7105 return BuildMetricDescriptorIndicesSortingFunction_FieldPath(fp) 7106 } 7107 7108 func MustParseMetricDescriptorIndicesSortingFunction_FieldPath(rawField string) MetricDescriptorIndicesSortingFunction_FieldPath { 7109 fp, err := ParseMetricDescriptorIndicesSortingFunction_FieldPath(rawField) 7110 if err != nil { 7111 panic(err) 7112 } 7113 return fp 7114 } 7115 7116 type MetricDescriptorIndicesSortingFunction_FieldTerminalPath struct { 7117 selector MetricDescriptorIndicesSortingFunction_FieldPathSelector 7118 } 7119 7120 var _ MetricDescriptorIndicesSortingFunction_FieldPath = (*MetricDescriptorIndicesSortingFunction_FieldTerminalPath)(nil) 7121 7122 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) Selector() MetricDescriptorIndicesSortingFunction_FieldPathSelector { 7123 return fp.selector 7124 } 7125 7126 // String returns path representation in proto convention 7127 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) String() string { 7128 return fp.selector.String() 7129 } 7130 7131 // JSONString returns path representation is JSON convention 7132 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) JSONString() string { 7133 return strcase.ToLowerCamel(fp.String()) 7134 } 7135 7136 // Get returns all values pointed by specific field from source MetricDescriptor_Indices_SortingFunction 7137 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) Get(source *MetricDescriptor_Indices_SortingFunction) (values []interface{}) { 7138 if source != nil { 7139 switch fp.selector { 7140 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7141 values = append(values, source.Name) 7142 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7143 values = append(values, source.Aligner) 7144 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7145 values = append(values, source.Reducer) 7146 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7147 values = append(values, source.ClosingStatus) 7148 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7149 values = append(values, source.Sorting) 7150 default: 7151 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", fp.selector)) 7152 } 7153 } 7154 return 7155 } 7156 7157 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 7158 return fp.Get(source.(*MetricDescriptor_Indices_SortingFunction)) 7159 } 7160 7161 // GetSingle returns value pointed by specific field of from source MetricDescriptor_Indices_SortingFunction 7162 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) GetSingle(source *MetricDescriptor_Indices_SortingFunction) (interface{}, bool) { 7163 switch fp.selector { 7164 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7165 return source.GetName(), source != nil 7166 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7167 return source.GetAligner(), source != nil 7168 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7169 return source.GetReducer(), source != nil 7170 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7171 return source.GetClosingStatus(), source != nil 7172 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7173 return source.GetSorting(), source != nil 7174 default: 7175 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", fp.selector)) 7176 } 7177 } 7178 7179 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 7180 return fp.GetSingle(source.(*MetricDescriptor_Indices_SortingFunction)) 7181 } 7182 7183 // GetDefault returns a default value of the field type 7184 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) GetDefault() interface{} { 7185 switch fp.selector { 7186 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7187 return "" 7188 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7189 return common.Aggregation_ALIGN_NONE 7190 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7191 return common.Aggregation_REDUCE_NONE 7192 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7193 return MetricDescriptor_Indices_UNDEFINED 7194 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7195 return MetricDescriptor_Indices_SortingFunction_UNDEFINED 7196 default: 7197 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", fp.selector)) 7198 } 7199 } 7200 7201 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) ClearValue(item *MetricDescriptor_Indices_SortingFunction) { 7202 if item != nil { 7203 switch fp.selector { 7204 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7205 item.Name = "" 7206 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7207 item.Aligner = common.Aggregation_ALIGN_NONE 7208 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7209 item.Reducer = common.Aggregation_REDUCE_NONE 7210 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7211 item.ClosingStatus = MetricDescriptor_Indices_UNDEFINED 7212 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7213 item.Sorting = MetricDescriptor_Indices_SortingFunction_UNDEFINED 7214 default: 7215 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", fp.selector)) 7216 } 7217 } 7218 } 7219 7220 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) ClearValueRaw(item proto.Message) { 7221 fp.ClearValue(item.(*MetricDescriptor_Indices_SortingFunction)) 7222 } 7223 7224 // IsLeaf - whether field path is holds simple value 7225 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) IsLeaf() bool { 7226 return fp.selector == MetricDescriptorIndicesSortingFunction_FieldPathSelectorName || 7227 fp.selector == MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner || 7228 fp.selector == MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer || 7229 fp.selector == MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus || 7230 fp.selector == MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting 7231 } 7232 7233 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 7234 return []gotenobject.FieldPath{fp} 7235 } 7236 7237 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndicesSortingFunction_FieldPathValue { 7238 switch fp.selector { 7239 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7240 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, value: value.(string)} 7241 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7242 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, value: value.(common.Aggregation_Aligner)} 7243 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7244 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, value: value.(common.Aggregation_Reducer)} 7245 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7246 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, value: value.(MetricDescriptor_Indices_CloseStatus)} 7247 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7248 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, value: value.(MetricDescriptor_Indices_SortingFunction_Direction)} 7249 default: 7250 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", fp.selector)) 7251 } 7252 } 7253 7254 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 7255 return fp.WithIValue(value) 7256 } 7257 7258 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues { 7259 fpaov := &MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp} 7260 switch fp.selector { 7261 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7262 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, values: values.([]string)} 7263 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7264 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, values: values.([]common.Aggregation_Aligner)} 7265 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7266 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, values: values.([]common.Aggregation_Reducer)} 7267 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7268 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, values: values.([]MetricDescriptor_Indices_CloseStatus)} 7269 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7270 return &MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesSortingFunction_FieldTerminalPath: *fp, values: values.([]MetricDescriptor_Indices_SortingFunction_Direction)} 7271 default: 7272 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", fp.selector)) 7273 } 7274 return fpaov 7275 } 7276 7277 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 7278 return fp.WithIArrayOfValues(values) 7279 } 7280 7281 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue { 7282 switch fp.selector { 7283 default: 7284 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", fp.selector)) 7285 } 7286 } 7287 7288 func (fp *MetricDescriptorIndicesSortingFunction_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 7289 return fp.WithIArrayItemValue(value) 7290 } 7291 7292 // MetricDescriptorIndicesSortingFunction_FieldPathValue allows storing values for SortingFunction fields according to their type 7293 type MetricDescriptorIndicesSortingFunction_FieldPathValue interface { 7294 MetricDescriptorIndicesSortingFunction_FieldPath 7295 gotenobject.FieldPathValue 7296 SetTo(target **MetricDescriptor_Indices_SortingFunction) 7297 CompareWith(*MetricDescriptor_Indices_SortingFunction) (cmp int, comparable bool) 7298 } 7299 7300 func ParseMetricDescriptorIndicesSortingFunction_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndicesSortingFunction_FieldPathValue, error) { 7301 fp, err := ParseMetricDescriptorIndicesSortingFunction_FieldPath(pathStr) 7302 if err != nil { 7303 return nil, err 7304 } 7305 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 7306 if err != nil { 7307 return nil, status.Errorf(codes.InvalidArgument, "error parsing SortingFunction field path value from %s: %v", valueStr, err) 7308 } 7309 return fpv.(MetricDescriptorIndicesSortingFunction_FieldPathValue), nil 7310 } 7311 7312 func MustParseMetricDescriptorIndicesSortingFunction_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndicesSortingFunction_FieldPathValue { 7313 fpv, err := ParseMetricDescriptorIndicesSortingFunction_FieldPathValue(pathStr, valueStr) 7314 if err != nil { 7315 panic(err) 7316 } 7317 return fpv 7318 } 7319 7320 type MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue struct { 7321 MetricDescriptorIndicesSortingFunction_FieldTerminalPath 7322 value interface{} 7323 } 7324 7325 var _ MetricDescriptorIndicesSortingFunction_FieldPathValue = (*MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue)(nil) 7326 7327 // GetRawValue returns raw value stored under selected path for 'SortingFunction' as interface{} 7328 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) GetRawValue() interface{} { 7329 return fpv.value 7330 } 7331 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) AsNameValue() (string, bool) { 7332 res, ok := fpv.value.(string) 7333 return res, ok 7334 } 7335 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) AsAlignerValue() (common.Aggregation_Aligner, bool) { 7336 res, ok := fpv.value.(common.Aggregation_Aligner) 7337 return res, ok 7338 } 7339 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) AsReducerValue() (common.Aggregation_Reducer, bool) { 7340 res, ok := fpv.value.(common.Aggregation_Reducer) 7341 return res, ok 7342 } 7343 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) AsClosingStatusValue() (MetricDescriptor_Indices_CloseStatus, bool) { 7344 res, ok := fpv.value.(MetricDescriptor_Indices_CloseStatus) 7345 return res, ok 7346 } 7347 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) AsSortingValue() (MetricDescriptor_Indices_SortingFunction_Direction, bool) { 7348 res, ok := fpv.value.(MetricDescriptor_Indices_SortingFunction_Direction) 7349 return res, ok 7350 } 7351 7352 // SetTo stores value for selected field for object SortingFunction 7353 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) SetTo(target **MetricDescriptor_Indices_SortingFunction) { 7354 if *target == nil { 7355 *target = new(MetricDescriptor_Indices_SortingFunction) 7356 } 7357 switch fpv.selector { 7358 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7359 (*target).Name = fpv.value.(string) 7360 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7361 (*target).Aligner = fpv.value.(common.Aggregation_Aligner) 7362 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7363 (*target).Reducer = fpv.value.(common.Aggregation_Reducer) 7364 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7365 (*target).ClosingStatus = fpv.value.(MetricDescriptor_Indices_CloseStatus) 7366 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7367 (*target).Sorting = fpv.value.(MetricDescriptor_Indices_SortingFunction_Direction) 7368 default: 7369 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", fpv.selector)) 7370 } 7371 } 7372 7373 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) SetToRaw(target proto.Message) { 7374 typedObject := target.(*MetricDescriptor_Indices_SortingFunction) 7375 fpv.SetTo(&typedObject) 7376 } 7377 7378 // CompareWith compares value in the 'MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_Indices_SortingFunction'. 7379 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_Indices_SortingFunction) (int, bool) { 7380 switch fpv.selector { 7381 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7382 leftValue := fpv.value.(string) 7383 rightValue := source.GetName() 7384 if (leftValue) == (rightValue) { 7385 return 0, true 7386 } else if (leftValue) < (rightValue) { 7387 return -1, true 7388 } else { 7389 return 1, true 7390 } 7391 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7392 leftValue := fpv.value.(common.Aggregation_Aligner) 7393 rightValue := source.GetAligner() 7394 if (leftValue) == (rightValue) { 7395 return 0, true 7396 } else if (leftValue) < (rightValue) { 7397 return -1, true 7398 } else { 7399 return 1, true 7400 } 7401 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7402 leftValue := fpv.value.(common.Aggregation_Reducer) 7403 rightValue := source.GetReducer() 7404 if (leftValue) == (rightValue) { 7405 return 0, true 7406 } else if (leftValue) < (rightValue) { 7407 return -1, true 7408 } else { 7409 return 1, true 7410 } 7411 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7412 leftValue := fpv.value.(MetricDescriptor_Indices_CloseStatus) 7413 rightValue := source.GetClosingStatus() 7414 if (leftValue) == (rightValue) { 7415 return 0, true 7416 } else if (leftValue) < (rightValue) { 7417 return -1, true 7418 } else { 7419 return 1, true 7420 } 7421 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7422 leftValue := fpv.value.(MetricDescriptor_Indices_SortingFunction_Direction) 7423 rightValue := source.GetSorting() 7424 if (leftValue) == (rightValue) { 7425 return 0, true 7426 } else if (leftValue) < (rightValue) { 7427 return -1, true 7428 } else { 7429 return 1, true 7430 } 7431 default: 7432 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_SortingFunction: %d", fpv.selector)) 7433 } 7434 } 7435 7436 func (fpv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 7437 return fpv.CompareWith(source.(*MetricDescriptor_Indices_SortingFunction)) 7438 } 7439 7440 // MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue allows storing single item in Path-specific values for SortingFunction according to their type 7441 // Present only for array (repeated) types. 7442 type MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue interface { 7443 gotenobject.FieldPathArrayItemValue 7444 MetricDescriptorIndicesSortingFunction_FieldPath 7445 ContainsValue(*MetricDescriptor_Indices_SortingFunction) bool 7446 } 7447 7448 // ParseMetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 7449 func ParseMetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue, error) { 7450 fp, err := ParseMetricDescriptorIndicesSortingFunction_FieldPath(pathStr) 7451 if err != nil { 7452 return nil, err 7453 } 7454 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 7455 if err != nil { 7456 return nil, status.Errorf(codes.InvalidArgument, "error parsing SortingFunction field path array item value from %s: %v", valueStr, err) 7457 } 7458 return fpaiv.(MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue), nil 7459 } 7460 7461 func MustParseMetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue { 7462 fpaiv, err := ParseMetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue(pathStr, valueStr) 7463 if err != nil { 7464 panic(err) 7465 } 7466 return fpaiv 7467 } 7468 7469 type MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayItemValue struct { 7470 MetricDescriptorIndicesSortingFunction_FieldTerminalPath 7471 value interface{} 7472 } 7473 7474 var _ MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue = (*MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayItemValue)(nil) 7475 7476 // GetRawValue returns stored element value for array in object MetricDescriptor_Indices_SortingFunction as interface{} 7477 func (fpaiv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 7478 return fpaiv.value 7479 } 7480 7481 func (fpaiv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_Indices_SortingFunction) (interface{}, bool) { 7482 return nil, false 7483 } 7484 7485 func (fpaiv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 7486 return fpaiv.GetSingle(source.(*MetricDescriptor_Indices_SortingFunction)) 7487 } 7488 7489 // Contains returns a boolean indicating if value that is being held is present in given 'SortingFunction' 7490 func (fpaiv *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_SortingFunction) bool { 7491 slice := fpaiv.MetricDescriptorIndicesSortingFunction_FieldTerminalPath.Get(source) 7492 for _, v := range slice { 7493 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 7494 if proto.Equal(asProtoMsg, v.(proto.Message)) { 7495 return true 7496 } 7497 } else if reflect.DeepEqual(v, fpaiv.value) { 7498 return true 7499 } 7500 } 7501 return false 7502 } 7503 7504 // MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues allows storing slice of values for SortingFunction fields according to their type 7505 type MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues interface { 7506 gotenobject.FieldPathArrayOfValues 7507 MetricDescriptorIndicesSortingFunction_FieldPath 7508 } 7509 7510 func ParseMetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues, error) { 7511 fp, err := ParseMetricDescriptorIndicesSortingFunction_FieldPath(pathStr) 7512 if err != nil { 7513 return nil, err 7514 } 7515 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 7516 if err != nil { 7517 return nil, status.Errorf(codes.InvalidArgument, "error parsing SortingFunction field path array of values from %s: %v", valuesStr, err) 7518 } 7519 return fpaov.(MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues), nil 7520 } 7521 7522 func MustParseMetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues { 7523 fpaov, err := ParseMetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues(pathStr, valuesStr) 7524 if err != nil { 7525 panic(err) 7526 } 7527 return fpaov 7528 } 7529 7530 type MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues struct { 7531 MetricDescriptorIndicesSortingFunction_FieldTerminalPath 7532 values interface{} 7533 } 7534 7535 var _ MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues = (*MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues)(nil) 7536 7537 func (fpaov *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 7538 switch fpaov.selector { 7539 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorName: 7540 for _, v := range fpaov.values.([]string) { 7541 values = append(values, v) 7542 } 7543 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorAligner: 7544 for _, v := range fpaov.values.([]common.Aggregation_Aligner) { 7545 values = append(values, v) 7546 } 7547 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorReducer: 7548 for _, v := range fpaov.values.([]common.Aggregation_Reducer) { 7549 values = append(values, v) 7550 } 7551 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorClosingStatus: 7552 for _, v := range fpaov.values.([]MetricDescriptor_Indices_CloseStatus) { 7553 values = append(values, v) 7554 } 7555 case MetricDescriptorIndicesSortingFunction_FieldPathSelectorSorting: 7556 for _, v := range fpaov.values.([]MetricDescriptor_Indices_SortingFunction_Direction) { 7557 values = append(values, v) 7558 } 7559 } 7560 return 7561 } 7562 func (fpaov *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]string, bool) { 7563 res, ok := fpaov.values.([]string) 7564 return res, ok 7565 } 7566 func (fpaov *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues) AsAlignerArrayOfValues() ([]common.Aggregation_Aligner, bool) { 7567 res, ok := fpaov.values.([]common.Aggregation_Aligner) 7568 return res, ok 7569 } 7570 func (fpaov *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues) AsReducerArrayOfValues() ([]common.Aggregation_Reducer, bool) { 7571 res, ok := fpaov.values.([]common.Aggregation_Reducer) 7572 return res, ok 7573 } 7574 func (fpaov *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues) AsClosingStatusArrayOfValues() ([]MetricDescriptor_Indices_CloseStatus, bool) { 7575 res, ok := fpaov.values.([]MetricDescriptor_Indices_CloseStatus) 7576 return res, ok 7577 } 7578 func (fpaov *MetricDescriptorIndicesSortingFunction_FieldTerminalPathArrayOfValues) AsSortingArrayOfValues() ([]MetricDescriptor_Indices_SortingFunction_Direction, bool) { 7579 res, ok := fpaov.values.([]MetricDescriptor_Indices_SortingFunction_Direction) 7580 return res, ok 7581 } 7582 7583 // FieldPath provides implementation to handle 7584 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 7585 type MetricDescriptorIndicesPreAggregatedIndices_FieldPath interface { 7586 gotenobject.FieldPath 7587 Selector() MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector 7588 Get(source *MetricDescriptor_Indices_PreAggregatedIndices) []interface{} 7589 GetSingle(source *MetricDescriptor_Indices_PreAggregatedIndices) (interface{}, bool) 7590 ClearValue(item *MetricDescriptor_Indices_PreAggregatedIndices) 7591 7592 // Those methods build corresponding MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue 7593 // (or array of values) and holds passed value. Panics if injected type is incorrect. 7594 WithIValue(value interface{}) MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue 7595 WithIArrayOfValues(values interface{}) MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues 7596 WithIArrayItemValue(value interface{}) MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue 7597 } 7598 7599 type MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector int32 7600 7601 const ( 7602 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector = 0 7603 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector = 1 7604 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector = 2 7605 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector = 3 7606 MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector = 4 7607 ) 7608 7609 func (s MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector) String() string { 7610 switch s { 7611 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 7612 return "name" 7613 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 7614 return "resource_types" 7615 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7616 return "partition_label_sets" 7617 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7618 return "filter_and_group_label_sets" 7619 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7620 return "supported_aggregations" 7621 default: 7622 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", s)) 7623 } 7624 } 7625 7626 func BuildMetricDescriptorIndicesPreAggregatedIndices_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndicesPreAggregatedIndices_FieldPath, error) { 7627 if len(fp) == 0 { 7628 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_Indices_PreAggregatedIndices") 7629 } 7630 if len(fp) == 1 { 7631 switch fp[0] { 7632 case "name": 7633 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName}, nil 7634 case "resource_types", "resourceTypes", "resource-types": 7635 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes}, nil 7636 case "partition_label_sets", "partitionLabelSets", "partition-label-sets": 7637 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets}, nil 7638 case "filter_and_group_label_sets", "filterAndGroupLabelSets", "filter-and-group-label-sets": 7639 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets}, nil 7640 case "supported_aggregations", "supportedAggregations", "supported-aggregations": 7641 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations}, nil 7642 } 7643 } else { 7644 switch fp[0] { 7645 case "partition_label_sets", "partitionLabelSets", "partition-label-sets": 7646 if subpath, err := BuildMetricDescriptorIndicesLabelsGroup_FieldPath(fp[1:]); err != nil { 7647 return nil, err 7648 } else { 7649 return &MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets, subPath: subpath}, nil 7650 } 7651 case "filter_and_group_label_sets", "filterAndGroupLabelSets", "filter-and-group-label-sets": 7652 if subpath, err := BuildMetricDescriptorIndicesLabelsGroup_FieldPath(fp[1:]); err != nil { 7653 return nil, err 7654 } else { 7655 return &MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets, subPath: subpath}, nil 7656 } 7657 case "supported_aggregations", "supportedAggregations", "supported-aggregations": 7658 if subpath, err := BuildMetricDescriptorIndicesAggregationsGroup_FieldPath(fp[1:]); err != nil { 7659 return nil, err 7660 } else { 7661 return &MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath{selector: MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations, subPath: subpath}, nil 7662 } 7663 } 7664 } 7665 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_Indices_PreAggregatedIndices", fp) 7666 } 7667 7668 func ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPath(rawField string) (MetricDescriptorIndicesPreAggregatedIndices_FieldPath, error) { 7669 fp, err := gotenobject.ParseRawFieldPath(rawField) 7670 if err != nil { 7671 return nil, err 7672 } 7673 return BuildMetricDescriptorIndicesPreAggregatedIndices_FieldPath(fp) 7674 } 7675 7676 func MustParseMetricDescriptorIndicesPreAggregatedIndices_FieldPath(rawField string) MetricDescriptorIndicesPreAggregatedIndices_FieldPath { 7677 fp, err := ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPath(rawField) 7678 if err != nil { 7679 panic(err) 7680 } 7681 return fp 7682 } 7683 7684 type MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath struct { 7685 selector MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector 7686 } 7687 7688 var _ MetricDescriptorIndicesPreAggregatedIndices_FieldPath = (*MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath)(nil) 7689 7690 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) Selector() MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector { 7691 return fp.selector 7692 } 7693 7694 // String returns path representation in proto convention 7695 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) String() string { 7696 return fp.selector.String() 7697 } 7698 7699 // JSONString returns path representation is JSON convention 7700 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) JSONString() string { 7701 return strcase.ToLowerCamel(fp.String()) 7702 } 7703 7704 // Get returns all values pointed by specific field from source MetricDescriptor_Indices_PreAggregatedIndices 7705 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) Get(source *MetricDescriptor_Indices_PreAggregatedIndices) (values []interface{}) { 7706 if source != nil { 7707 switch fp.selector { 7708 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 7709 values = append(values, source.Name) 7710 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 7711 for _, value := range source.GetResourceTypes() { 7712 values = append(values, value) 7713 } 7714 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7715 for _, value := range source.GetPartitionLabelSets() { 7716 values = append(values, value) 7717 } 7718 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7719 for _, value := range source.GetFilterAndGroupLabelSets() { 7720 values = append(values, value) 7721 } 7722 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7723 for _, value := range source.GetSupportedAggregations() { 7724 values = append(values, value) 7725 } 7726 default: 7727 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fp.selector)) 7728 } 7729 } 7730 return 7731 } 7732 7733 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 7734 return fp.Get(source.(*MetricDescriptor_Indices_PreAggregatedIndices)) 7735 } 7736 7737 // GetSingle returns value pointed by specific field of from source MetricDescriptor_Indices_PreAggregatedIndices 7738 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) GetSingle(source *MetricDescriptor_Indices_PreAggregatedIndices) (interface{}, bool) { 7739 switch fp.selector { 7740 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 7741 return source.GetName(), source != nil 7742 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 7743 res := source.GetResourceTypes() 7744 return res, res != nil 7745 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7746 res := source.GetPartitionLabelSets() 7747 return res, res != nil 7748 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7749 res := source.GetFilterAndGroupLabelSets() 7750 return res, res != nil 7751 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7752 res := source.GetSupportedAggregations() 7753 return res, res != nil 7754 default: 7755 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fp.selector)) 7756 } 7757 } 7758 7759 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 7760 return fp.GetSingle(source.(*MetricDescriptor_Indices_PreAggregatedIndices)) 7761 } 7762 7763 // GetDefault returns a default value of the field type 7764 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) GetDefault() interface{} { 7765 switch fp.selector { 7766 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 7767 return "" 7768 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 7769 return ([]string)(nil) 7770 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7771 return ([]*MetricDescriptor_Indices_LabelsGroup)(nil) 7772 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7773 return ([]*MetricDescriptor_Indices_LabelsGroup)(nil) 7774 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7775 return ([]*MetricDescriptor_Indices_AggregationsGroup)(nil) 7776 default: 7777 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fp.selector)) 7778 } 7779 } 7780 7781 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) ClearValue(item *MetricDescriptor_Indices_PreAggregatedIndices) { 7782 if item != nil { 7783 switch fp.selector { 7784 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 7785 item.Name = "" 7786 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 7787 item.ResourceTypes = nil 7788 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7789 item.PartitionLabelSets = nil 7790 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7791 item.FilterAndGroupLabelSets = nil 7792 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7793 item.SupportedAggregations = nil 7794 default: 7795 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fp.selector)) 7796 } 7797 } 7798 } 7799 7800 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) ClearValueRaw(item proto.Message) { 7801 fp.ClearValue(item.(*MetricDescriptor_Indices_PreAggregatedIndices)) 7802 } 7803 7804 // IsLeaf - whether field path is holds simple value 7805 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) IsLeaf() bool { 7806 return fp.selector == MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName || 7807 fp.selector == MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes 7808 } 7809 7810 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 7811 return []gotenobject.FieldPath{fp} 7812 } 7813 7814 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue { 7815 switch fp.selector { 7816 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 7817 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, value: value.(string)} 7818 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 7819 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, value: value.([]string)} 7820 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7821 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_LabelsGroup)} 7822 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7823 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_LabelsGroup)} 7824 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7825 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_AggregationsGroup)} 7826 default: 7827 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fp.selector)) 7828 } 7829 } 7830 7831 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 7832 return fp.WithIValue(value) 7833 } 7834 7835 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues { 7836 fpaov := &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp} 7837 switch fp.selector { 7838 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 7839 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, values: values.([]string)} 7840 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 7841 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, values: values.([][]string)} 7842 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7843 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_LabelsGroup)} 7844 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7845 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_LabelsGroup)} 7846 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7847 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_AggregationsGroup)} 7848 default: 7849 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fp.selector)) 7850 } 7851 return fpaov 7852 } 7853 7854 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 7855 return fp.WithIArrayOfValues(values) 7856 } 7857 7858 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue { 7859 switch fp.selector { 7860 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 7861 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, value: value.(string)} 7862 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7863 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_LabelsGroup)} 7864 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7865 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_LabelsGroup)} 7866 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7867 return &MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_AggregationsGroup)} 7868 default: 7869 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fp.selector)) 7870 } 7871 } 7872 7873 func (fp *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 7874 return fp.WithIArrayItemValue(value) 7875 } 7876 7877 type MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath struct { 7878 selector MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector 7879 subPath gotenobject.FieldPath 7880 } 7881 7882 var _ MetricDescriptorIndicesPreAggregatedIndices_FieldPath = (*MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath)(nil) 7883 7884 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) Selector() MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelector { 7885 return fps.selector 7886 } 7887 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) AsPartitionLabelSetsSubPath() (MetricDescriptorIndicesLabelsGroup_FieldPath, bool) { 7888 res, ok := fps.subPath.(MetricDescriptorIndicesLabelsGroup_FieldPath) 7889 return res, ok 7890 } 7891 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) AsFilterAndGroupLabelSetsSubPath() (MetricDescriptorIndicesLabelsGroup_FieldPath, bool) { 7892 res, ok := fps.subPath.(MetricDescriptorIndicesLabelsGroup_FieldPath) 7893 return res, ok 7894 } 7895 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) AsSupportedAggregationsSubPath() (MetricDescriptorIndicesAggregationsGroup_FieldPath, bool) { 7896 res, ok := fps.subPath.(MetricDescriptorIndicesAggregationsGroup_FieldPath) 7897 return res, ok 7898 } 7899 7900 // String returns path representation in proto convention 7901 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) String() string { 7902 return fps.selector.String() + "." + fps.subPath.String() 7903 } 7904 7905 // JSONString returns path representation is JSON convention 7906 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) JSONString() string { 7907 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 7908 } 7909 7910 // Get returns all values pointed by selected field from source MetricDescriptor_Indices_PreAggregatedIndices 7911 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) Get(source *MetricDescriptor_Indices_PreAggregatedIndices) (values []interface{}) { 7912 switch fps.selector { 7913 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7914 for _, item := range source.GetPartitionLabelSets() { 7915 values = append(values, fps.subPath.GetRaw(item)...) 7916 } 7917 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7918 for _, item := range source.GetFilterAndGroupLabelSets() { 7919 values = append(values, fps.subPath.GetRaw(item)...) 7920 } 7921 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7922 for _, item := range source.GetSupportedAggregations() { 7923 values = append(values, fps.subPath.GetRaw(item)...) 7924 } 7925 default: 7926 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fps.selector)) 7927 } 7928 return 7929 } 7930 7931 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) GetRaw(source proto.Message) []interface{} { 7932 return fps.Get(source.(*MetricDescriptor_Indices_PreAggregatedIndices)) 7933 } 7934 7935 // GetSingle returns value of selected field from source MetricDescriptor_Indices_PreAggregatedIndices 7936 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) GetSingle(source *MetricDescriptor_Indices_PreAggregatedIndices) (interface{}, bool) { 7937 switch fps.selector { 7938 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7939 if len(source.GetPartitionLabelSets()) == 0 { 7940 return nil, false 7941 } 7942 return fps.subPath.GetSingleRaw(source.GetPartitionLabelSets()[0]) 7943 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7944 if len(source.GetFilterAndGroupLabelSets()) == 0 { 7945 return nil, false 7946 } 7947 return fps.subPath.GetSingleRaw(source.GetFilterAndGroupLabelSets()[0]) 7948 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7949 if len(source.GetSupportedAggregations()) == 0 { 7950 return nil, false 7951 } 7952 return fps.subPath.GetSingleRaw(source.GetSupportedAggregations()[0]) 7953 default: 7954 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fps.selector)) 7955 } 7956 } 7957 7958 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 7959 return fps.GetSingle(source.(*MetricDescriptor_Indices_PreAggregatedIndices)) 7960 } 7961 7962 // GetDefault returns a default value of the field type 7963 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) GetDefault() interface{} { 7964 return fps.subPath.GetDefault() 7965 } 7966 7967 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) ClearValue(item *MetricDescriptor_Indices_PreAggregatedIndices) { 7968 if item != nil { 7969 switch fps.selector { 7970 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 7971 for _, subItem := range item.PartitionLabelSets { 7972 fps.subPath.ClearValueRaw(subItem) 7973 } 7974 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 7975 for _, subItem := range item.FilterAndGroupLabelSets { 7976 fps.subPath.ClearValueRaw(subItem) 7977 } 7978 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 7979 for _, subItem := range item.SupportedAggregations { 7980 fps.subPath.ClearValueRaw(subItem) 7981 } 7982 default: 7983 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fps.selector)) 7984 } 7985 } 7986 } 7987 7988 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) ClearValueRaw(item proto.Message) { 7989 fps.ClearValue(item.(*MetricDescriptor_Indices_PreAggregatedIndices)) 7990 } 7991 7992 // IsLeaf - whether field path is holds simple value 7993 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) IsLeaf() bool { 7994 return fps.subPath.IsLeaf() 7995 } 7996 7997 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 7998 iPaths := []gotenobject.FieldPath{&MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath{selector: fps.selector}} 7999 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 8000 return iPaths 8001 } 8002 8003 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) WithIValue(value interface{}) MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue { 8004 return &MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 8005 } 8006 8007 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 8008 return fps.WithIValue(value) 8009 } 8010 8011 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues { 8012 return &MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 8013 } 8014 8015 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 8016 return fps.WithIArrayOfValues(values) 8017 } 8018 8019 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue { 8020 return &MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 8021 } 8022 8023 func (fps *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 8024 return fps.WithIArrayItemValue(value) 8025 } 8026 8027 // MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue allows storing values for PreAggregatedIndices fields according to their type 8028 type MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue interface { 8029 MetricDescriptorIndicesPreAggregatedIndices_FieldPath 8030 gotenobject.FieldPathValue 8031 SetTo(target **MetricDescriptor_Indices_PreAggregatedIndices) 8032 CompareWith(*MetricDescriptor_Indices_PreAggregatedIndices) (cmp int, comparable bool) 8033 } 8034 8035 func ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue, error) { 8036 fp, err := ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPath(pathStr) 8037 if err != nil { 8038 return nil, err 8039 } 8040 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 8041 if err != nil { 8042 return nil, status.Errorf(codes.InvalidArgument, "error parsing PreAggregatedIndices field path value from %s: %v", valueStr, err) 8043 } 8044 return fpv.(MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue), nil 8045 } 8046 8047 func MustParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue { 8048 fpv, err := ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathValue(pathStr, valueStr) 8049 if err != nil { 8050 panic(err) 8051 } 8052 return fpv 8053 } 8054 8055 type MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue struct { 8056 MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath 8057 value interface{} 8058 } 8059 8060 var _ MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue = (*MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue)(nil) 8061 8062 // GetRawValue returns raw value stored under selected path for 'PreAggregatedIndices' as interface{} 8063 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) GetRawValue() interface{} { 8064 return fpv.value 8065 } 8066 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) AsNameValue() (string, bool) { 8067 res, ok := fpv.value.(string) 8068 return res, ok 8069 } 8070 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) AsResourceTypesValue() ([]string, bool) { 8071 res, ok := fpv.value.([]string) 8072 return res, ok 8073 } 8074 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) AsPartitionLabelSetsValue() ([]*MetricDescriptor_Indices_LabelsGroup, bool) { 8075 res, ok := fpv.value.([]*MetricDescriptor_Indices_LabelsGroup) 8076 return res, ok 8077 } 8078 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) AsFilterAndGroupLabelSetsValue() ([]*MetricDescriptor_Indices_LabelsGroup, bool) { 8079 res, ok := fpv.value.([]*MetricDescriptor_Indices_LabelsGroup) 8080 return res, ok 8081 } 8082 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) AsSupportedAggregationsValue() ([]*MetricDescriptor_Indices_AggregationsGroup, bool) { 8083 res, ok := fpv.value.([]*MetricDescriptor_Indices_AggregationsGroup) 8084 return res, ok 8085 } 8086 8087 // SetTo stores value for selected field for object PreAggregatedIndices 8088 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) SetTo(target **MetricDescriptor_Indices_PreAggregatedIndices) { 8089 if *target == nil { 8090 *target = new(MetricDescriptor_Indices_PreAggregatedIndices) 8091 } 8092 switch fpv.selector { 8093 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 8094 (*target).Name = fpv.value.(string) 8095 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 8096 (*target).ResourceTypes = fpv.value.([]string) 8097 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8098 (*target).PartitionLabelSets = fpv.value.([]*MetricDescriptor_Indices_LabelsGroup) 8099 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 8100 (*target).FilterAndGroupLabelSets = fpv.value.([]*MetricDescriptor_Indices_LabelsGroup) 8101 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 8102 (*target).SupportedAggregations = fpv.value.([]*MetricDescriptor_Indices_AggregationsGroup) 8103 default: 8104 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fpv.selector)) 8105 } 8106 } 8107 8108 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) SetToRaw(target proto.Message) { 8109 typedObject := target.(*MetricDescriptor_Indices_PreAggregatedIndices) 8110 fpv.SetTo(&typedObject) 8111 } 8112 8113 // CompareWith compares value in the 'MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_Indices_PreAggregatedIndices'. 8114 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_Indices_PreAggregatedIndices) (int, bool) { 8115 switch fpv.selector { 8116 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 8117 leftValue := fpv.value.(string) 8118 rightValue := source.GetName() 8119 if (leftValue) == (rightValue) { 8120 return 0, true 8121 } else if (leftValue) < (rightValue) { 8122 return -1, true 8123 } else { 8124 return 1, true 8125 } 8126 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 8127 return 0, false 8128 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8129 return 0, false 8130 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 8131 return 0, false 8132 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 8133 return 0, false 8134 default: 8135 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fpv.selector)) 8136 } 8137 } 8138 8139 func (fpv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 8140 return fpv.CompareWith(source.(*MetricDescriptor_Indices_PreAggregatedIndices)) 8141 } 8142 8143 type MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue struct { 8144 MetricDescriptorIndicesPreAggregatedIndices_FieldPath 8145 subPathValue gotenobject.FieldPathValue 8146 } 8147 8148 var _ MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue = (*MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue)(nil) 8149 8150 func (fpvs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue) AsPartitionLabelSetsPathValue() (MetricDescriptorIndicesLabelsGroup_FieldPathValue, bool) { 8151 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesLabelsGroup_FieldPathValue) 8152 return res, ok 8153 } 8154 func (fpvs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue) AsFilterAndGroupLabelSetsPathValue() (MetricDescriptorIndicesLabelsGroup_FieldPathValue, bool) { 8155 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesLabelsGroup_FieldPathValue) 8156 return res, ok 8157 } 8158 func (fpvs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue) AsSupportedAggregationsPathValue() (MetricDescriptorIndicesAggregationsGroup_FieldPathValue, bool) { 8159 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesAggregationsGroup_FieldPathValue) 8160 return res, ok 8161 } 8162 8163 func (fpvs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue) SetTo(target **MetricDescriptor_Indices_PreAggregatedIndices) { 8164 if *target == nil { 8165 *target = new(MetricDescriptor_Indices_PreAggregatedIndices) 8166 } 8167 switch fpvs.Selector() { 8168 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8169 panic("FieldPath setter is unsupported for array subpaths") 8170 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 8171 panic("FieldPath setter is unsupported for array subpaths") 8172 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 8173 panic("FieldPath setter is unsupported for array subpaths") 8174 default: 8175 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fpvs.Selector())) 8176 } 8177 } 8178 8179 func (fpvs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue) SetToRaw(target proto.Message) { 8180 typedObject := target.(*MetricDescriptor_Indices_PreAggregatedIndices) 8181 fpvs.SetTo(&typedObject) 8182 } 8183 8184 func (fpvs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue) GetRawValue() interface{} { 8185 return fpvs.subPathValue.GetRawValue() 8186 } 8187 8188 func (fpvs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue) CompareWith(source *MetricDescriptor_Indices_PreAggregatedIndices) (int, bool) { 8189 switch fpvs.Selector() { 8190 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8191 return 0, false // repeated field 8192 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 8193 return 0, false // repeated field 8194 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 8195 return 0, false // repeated field 8196 default: 8197 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fpvs.Selector())) 8198 } 8199 } 8200 8201 func (fpvs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 8202 return fpvs.CompareWith(source.(*MetricDescriptor_Indices_PreAggregatedIndices)) 8203 } 8204 8205 // MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue allows storing single item in Path-specific values for PreAggregatedIndices according to their type 8206 // Present only for array (repeated) types. 8207 type MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue interface { 8208 gotenobject.FieldPathArrayItemValue 8209 MetricDescriptorIndicesPreAggregatedIndices_FieldPath 8210 ContainsValue(*MetricDescriptor_Indices_PreAggregatedIndices) bool 8211 } 8212 8213 // ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 8214 func ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue, error) { 8215 fp, err := ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPath(pathStr) 8216 if err != nil { 8217 return nil, err 8218 } 8219 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 8220 if err != nil { 8221 return nil, status.Errorf(codes.InvalidArgument, "error parsing PreAggregatedIndices field path array item value from %s: %v", valueStr, err) 8222 } 8223 return fpaiv.(MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue), nil 8224 } 8225 8226 func MustParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue { 8227 fpaiv, err := ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue(pathStr, valueStr) 8228 if err != nil { 8229 panic(err) 8230 } 8231 return fpaiv 8232 } 8233 8234 type MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue struct { 8235 MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath 8236 value interface{} 8237 } 8238 8239 var _ MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue = (*MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue)(nil) 8240 8241 // GetRawValue returns stored element value for array in object MetricDescriptor_Indices_PreAggregatedIndices as interface{} 8242 func (fpaiv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 8243 return fpaiv.value 8244 } 8245 func (fpaiv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue) AsResourceTypesItemValue() (string, bool) { 8246 res, ok := fpaiv.value.(string) 8247 return res, ok 8248 } 8249 func (fpaiv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue) AsPartitionLabelSetsItemValue() (*MetricDescriptor_Indices_LabelsGroup, bool) { 8250 res, ok := fpaiv.value.(*MetricDescriptor_Indices_LabelsGroup) 8251 return res, ok 8252 } 8253 func (fpaiv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue) AsFilterAndGroupLabelSetsItemValue() (*MetricDescriptor_Indices_LabelsGroup, bool) { 8254 res, ok := fpaiv.value.(*MetricDescriptor_Indices_LabelsGroup) 8255 return res, ok 8256 } 8257 func (fpaiv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue) AsSupportedAggregationsItemValue() (*MetricDescriptor_Indices_AggregationsGroup, bool) { 8258 res, ok := fpaiv.value.(*MetricDescriptor_Indices_AggregationsGroup) 8259 return res, ok 8260 } 8261 8262 func (fpaiv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_Indices_PreAggregatedIndices) (interface{}, bool) { 8263 return nil, false 8264 } 8265 8266 func (fpaiv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 8267 return fpaiv.GetSingle(source.(*MetricDescriptor_Indices_PreAggregatedIndices)) 8268 } 8269 8270 // Contains returns a boolean indicating if value that is being held is present in given 'PreAggregatedIndices' 8271 func (fpaiv *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_PreAggregatedIndices) bool { 8272 slice := fpaiv.MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath.Get(source) 8273 for _, v := range slice { 8274 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 8275 if proto.Equal(asProtoMsg, v.(proto.Message)) { 8276 return true 8277 } 8278 } else if reflect.DeepEqual(v, fpaiv.value) { 8279 return true 8280 } 8281 } 8282 return false 8283 } 8284 8285 type MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayItemValue struct { 8286 MetricDescriptorIndicesPreAggregatedIndices_FieldPath 8287 subPathItemValue gotenobject.FieldPathArrayItemValue 8288 } 8289 8290 // GetRawValue returns stored array item value 8291 func (fpaivs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 8292 return fpaivs.subPathItemValue.GetRawItemValue() 8293 } 8294 func (fpaivs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayItemValue) AsPartitionLabelSetsPathItemValue() (MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue, bool) { 8295 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue) 8296 return res, ok 8297 } 8298 func (fpaivs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayItemValue) AsFilterAndGroupLabelSetsPathItemValue() (MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue, bool) { 8299 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue) 8300 return res, ok 8301 } 8302 func (fpaivs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayItemValue) AsSupportedAggregationsPathItemValue() (MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue, bool) { 8303 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesAggregationsGroup_FieldPathArrayItemValue) 8304 return res, ok 8305 } 8306 8307 // Contains returns a boolean indicating if value that is being held is present in given 'PreAggregatedIndices' 8308 func (fpaivs *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_PreAggregatedIndices) bool { 8309 switch fpaivs.Selector() { 8310 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8311 return false // repeated/map field 8312 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 8313 return false // repeated/map field 8314 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 8315 return false // repeated/map field 8316 default: 8317 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PreAggregatedIndices: %d", fpaivs.Selector())) 8318 } 8319 } 8320 8321 // MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues allows storing slice of values for PreAggregatedIndices fields according to their type 8322 type MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues interface { 8323 gotenobject.FieldPathArrayOfValues 8324 MetricDescriptorIndicesPreAggregatedIndices_FieldPath 8325 } 8326 8327 func ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues, error) { 8328 fp, err := ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPath(pathStr) 8329 if err != nil { 8330 return nil, err 8331 } 8332 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 8333 if err != nil { 8334 return nil, status.Errorf(codes.InvalidArgument, "error parsing PreAggregatedIndices field path array of values from %s: %v", valuesStr, err) 8335 } 8336 return fpaov.(MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues), nil 8337 } 8338 8339 func MustParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues { 8340 fpaov, err := ParseMetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues(pathStr, valuesStr) 8341 if err != nil { 8342 panic(err) 8343 } 8344 return fpaov 8345 } 8346 8347 type MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues struct { 8348 MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPath 8349 values interface{} 8350 } 8351 8352 var _ MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues = (*MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues)(nil) 8353 8354 func (fpaov *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 8355 switch fpaov.selector { 8356 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorName: 8357 for _, v := range fpaov.values.([]string) { 8358 values = append(values, v) 8359 } 8360 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorResourceTypes: 8361 for _, v := range fpaov.values.([][]string) { 8362 values = append(values, v) 8363 } 8364 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8365 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_LabelsGroup) { 8366 values = append(values, v) 8367 } 8368 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorFilterAndGroupLabelSets: 8369 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_LabelsGroup) { 8370 values = append(values, v) 8371 } 8372 case MetricDescriptorIndicesPreAggregatedIndices_FieldPathSelectorSupportedAggregations: 8373 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_AggregationsGroup) { 8374 values = append(values, v) 8375 } 8376 } 8377 return 8378 } 8379 func (fpaov *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]string, bool) { 8380 res, ok := fpaov.values.([]string) 8381 return res, ok 8382 } 8383 func (fpaov *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues) AsResourceTypesArrayOfValues() ([][]string, bool) { 8384 res, ok := fpaov.values.([][]string) 8385 return res, ok 8386 } 8387 func (fpaov *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues) AsPartitionLabelSetsArrayOfValues() ([][]*MetricDescriptor_Indices_LabelsGroup, bool) { 8388 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_LabelsGroup) 8389 return res, ok 8390 } 8391 func (fpaov *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues) AsFilterAndGroupLabelSetsArrayOfValues() ([][]*MetricDescriptor_Indices_LabelsGroup, bool) { 8392 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_LabelsGroup) 8393 return res, ok 8394 } 8395 func (fpaov *MetricDescriptorIndicesPreAggregatedIndices_FieldTerminalPathArrayOfValues) AsSupportedAggregationsArrayOfValues() ([][]*MetricDescriptor_Indices_AggregationsGroup, bool) { 8396 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_AggregationsGroup) 8397 return res, ok 8398 } 8399 8400 type MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayOfValues struct { 8401 MetricDescriptorIndicesPreAggregatedIndices_FieldPath 8402 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 8403 } 8404 8405 var _ MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues = (*MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayOfValues)(nil) 8406 8407 func (fpsaov *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 8408 return fpsaov.subPathArrayOfValues.GetRawValues() 8409 } 8410 func (fpsaov *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayOfValues) AsPartitionLabelSetsPathArrayOfValues() (MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues, bool) { 8411 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues) 8412 return res, ok 8413 } 8414 func (fpsaov *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayOfValues) AsFilterAndGroupLabelSetsPathArrayOfValues() (MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues, bool) { 8415 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues) 8416 return res, ok 8417 } 8418 func (fpsaov *MetricDescriptorIndicesPreAggregatedIndices_FieldSubPathArrayOfValues) AsSupportedAggregationsPathArrayOfValues() (MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues, bool) { 8419 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesAggregationsGroup_FieldPathArrayOfValues) 8420 return res, ok 8421 } 8422 8423 // FieldPath provides implementation to handle 8424 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 8425 type MetricDescriptorIndicesNonAggregatedIndices_FieldPath interface { 8426 gotenobject.FieldPath 8427 Selector() MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector 8428 Get(source *MetricDescriptor_Indices_NonAggregatedIndices) []interface{} 8429 GetSingle(source *MetricDescriptor_Indices_NonAggregatedIndices) (interface{}, bool) 8430 ClearValue(item *MetricDescriptor_Indices_NonAggregatedIndices) 8431 8432 // Those methods build corresponding MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue 8433 // (or array of values) and holds passed value. Panics if injected type is incorrect. 8434 WithIValue(value interface{}) MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue 8435 WithIArrayOfValues(values interface{}) MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues 8436 WithIArrayItemValue(value interface{}) MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue 8437 } 8438 8439 type MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector int32 8440 8441 const ( 8442 MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector = 0 8443 MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector = 1 8444 MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector = 2 8445 ) 8446 8447 func (s MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector) String() string { 8448 switch s { 8449 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 8450 return "name" 8451 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8452 return "resource_types" 8453 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8454 return "partition_label_sets" 8455 default: 8456 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", s)) 8457 } 8458 } 8459 8460 func BuildMetricDescriptorIndicesNonAggregatedIndices_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndicesNonAggregatedIndices_FieldPath, error) { 8461 if len(fp) == 0 { 8462 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_Indices_NonAggregatedIndices") 8463 } 8464 if len(fp) == 1 { 8465 switch fp[0] { 8466 case "name": 8467 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName}, nil 8468 case "resource_types", "resourceTypes", "resource-types": 8469 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes}, nil 8470 case "partition_label_sets", "partitionLabelSets", "partition-label-sets": 8471 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath{selector: MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets}, nil 8472 } 8473 } else { 8474 switch fp[0] { 8475 case "partition_label_sets", "partitionLabelSets", "partition-label-sets": 8476 if subpath, err := BuildMetricDescriptorIndicesLabelsGroup_FieldPath(fp[1:]); err != nil { 8477 return nil, err 8478 } else { 8479 return &MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath{selector: MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets, subPath: subpath}, nil 8480 } 8481 } 8482 } 8483 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_Indices_NonAggregatedIndices", fp) 8484 } 8485 8486 func ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPath(rawField string) (MetricDescriptorIndicesNonAggregatedIndices_FieldPath, error) { 8487 fp, err := gotenobject.ParseRawFieldPath(rawField) 8488 if err != nil { 8489 return nil, err 8490 } 8491 return BuildMetricDescriptorIndicesNonAggregatedIndices_FieldPath(fp) 8492 } 8493 8494 func MustParseMetricDescriptorIndicesNonAggregatedIndices_FieldPath(rawField string) MetricDescriptorIndicesNonAggregatedIndices_FieldPath { 8495 fp, err := ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPath(rawField) 8496 if err != nil { 8497 panic(err) 8498 } 8499 return fp 8500 } 8501 8502 type MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath struct { 8503 selector MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector 8504 } 8505 8506 var _ MetricDescriptorIndicesNonAggregatedIndices_FieldPath = (*MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath)(nil) 8507 8508 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) Selector() MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector { 8509 return fp.selector 8510 } 8511 8512 // String returns path representation in proto convention 8513 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) String() string { 8514 return fp.selector.String() 8515 } 8516 8517 // JSONString returns path representation is JSON convention 8518 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) JSONString() string { 8519 return strcase.ToLowerCamel(fp.String()) 8520 } 8521 8522 // Get returns all values pointed by specific field from source MetricDescriptor_Indices_NonAggregatedIndices 8523 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) Get(source *MetricDescriptor_Indices_NonAggregatedIndices) (values []interface{}) { 8524 if source != nil { 8525 switch fp.selector { 8526 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 8527 values = append(values, source.Name) 8528 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8529 for _, value := range source.GetResourceTypes() { 8530 values = append(values, value) 8531 } 8532 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8533 for _, value := range source.GetPartitionLabelSets() { 8534 values = append(values, value) 8535 } 8536 default: 8537 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fp.selector)) 8538 } 8539 } 8540 return 8541 } 8542 8543 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 8544 return fp.Get(source.(*MetricDescriptor_Indices_NonAggregatedIndices)) 8545 } 8546 8547 // GetSingle returns value pointed by specific field of from source MetricDescriptor_Indices_NonAggregatedIndices 8548 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) GetSingle(source *MetricDescriptor_Indices_NonAggregatedIndices) (interface{}, bool) { 8549 switch fp.selector { 8550 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 8551 return source.GetName(), source != nil 8552 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8553 res := source.GetResourceTypes() 8554 return res, res != nil 8555 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8556 res := source.GetPartitionLabelSets() 8557 return res, res != nil 8558 default: 8559 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fp.selector)) 8560 } 8561 } 8562 8563 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 8564 return fp.GetSingle(source.(*MetricDescriptor_Indices_NonAggregatedIndices)) 8565 } 8566 8567 // GetDefault returns a default value of the field type 8568 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) GetDefault() interface{} { 8569 switch fp.selector { 8570 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 8571 return "" 8572 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8573 return ([]string)(nil) 8574 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8575 return ([]*MetricDescriptor_Indices_LabelsGroup)(nil) 8576 default: 8577 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fp.selector)) 8578 } 8579 } 8580 8581 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) ClearValue(item *MetricDescriptor_Indices_NonAggregatedIndices) { 8582 if item != nil { 8583 switch fp.selector { 8584 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 8585 item.Name = "" 8586 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8587 item.ResourceTypes = nil 8588 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8589 item.PartitionLabelSets = nil 8590 default: 8591 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fp.selector)) 8592 } 8593 } 8594 } 8595 8596 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) ClearValueRaw(item proto.Message) { 8597 fp.ClearValue(item.(*MetricDescriptor_Indices_NonAggregatedIndices)) 8598 } 8599 8600 // IsLeaf - whether field path is holds simple value 8601 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) IsLeaf() bool { 8602 return fp.selector == MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName || 8603 fp.selector == MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes 8604 } 8605 8606 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 8607 return []gotenobject.FieldPath{fp} 8608 } 8609 8610 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue { 8611 switch fp.selector { 8612 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 8613 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue{MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: *fp, value: value.(string)} 8614 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8615 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue{MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: *fp, value: value.([]string)} 8616 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8617 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue{MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_LabelsGroup)} 8618 default: 8619 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fp.selector)) 8620 } 8621 } 8622 8623 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 8624 return fp.WithIValue(value) 8625 } 8626 8627 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues { 8628 fpaov := &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: *fp} 8629 switch fp.selector { 8630 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 8631 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: *fp, values: values.([]string)} 8632 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8633 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: *fp, values: values.([][]string)} 8634 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8635 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_LabelsGroup)} 8636 default: 8637 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fp.selector)) 8638 } 8639 return fpaov 8640 } 8641 8642 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 8643 return fp.WithIArrayOfValues(values) 8644 } 8645 8646 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue { 8647 switch fp.selector { 8648 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8649 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: *fp, value: value.(string)} 8650 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8651 return &MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_LabelsGroup)} 8652 default: 8653 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fp.selector)) 8654 } 8655 } 8656 8657 func (fp *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 8658 return fp.WithIArrayItemValue(value) 8659 } 8660 8661 type MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath struct { 8662 selector MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector 8663 subPath gotenobject.FieldPath 8664 } 8665 8666 var _ MetricDescriptorIndicesNonAggregatedIndices_FieldPath = (*MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath)(nil) 8667 8668 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) Selector() MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelector { 8669 return fps.selector 8670 } 8671 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) AsPartitionLabelSetsSubPath() (MetricDescriptorIndicesLabelsGroup_FieldPath, bool) { 8672 res, ok := fps.subPath.(MetricDescriptorIndicesLabelsGroup_FieldPath) 8673 return res, ok 8674 } 8675 8676 // String returns path representation in proto convention 8677 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) String() string { 8678 return fps.selector.String() + "." + fps.subPath.String() 8679 } 8680 8681 // JSONString returns path representation is JSON convention 8682 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) JSONString() string { 8683 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 8684 } 8685 8686 // Get returns all values pointed by selected field from source MetricDescriptor_Indices_NonAggregatedIndices 8687 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) Get(source *MetricDescriptor_Indices_NonAggregatedIndices) (values []interface{}) { 8688 switch fps.selector { 8689 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8690 for _, item := range source.GetPartitionLabelSets() { 8691 values = append(values, fps.subPath.GetRaw(item)...) 8692 } 8693 default: 8694 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fps.selector)) 8695 } 8696 return 8697 } 8698 8699 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) GetRaw(source proto.Message) []interface{} { 8700 return fps.Get(source.(*MetricDescriptor_Indices_NonAggregatedIndices)) 8701 } 8702 8703 // GetSingle returns value of selected field from source MetricDescriptor_Indices_NonAggregatedIndices 8704 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) GetSingle(source *MetricDescriptor_Indices_NonAggregatedIndices) (interface{}, bool) { 8705 switch fps.selector { 8706 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8707 if len(source.GetPartitionLabelSets()) == 0 { 8708 return nil, false 8709 } 8710 return fps.subPath.GetSingleRaw(source.GetPartitionLabelSets()[0]) 8711 default: 8712 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fps.selector)) 8713 } 8714 } 8715 8716 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 8717 return fps.GetSingle(source.(*MetricDescriptor_Indices_NonAggregatedIndices)) 8718 } 8719 8720 // GetDefault returns a default value of the field type 8721 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) GetDefault() interface{} { 8722 return fps.subPath.GetDefault() 8723 } 8724 8725 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) ClearValue(item *MetricDescriptor_Indices_NonAggregatedIndices) { 8726 if item != nil { 8727 switch fps.selector { 8728 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8729 for _, subItem := range item.PartitionLabelSets { 8730 fps.subPath.ClearValueRaw(subItem) 8731 } 8732 default: 8733 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fps.selector)) 8734 } 8735 } 8736 } 8737 8738 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) ClearValueRaw(item proto.Message) { 8739 fps.ClearValue(item.(*MetricDescriptor_Indices_NonAggregatedIndices)) 8740 } 8741 8742 // IsLeaf - whether field path is holds simple value 8743 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) IsLeaf() bool { 8744 return fps.subPath.IsLeaf() 8745 } 8746 8747 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 8748 iPaths := []gotenobject.FieldPath{&MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath{selector: fps.selector}} 8749 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 8750 return iPaths 8751 } 8752 8753 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) WithIValue(value interface{}) MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue { 8754 return &MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 8755 } 8756 8757 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 8758 return fps.WithIValue(value) 8759 } 8760 8761 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues { 8762 return &MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 8763 } 8764 8765 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 8766 return fps.WithIArrayOfValues(values) 8767 } 8768 8769 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue { 8770 return &MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 8771 } 8772 8773 func (fps *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 8774 return fps.WithIArrayItemValue(value) 8775 } 8776 8777 // MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue allows storing values for NonAggregatedIndices fields according to their type 8778 type MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue interface { 8779 MetricDescriptorIndicesNonAggregatedIndices_FieldPath 8780 gotenobject.FieldPathValue 8781 SetTo(target **MetricDescriptor_Indices_NonAggregatedIndices) 8782 CompareWith(*MetricDescriptor_Indices_NonAggregatedIndices) (cmp int, comparable bool) 8783 } 8784 8785 func ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue, error) { 8786 fp, err := ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPath(pathStr) 8787 if err != nil { 8788 return nil, err 8789 } 8790 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 8791 if err != nil { 8792 return nil, status.Errorf(codes.InvalidArgument, "error parsing NonAggregatedIndices field path value from %s: %v", valueStr, err) 8793 } 8794 return fpv.(MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue), nil 8795 } 8796 8797 func MustParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue { 8798 fpv, err := ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathValue(pathStr, valueStr) 8799 if err != nil { 8800 panic(err) 8801 } 8802 return fpv 8803 } 8804 8805 type MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue struct { 8806 MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath 8807 value interface{} 8808 } 8809 8810 var _ MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue = (*MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue)(nil) 8811 8812 // GetRawValue returns raw value stored under selected path for 'NonAggregatedIndices' as interface{} 8813 func (fpv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue) GetRawValue() interface{} { 8814 return fpv.value 8815 } 8816 func (fpv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue) AsNameValue() (string, bool) { 8817 res, ok := fpv.value.(string) 8818 return res, ok 8819 } 8820 func (fpv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue) AsResourceTypesValue() ([]string, bool) { 8821 res, ok := fpv.value.([]string) 8822 return res, ok 8823 } 8824 func (fpv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue) AsPartitionLabelSetsValue() ([]*MetricDescriptor_Indices_LabelsGroup, bool) { 8825 res, ok := fpv.value.([]*MetricDescriptor_Indices_LabelsGroup) 8826 return res, ok 8827 } 8828 8829 // SetTo stores value for selected field for object NonAggregatedIndices 8830 func (fpv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue) SetTo(target **MetricDescriptor_Indices_NonAggregatedIndices) { 8831 if *target == nil { 8832 *target = new(MetricDescriptor_Indices_NonAggregatedIndices) 8833 } 8834 switch fpv.selector { 8835 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 8836 (*target).Name = fpv.value.(string) 8837 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8838 (*target).ResourceTypes = fpv.value.([]string) 8839 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8840 (*target).PartitionLabelSets = fpv.value.([]*MetricDescriptor_Indices_LabelsGroup) 8841 default: 8842 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fpv.selector)) 8843 } 8844 } 8845 8846 func (fpv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue) SetToRaw(target proto.Message) { 8847 typedObject := target.(*MetricDescriptor_Indices_NonAggregatedIndices) 8848 fpv.SetTo(&typedObject) 8849 } 8850 8851 // CompareWith compares value in the 'MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_Indices_NonAggregatedIndices'. 8852 func (fpv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_Indices_NonAggregatedIndices) (int, bool) { 8853 switch fpv.selector { 8854 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 8855 leftValue := fpv.value.(string) 8856 rightValue := source.GetName() 8857 if (leftValue) == (rightValue) { 8858 return 0, true 8859 } else if (leftValue) < (rightValue) { 8860 return -1, true 8861 } else { 8862 return 1, true 8863 } 8864 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 8865 return 0, false 8866 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8867 return 0, false 8868 default: 8869 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fpv.selector)) 8870 } 8871 } 8872 8873 func (fpv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 8874 return fpv.CompareWith(source.(*MetricDescriptor_Indices_NonAggregatedIndices)) 8875 } 8876 8877 type MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathValue struct { 8878 MetricDescriptorIndicesNonAggregatedIndices_FieldPath 8879 subPathValue gotenobject.FieldPathValue 8880 } 8881 8882 var _ MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue = (*MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathValue)(nil) 8883 8884 func (fpvs *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathValue) AsPartitionLabelSetsPathValue() (MetricDescriptorIndicesLabelsGroup_FieldPathValue, bool) { 8885 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesLabelsGroup_FieldPathValue) 8886 return res, ok 8887 } 8888 8889 func (fpvs *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathValue) SetTo(target **MetricDescriptor_Indices_NonAggregatedIndices) { 8890 if *target == nil { 8891 *target = new(MetricDescriptor_Indices_NonAggregatedIndices) 8892 } 8893 switch fpvs.Selector() { 8894 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8895 panic("FieldPath setter is unsupported for array subpaths") 8896 default: 8897 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fpvs.Selector())) 8898 } 8899 } 8900 8901 func (fpvs *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathValue) SetToRaw(target proto.Message) { 8902 typedObject := target.(*MetricDescriptor_Indices_NonAggregatedIndices) 8903 fpvs.SetTo(&typedObject) 8904 } 8905 8906 func (fpvs *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathValue) GetRawValue() interface{} { 8907 return fpvs.subPathValue.GetRawValue() 8908 } 8909 8910 func (fpvs *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathValue) CompareWith(source *MetricDescriptor_Indices_NonAggregatedIndices) (int, bool) { 8911 switch fpvs.Selector() { 8912 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 8913 return 0, false // repeated field 8914 default: 8915 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fpvs.Selector())) 8916 } 8917 } 8918 8919 func (fpvs *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 8920 return fpvs.CompareWith(source.(*MetricDescriptor_Indices_NonAggregatedIndices)) 8921 } 8922 8923 // MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue allows storing single item in Path-specific values for NonAggregatedIndices according to their type 8924 // Present only for array (repeated) types. 8925 type MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue interface { 8926 gotenobject.FieldPathArrayItemValue 8927 MetricDescriptorIndicesNonAggregatedIndices_FieldPath 8928 ContainsValue(*MetricDescriptor_Indices_NonAggregatedIndices) bool 8929 } 8930 8931 // ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 8932 func ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue, error) { 8933 fp, err := ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPath(pathStr) 8934 if err != nil { 8935 return nil, err 8936 } 8937 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 8938 if err != nil { 8939 return nil, status.Errorf(codes.InvalidArgument, "error parsing NonAggregatedIndices field path array item value from %s: %v", valueStr, err) 8940 } 8941 return fpaiv.(MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue), nil 8942 } 8943 8944 func MustParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue { 8945 fpaiv, err := ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue(pathStr, valueStr) 8946 if err != nil { 8947 panic(err) 8948 } 8949 return fpaiv 8950 } 8951 8952 type MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue struct { 8953 MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath 8954 value interface{} 8955 } 8956 8957 var _ MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue = (*MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue)(nil) 8958 8959 // GetRawValue returns stored element value for array in object MetricDescriptor_Indices_NonAggregatedIndices as interface{} 8960 func (fpaiv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 8961 return fpaiv.value 8962 } 8963 func (fpaiv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue) AsResourceTypesItemValue() (string, bool) { 8964 res, ok := fpaiv.value.(string) 8965 return res, ok 8966 } 8967 func (fpaiv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue) AsPartitionLabelSetsItemValue() (*MetricDescriptor_Indices_LabelsGroup, bool) { 8968 res, ok := fpaiv.value.(*MetricDescriptor_Indices_LabelsGroup) 8969 return res, ok 8970 } 8971 8972 func (fpaiv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_Indices_NonAggregatedIndices) (interface{}, bool) { 8973 return nil, false 8974 } 8975 8976 func (fpaiv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 8977 return fpaiv.GetSingle(source.(*MetricDescriptor_Indices_NonAggregatedIndices)) 8978 } 8979 8980 // Contains returns a boolean indicating if value that is being held is present in given 'NonAggregatedIndices' 8981 func (fpaiv *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_NonAggregatedIndices) bool { 8982 slice := fpaiv.MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath.Get(source) 8983 for _, v := range slice { 8984 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 8985 if proto.Equal(asProtoMsg, v.(proto.Message)) { 8986 return true 8987 } 8988 } else if reflect.DeepEqual(v, fpaiv.value) { 8989 return true 8990 } 8991 } 8992 return false 8993 } 8994 8995 type MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayItemValue struct { 8996 MetricDescriptorIndicesNonAggregatedIndices_FieldPath 8997 subPathItemValue gotenobject.FieldPathArrayItemValue 8998 } 8999 9000 // GetRawValue returns stored array item value 9001 func (fpaivs *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 9002 return fpaivs.subPathItemValue.GetRawItemValue() 9003 } 9004 func (fpaivs *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayItemValue) AsPartitionLabelSetsPathItemValue() (MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue, bool) { 9005 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue) 9006 return res, ok 9007 } 9008 9009 // Contains returns a boolean indicating if value that is being held is present in given 'NonAggregatedIndices' 9010 func (fpaivs *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_NonAggregatedIndices) bool { 9011 switch fpaivs.Selector() { 9012 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 9013 return false // repeated/map field 9014 default: 9015 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_NonAggregatedIndices: %d", fpaivs.Selector())) 9016 } 9017 } 9018 9019 // MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues allows storing slice of values for NonAggregatedIndices fields according to their type 9020 type MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues interface { 9021 gotenobject.FieldPathArrayOfValues 9022 MetricDescriptorIndicesNonAggregatedIndices_FieldPath 9023 } 9024 9025 func ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues, error) { 9026 fp, err := ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPath(pathStr) 9027 if err != nil { 9028 return nil, err 9029 } 9030 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 9031 if err != nil { 9032 return nil, status.Errorf(codes.InvalidArgument, "error parsing NonAggregatedIndices field path array of values from %s: %v", valuesStr, err) 9033 } 9034 return fpaov.(MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues), nil 9035 } 9036 9037 func MustParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues { 9038 fpaov, err := ParseMetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues(pathStr, valuesStr) 9039 if err != nil { 9040 panic(err) 9041 } 9042 return fpaov 9043 } 9044 9045 type MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues struct { 9046 MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPath 9047 values interface{} 9048 } 9049 9050 var _ MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues = (*MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues)(nil) 9051 9052 func (fpaov *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 9053 switch fpaov.selector { 9054 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorName: 9055 for _, v := range fpaov.values.([]string) { 9056 values = append(values, v) 9057 } 9058 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorResourceTypes: 9059 for _, v := range fpaov.values.([][]string) { 9060 values = append(values, v) 9061 } 9062 case MetricDescriptorIndicesNonAggregatedIndices_FieldPathSelectorPartitionLabelSets: 9063 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_LabelsGroup) { 9064 values = append(values, v) 9065 } 9066 } 9067 return 9068 } 9069 func (fpaov *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]string, bool) { 9070 res, ok := fpaov.values.([]string) 9071 return res, ok 9072 } 9073 func (fpaov *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues) AsResourceTypesArrayOfValues() ([][]string, bool) { 9074 res, ok := fpaov.values.([][]string) 9075 return res, ok 9076 } 9077 func (fpaov *MetricDescriptorIndicesNonAggregatedIndices_FieldTerminalPathArrayOfValues) AsPartitionLabelSetsArrayOfValues() ([][]*MetricDescriptor_Indices_LabelsGroup, bool) { 9078 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_LabelsGroup) 9079 return res, ok 9080 } 9081 9082 type MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayOfValues struct { 9083 MetricDescriptorIndicesNonAggregatedIndices_FieldPath 9084 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 9085 } 9086 9087 var _ MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues = (*MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayOfValues)(nil) 9088 9089 func (fpsaov *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 9090 return fpsaov.subPathArrayOfValues.GetRawValues() 9091 } 9092 func (fpsaov *MetricDescriptorIndicesNonAggregatedIndices_FieldSubPathArrayOfValues) AsPartitionLabelSetsPathArrayOfValues() (MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues, bool) { 9093 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues) 9094 return res, ok 9095 } 9096 9097 // FieldPath provides implementation to handle 9098 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 9099 type MetricDescriptorIndicesPaginationIndices_FieldPath interface { 9100 gotenobject.FieldPath 9101 Selector() MetricDescriptorIndicesPaginationIndices_FieldPathSelector 9102 Get(source *MetricDescriptor_Indices_PaginationIndices) []interface{} 9103 GetSingle(source *MetricDescriptor_Indices_PaginationIndices) (interface{}, bool) 9104 ClearValue(item *MetricDescriptor_Indices_PaginationIndices) 9105 9106 // Those methods build corresponding MetricDescriptorIndicesPaginationIndices_FieldPathValue 9107 // (or array of values) and holds passed value. Panics if injected type is incorrect. 9108 WithIValue(value interface{}) MetricDescriptorIndicesPaginationIndices_FieldPathValue 9109 WithIArrayOfValues(values interface{}) MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues 9110 WithIArrayItemValue(value interface{}) MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue 9111 } 9112 9113 type MetricDescriptorIndicesPaginationIndices_FieldPathSelector int32 9114 9115 const ( 9116 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName MetricDescriptorIndicesPaginationIndices_FieldPathSelector = 0 9117 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes MetricDescriptorIndicesPaginationIndices_FieldPathSelector = 1 9118 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets MetricDescriptorIndicesPaginationIndices_FieldPathSelector = 2 9119 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews MetricDescriptorIndicesPaginationIndices_FieldPathSelector = 3 9120 MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions MetricDescriptorIndicesPaginationIndices_FieldPathSelector = 4 9121 ) 9122 9123 func (s MetricDescriptorIndicesPaginationIndices_FieldPathSelector) String() string { 9124 switch s { 9125 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9126 return "name" 9127 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9128 return "resource_types" 9129 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9130 return "partition_label_sets" 9131 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9132 return "views" 9133 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9134 return "functions" 9135 default: 9136 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", s)) 9137 } 9138 } 9139 9140 func BuildMetricDescriptorIndicesPaginationIndices_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndicesPaginationIndices_FieldPath, error) { 9141 if len(fp) == 0 { 9142 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_Indices_PaginationIndices") 9143 } 9144 if len(fp) == 1 { 9145 switch fp[0] { 9146 case "name": 9147 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName}, nil 9148 case "resource_types", "resourceTypes", "resource-types": 9149 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes}, nil 9150 case "partition_label_sets", "partitionLabelSets", "partition-label-sets": 9151 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets}, nil 9152 case "views": 9153 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews}, nil 9154 case "functions": 9155 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions}, nil 9156 } 9157 } else { 9158 switch fp[0] { 9159 case "partition_label_sets", "partitionLabelSets", "partition-label-sets": 9160 if subpath, err := BuildMetricDescriptorIndicesLabelsGroup_FieldPath(fp[1:]); err != nil { 9161 return nil, err 9162 } else { 9163 return &MetricDescriptorIndicesPaginationIndices_FieldSubPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets, subPath: subpath}, nil 9164 } 9165 case "views": 9166 if subpath, err := BuildMetricDescriptorIndicesPaginationView_FieldPath(fp[1:]); err != nil { 9167 return nil, err 9168 } else { 9169 return &MetricDescriptorIndicesPaginationIndices_FieldSubPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews, subPath: subpath}, nil 9170 } 9171 case "functions": 9172 if subpath, err := BuildMetricDescriptorIndicesSortingFunction_FieldPath(fp[1:]); err != nil { 9173 return nil, err 9174 } else { 9175 return &MetricDescriptorIndicesPaginationIndices_FieldSubPath{selector: MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions, subPath: subpath}, nil 9176 } 9177 } 9178 } 9179 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_Indices_PaginationIndices", fp) 9180 } 9181 9182 func ParseMetricDescriptorIndicesPaginationIndices_FieldPath(rawField string) (MetricDescriptorIndicesPaginationIndices_FieldPath, error) { 9183 fp, err := gotenobject.ParseRawFieldPath(rawField) 9184 if err != nil { 9185 return nil, err 9186 } 9187 return BuildMetricDescriptorIndicesPaginationIndices_FieldPath(fp) 9188 } 9189 9190 func MustParseMetricDescriptorIndicesPaginationIndices_FieldPath(rawField string) MetricDescriptorIndicesPaginationIndices_FieldPath { 9191 fp, err := ParseMetricDescriptorIndicesPaginationIndices_FieldPath(rawField) 9192 if err != nil { 9193 panic(err) 9194 } 9195 return fp 9196 } 9197 9198 type MetricDescriptorIndicesPaginationIndices_FieldTerminalPath struct { 9199 selector MetricDescriptorIndicesPaginationIndices_FieldPathSelector 9200 } 9201 9202 var _ MetricDescriptorIndicesPaginationIndices_FieldPath = (*MetricDescriptorIndicesPaginationIndices_FieldTerminalPath)(nil) 9203 9204 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) Selector() MetricDescriptorIndicesPaginationIndices_FieldPathSelector { 9205 return fp.selector 9206 } 9207 9208 // String returns path representation in proto convention 9209 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) String() string { 9210 return fp.selector.String() 9211 } 9212 9213 // JSONString returns path representation is JSON convention 9214 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) JSONString() string { 9215 return strcase.ToLowerCamel(fp.String()) 9216 } 9217 9218 // Get returns all values pointed by specific field from source MetricDescriptor_Indices_PaginationIndices 9219 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) Get(source *MetricDescriptor_Indices_PaginationIndices) (values []interface{}) { 9220 if source != nil { 9221 switch fp.selector { 9222 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9223 values = append(values, source.Name) 9224 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9225 for _, value := range source.GetResourceTypes() { 9226 values = append(values, value) 9227 } 9228 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9229 for _, value := range source.GetPartitionLabelSets() { 9230 values = append(values, value) 9231 } 9232 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9233 for _, value := range source.GetViews() { 9234 values = append(values, value) 9235 } 9236 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9237 for _, value := range source.GetFunctions() { 9238 values = append(values, value) 9239 } 9240 default: 9241 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fp.selector)) 9242 } 9243 } 9244 return 9245 } 9246 9247 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 9248 return fp.Get(source.(*MetricDescriptor_Indices_PaginationIndices)) 9249 } 9250 9251 // GetSingle returns value pointed by specific field of from source MetricDescriptor_Indices_PaginationIndices 9252 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) GetSingle(source *MetricDescriptor_Indices_PaginationIndices) (interface{}, bool) { 9253 switch fp.selector { 9254 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9255 return source.GetName(), source != nil 9256 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9257 res := source.GetResourceTypes() 9258 return res, res != nil 9259 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9260 res := source.GetPartitionLabelSets() 9261 return res, res != nil 9262 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9263 res := source.GetViews() 9264 return res, res != nil 9265 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9266 res := source.GetFunctions() 9267 return res, res != nil 9268 default: 9269 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fp.selector)) 9270 } 9271 } 9272 9273 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 9274 return fp.GetSingle(source.(*MetricDescriptor_Indices_PaginationIndices)) 9275 } 9276 9277 // GetDefault returns a default value of the field type 9278 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) GetDefault() interface{} { 9279 switch fp.selector { 9280 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9281 return "" 9282 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9283 return ([]string)(nil) 9284 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9285 return ([]*MetricDescriptor_Indices_LabelsGroup)(nil) 9286 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9287 return ([]*MetricDescriptor_Indices_PaginationView)(nil) 9288 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9289 return ([]*MetricDescriptor_Indices_SortingFunction)(nil) 9290 default: 9291 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fp.selector)) 9292 } 9293 } 9294 9295 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) ClearValue(item *MetricDescriptor_Indices_PaginationIndices) { 9296 if item != nil { 9297 switch fp.selector { 9298 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9299 item.Name = "" 9300 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9301 item.ResourceTypes = nil 9302 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9303 item.PartitionLabelSets = nil 9304 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9305 item.Views = nil 9306 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9307 item.Functions = nil 9308 default: 9309 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fp.selector)) 9310 } 9311 } 9312 } 9313 9314 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) ClearValueRaw(item proto.Message) { 9315 fp.ClearValue(item.(*MetricDescriptor_Indices_PaginationIndices)) 9316 } 9317 9318 // IsLeaf - whether field path is holds simple value 9319 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) IsLeaf() bool { 9320 return fp.selector == MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName || 9321 fp.selector == MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes 9322 } 9323 9324 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 9325 return []gotenobject.FieldPath{fp} 9326 } 9327 9328 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndicesPaginationIndices_FieldPathValue { 9329 switch fp.selector { 9330 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9331 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, value: value.(string)} 9332 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9333 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, value: value.([]string)} 9334 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9335 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_LabelsGroup)} 9336 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9337 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_PaginationView)} 9338 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9339 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_SortingFunction)} 9340 default: 9341 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fp.selector)) 9342 } 9343 } 9344 9345 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 9346 return fp.WithIValue(value) 9347 } 9348 9349 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues { 9350 fpaov := &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp} 9351 switch fp.selector { 9352 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9353 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, values: values.([]string)} 9354 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9355 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, values: values.([][]string)} 9356 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9357 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_LabelsGroup)} 9358 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9359 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_PaginationView)} 9360 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9361 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_SortingFunction)} 9362 default: 9363 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fp.selector)) 9364 } 9365 return fpaov 9366 } 9367 9368 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 9369 return fp.WithIArrayOfValues(values) 9370 } 9371 9372 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue { 9373 switch fp.selector { 9374 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9375 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, value: value.(string)} 9376 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9377 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_LabelsGroup)} 9378 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9379 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_PaginationView)} 9380 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9381 return &MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesPaginationIndices_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_SortingFunction)} 9382 default: 9383 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fp.selector)) 9384 } 9385 } 9386 9387 func (fp *MetricDescriptorIndicesPaginationIndices_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 9388 return fp.WithIArrayItemValue(value) 9389 } 9390 9391 type MetricDescriptorIndicesPaginationIndices_FieldSubPath struct { 9392 selector MetricDescriptorIndicesPaginationIndices_FieldPathSelector 9393 subPath gotenobject.FieldPath 9394 } 9395 9396 var _ MetricDescriptorIndicesPaginationIndices_FieldPath = (*MetricDescriptorIndicesPaginationIndices_FieldSubPath)(nil) 9397 9398 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) Selector() MetricDescriptorIndicesPaginationIndices_FieldPathSelector { 9399 return fps.selector 9400 } 9401 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) AsPartitionLabelSetsSubPath() (MetricDescriptorIndicesLabelsGroup_FieldPath, bool) { 9402 res, ok := fps.subPath.(MetricDescriptorIndicesLabelsGroup_FieldPath) 9403 return res, ok 9404 } 9405 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) AsViewsSubPath() (MetricDescriptorIndicesPaginationView_FieldPath, bool) { 9406 res, ok := fps.subPath.(MetricDescriptorIndicesPaginationView_FieldPath) 9407 return res, ok 9408 } 9409 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) AsFunctionsSubPath() (MetricDescriptorIndicesSortingFunction_FieldPath, bool) { 9410 res, ok := fps.subPath.(MetricDescriptorIndicesSortingFunction_FieldPath) 9411 return res, ok 9412 } 9413 9414 // String returns path representation in proto convention 9415 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) String() string { 9416 return fps.selector.String() + "." + fps.subPath.String() 9417 } 9418 9419 // JSONString returns path representation is JSON convention 9420 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) JSONString() string { 9421 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 9422 } 9423 9424 // Get returns all values pointed by selected field from source MetricDescriptor_Indices_PaginationIndices 9425 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) Get(source *MetricDescriptor_Indices_PaginationIndices) (values []interface{}) { 9426 switch fps.selector { 9427 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9428 for _, item := range source.GetPartitionLabelSets() { 9429 values = append(values, fps.subPath.GetRaw(item)...) 9430 } 9431 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9432 for _, item := range source.GetViews() { 9433 values = append(values, fps.subPath.GetRaw(item)...) 9434 } 9435 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9436 for _, item := range source.GetFunctions() { 9437 values = append(values, fps.subPath.GetRaw(item)...) 9438 } 9439 default: 9440 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fps.selector)) 9441 } 9442 return 9443 } 9444 9445 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) GetRaw(source proto.Message) []interface{} { 9446 return fps.Get(source.(*MetricDescriptor_Indices_PaginationIndices)) 9447 } 9448 9449 // GetSingle returns value of selected field from source MetricDescriptor_Indices_PaginationIndices 9450 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) GetSingle(source *MetricDescriptor_Indices_PaginationIndices) (interface{}, bool) { 9451 switch fps.selector { 9452 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9453 if len(source.GetPartitionLabelSets()) == 0 { 9454 return nil, false 9455 } 9456 return fps.subPath.GetSingleRaw(source.GetPartitionLabelSets()[0]) 9457 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9458 if len(source.GetViews()) == 0 { 9459 return nil, false 9460 } 9461 return fps.subPath.GetSingleRaw(source.GetViews()[0]) 9462 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9463 if len(source.GetFunctions()) == 0 { 9464 return nil, false 9465 } 9466 return fps.subPath.GetSingleRaw(source.GetFunctions()[0]) 9467 default: 9468 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fps.selector)) 9469 } 9470 } 9471 9472 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 9473 return fps.GetSingle(source.(*MetricDescriptor_Indices_PaginationIndices)) 9474 } 9475 9476 // GetDefault returns a default value of the field type 9477 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) GetDefault() interface{} { 9478 return fps.subPath.GetDefault() 9479 } 9480 9481 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) ClearValue(item *MetricDescriptor_Indices_PaginationIndices) { 9482 if item != nil { 9483 switch fps.selector { 9484 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9485 for _, subItem := range item.PartitionLabelSets { 9486 fps.subPath.ClearValueRaw(subItem) 9487 } 9488 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9489 for _, subItem := range item.Views { 9490 fps.subPath.ClearValueRaw(subItem) 9491 } 9492 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9493 for _, subItem := range item.Functions { 9494 fps.subPath.ClearValueRaw(subItem) 9495 } 9496 default: 9497 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fps.selector)) 9498 } 9499 } 9500 } 9501 9502 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) ClearValueRaw(item proto.Message) { 9503 fps.ClearValue(item.(*MetricDescriptor_Indices_PaginationIndices)) 9504 } 9505 9506 // IsLeaf - whether field path is holds simple value 9507 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) IsLeaf() bool { 9508 return fps.subPath.IsLeaf() 9509 } 9510 9511 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 9512 iPaths := []gotenobject.FieldPath{&MetricDescriptorIndicesPaginationIndices_FieldTerminalPath{selector: fps.selector}} 9513 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 9514 return iPaths 9515 } 9516 9517 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) WithIValue(value interface{}) MetricDescriptorIndicesPaginationIndices_FieldPathValue { 9518 return &MetricDescriptorIndicesPaginationIndices_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 9519 } 9520 9521 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 9522 return fps.WithIValue(value) 9523 } 9524 9525 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues { 9526 return &MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 9527 } 9528 9529 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 9530 return fps.WithIArrayOfValues(values) 9531 } 9532 9533 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue { 9534 return &MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 9535 } 9536 9537 func (fps *MetricDescriptorIndicesPaginationIndices_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 9538 return fps.WithIArrayItemValue(value) 9539 } 9540 9541 // MetricDescriptorIndicesPaginationIndices_FieldPathValue allows storing values for PaginationIndices fields according to their type 9542 type MetricDescriptorIndicesPaginationIndices_FieldPathValue interface { 9543 MetricDescriptorIndicesPaginationIndices_FieldPath 9544 gotenobject.FieldPathValue 9545 SetTo(target **MetricDescriptor_Indices_PaginationIndices) 9546 CompareWith(*MetricDescriptor_Indices_PaginationIndices) (cmp int, comparable bool) 9547 } 9548 9549 func ParseMetricDescriptorIndicesPaginationIndices_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndicesPaginationIndices_FieldPathValue, error) { 9550 fp, err := ParseMetricDescriptorIndicesPaginationIndices_FieldPath(pathStr) 9551 if err != nil { 9552 return nil, err 9553 } 9554 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 9555 if err != nil { 9556 return nil, status.Errorf(codes.InvalidArgument, "error parsing PaginationIndices field path value from %s: %v", valueStr, err) 9557 } 9558 return fpv.(MetricDescriptorIndicesPaginationIndices_FieldPathValue), nil 9559 } 9560 9561 func MustParseMetricDescriptorIndicesPaginationIndices_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndicesPaginationIndices_FieldPathValue { 9562 fpv, err := ParseMetricDescriptorIndicesPaginationIndices_FieldPathValue(pathStr, valueStr) 9563 if err != nil { 9564 panic(err) 9565 } 9566 return fpv 9567 } 9568 9569 type MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue struct { 9570 MetricDescriptorIndicesPaginationIndices_FieldTerminalPath 9571 value interface{} 9572 } 9573 9574 var _ MetricDescriptorIndicesPaginationIndices_FieldPathValue = (*MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue)(nil) 9575 9576 // GetRawValue returns raw value stored under selected path for 'PaginationIndices' as interface{} 9577 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) GetRawValue() interface{} { 9578 return fpv.value 9579 } 9580 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) AsNameValue() (string, bool) { 9581 res, ok := fpv.value.(string) 9582 return res, ok 9583 } 9584 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) AsResourceTypesValue() ([]string, bool) { 9585 res, ok := fpv.value.([]string) 9586 return res, ok 9587 } 9588 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) AsPartitionLabelSetsValue() ([]*MetricDescriptor_Indices_LabelsGroup, bool) { 9589 res, ok := fpv.value.([]*MetricDescriptor_Indices_LabelsGroup) 9590 return res, ok 9591 } 9592 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) AsViewsValue() ([]*MetricDescriptor_Indices_PaginationView, bool) { 9593 res, ok := fpv.value.([]*MetricDescriptor_Indices_PaginationView) 9594 return res, ok 9595 } 9596 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) AsFunctionsValue() ([]*MetricDescriptor_Indices_SortingFunction, bool) { 9597 res, ok := fpv.value.([]*MetricDescriptor_Indices_SortingFunction) 9598 return res, ok 9599 } 9600 9601 // SetTo stores value for selected field for object PaginationIndices 9602 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) SetTo(target **MetricDescriptor_Indices_PaginationIndices) { 9603 if *target == nil { 9604 *target = new(MetricDescriptor_Indices_PaginationIndices) 9605 } 9606 switch fpv.selector { 9607 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9608 (*target).Name = fpv.value.(string) 9609 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9610 (*target).ResourceTypes = fpv.value.([]string) 9611 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9612 (*target).PartitionLabelSets = fpv.value.([]*MetricDescriptor_Indices_LabelsGroup) 9613 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9614 (*target).Views = fpv.value.([]*MetricDescriptor_Indices_PaginationView) 9615 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9616 (*target).Functions = fpv.value.([]*MetricDescriptor_Indices_SortingFunction) 9617 default: 9618 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fpv.selector)) 9619 } 9620 } 9621 9622 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) SetToRaw(target proto.Message) { 9623 typedObject := target.(*MetricDescriptor_Indices_PaginationIndices) 9624 fpv.SetTo(&typedObject) 9625 } 9626 9627 // CompareWith compares value in the 'MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_Indices_PaginationIndices'. 9628 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_Indices_PaginationIndices) (int, bool) { 9629 switch fpv.selector { 9630 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9631 leftValue := fpv.value.(string) 9632 rightValue := source.GetName() 9633 if (leftValue) == (rightValue) { 9634 return 0, true 9635 } else if (leftValue) < (rightValue) { 9636 return -1, true 9637 } else { 9638 return 1, true 9639 } 9640 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9641 return 0, false 9642 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9643 return 0, false 9644 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9645 return 0, false 9646 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9647 return 0, false 9648 default: 9649 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fpv.selector)) 9650 } 9651 } 9652 9653 func (fpv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 9654 return fpv.CompareWith(source.(*MetricDescriptor_Indices_PaginationIndices)) 9655 } 9656 9657 type MetricDescriptorIndicesPaginationIndices_FieldSubPathValue struct { 9658 MetricDescriptorIndicesPaginationIndices_FieldPath 9659 subPathValue gotenobject.FieldPathValue 9660 } 9661 9662 var _ MetricDescriptorIndicesPaginationIndices_FieldPathValue = (*MetricDescriptorIndicesPaginationIndices_FieldSubPathValue)(nil) 9663 9664 func (fpvs *MetricDescriptorIndicesPaginationIndices_FieldSubPathValue) AsPartitionLabelSetsPathValue() (MetricDescriptorIndicesLabelsGroup_FieldPathValue, bool) { 9665 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesLabelsGroup_FieldPathValue) 9666 return res, ok 9667 } 9668 func (fpvs *MetricDescriptorIndicesPaginationIndices_FieldSubPathValue) AsViewsPathValue() (MetricDescriptorIndicesPaginationView_FieldPathValue, bool) { 9669 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesPaginationView_FieldPathValue) 9670 return res, ok 9671 } 9672 func (fpvs *MetricDescriptorIndicesPaginationIndices_FieldSubPathValue) AsFunctionsPathValue() (MetricDescriptorIndicesSortingFunction_FieldPathValue, bool) { 9673 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesSortingFunction_FieldPathValue) 9674 return res, ok 9675 } 9676 9677 func (fpvs *MetricDescriptorIndicesPaginationIndices_FieldSubPathValue) SetTo(target **MetricDescriptor_Indices_PaginationIndices) { 9678 if *target == nil { 9679 *target = new(MetricDescriptor_Indices_PaginationIndices) 9680 } 9681 switch fpvs.Selector() { 9682 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9683 panic("FieldPath setter is unsupported for array subpaths") 9684 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9685 panic("FieldPath setter is unsupported for array subpaths") 9686 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9687 panic("FieldPath setter is unsupported for array subpaths") 9688 default: 9689 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fpvs.Selector())) 9690 } 9691 } 9692 9693 func (fpvs *MetricDescriptorIndicesPaginationIndices_FieldSubPathValue) SetToRaw(target proto.Message) { 9694 typedObject := target.(*MetricDescriptor_Indices_PaginationIndices) 9695 fpvs.SetTo(&typedObject) 9696 } 9697 9698 func (fpvs *MetricDescriptorIndicesPaginationIndices_FieldSubPathValue) GetRawValue() interface{} { 9699 return fpvs.subPathValue.GetRawValue() 9700 } 9701 9702 func (fpvs *MetricDescriptorIndicesPaginationIndices_FieldSubPathValue) CompareWith(source *MetricDescriptor_Indices_PaginationIndices) (int, bool) { 9703 switch fpvs.Selector() { 9704 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9705 return 0, false // repeated field 9706 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9707 return 0, false // repeated field 9708 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9709 return 0, false // repeated field 9710 default: 9711 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fpvs.Selector())) 9712 } 9713 } 9714 9715 func (fpvs *MetricDescriptorIndicesPaginationIndices_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 9716 return fpvs.CompareWith(source.(*MetricDescriptor_Indices_PaginationIndices)) 9717 } 9718 9719 // MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue allows storing single item in Path-specific values for PaginationIndices according to their type 9720 // Present only for array (repeated) types. 9721 type MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue interface { 9722 gotenobject.FieldPathArrayItemValue 9723 MetricDescriptorIndicesPaginationIndices_FieldPath 9724 ContainsValue(*MetricDescriptor_Indices_PaginationIndices) bool 9725 } 9726 9727 // ParseMetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 9728 func ParseMetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue, error) { 9729 fp, err := ParseMetricDescriptorIndicesPaginationIndices_FieldPath(pathStr) 9730 if err != nil { 9731 return nil, err 9732 } 9733 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 9734 if err != nil { 9735 return nil, status.Errorf(codes.InvalidArgument, "error parsing PaginationIndices field path array item value from %s: %v", valueStr, err) 9736 } 9737 return fpaiv.(MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue), nil 9738 } 9739 9740 func MustParseMetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue { 9741 fpaiv, err := ParseMetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue(pathStr, valueStr) 9742 if err != nil { 9743 panic(err) 9744 } 9745 return fpaiv 9746 } 9747 9748 type MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue struct { 9749 MetricDescriptorIndicesPaginationIndices_FieldTerminalPath 9750 value interface{} 9751 } 9752 9753 var _ MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue = (*MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue)(nil) 9754 9755 // GetRawValue returns stored element value for array in object MetricDescriptor_Indices_PaginationIndices as interface{} 9756 func (fpaiv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 9757 return fpaiv.value 9758 } 9759 func (fpaiv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue) AsResourceTypesItemValue() (string, bool) { 9760 res, ok := fpaiv.value.(string) 9761 return res, ok 9762 } 9763 func (fpaiv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue) AsPartitionLabelSetsItemValue() (*MetricDescriptor_Indices_LabelsGroup, bool) { 9764 res, ok := fpaiv.value.(*MetricDescriptor_Indices_LabelsGroup) 9765 return res, ok 9766 } 9767 func (fpaiv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue) AsViewsItemValue() (*MetricDescriptor_Indices_PaginationView, bool) { 9768 res, ok := fpaiv.value.(*MetricDescriptor_Indices_PaginationView) 9769 return res, ok 9770 } 9771 func (fpaiv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue) AsFunctionsItemValue() (*MetricDescriptor_Indices_SortingFunction, bool) { 9772 res, ok := fpaiv.value.(*MetricDescriptor_Indices_SortingFunction) 9773 return res, ok 9774 } 9775 9776 func (fpaiv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_Indices_PaginationIndices) (interface{}, bool) { 9777 return nil, false 9778 } 9779 9780 func (fpaiv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 9781 return fpaiv.GetSingle(source.(*MetricDescriptor_Indices_PaginationIndices)) 9782 } 9783 9784 // Contains returns a boolean indicating if value that is being held is present in given 'PaginationIndices' 9785 func (fpaiv *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_PaginationIndices) bool { 9786 slice := fpaiv.MetricDescriptorIndicesPaginationIndices_FieldTerminalPath.Get(source) 9787 for _, v := range slice { 9788 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 9789 if proto.Equal(asProtoMsg, v.(proto.Message)) { 9790 return true 9791 } 9792 } else if reflect.DeepEqual(v, fpaiv.value) { 9793 return true 9794 } 9795 } 9796 return false 9797 } 9798 9799 type MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayItemValue struct { 9800 MetricDescriptorIndicesPaginationIndices_FieldPath 9801 subPathItemValue gotenobject.FieldPathArrayItemValue 9802 } 9803 9804 // GetRawValue returns stored array item value 9805 func (fpaivs *MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 9806 return fpaivs.subPathItemValue.GetRawItemValue() 9807 } 9808 func (fpaivs *MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayItemValue) AsPartitionLabelSetsPathItemValue() (MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue, bool) { 9809 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayItemValue) 9810 return res, ok 9811 } 9812 func (fpaivs *MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayItemValue) AsViewsPathItemValue() (MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue, bool) { 9813 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesPaginationView_FieldPathArrayItemValue) 9814 return res, ok 9815 } 9816 func (fpaivs *MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayItemValue) AsFunctionsPathItemValue() (MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue, bool) { 9817 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesSortingFunction_FieldPathArrayItemValue) 9818 return res, ok 9819 } 9820 9821 // Contains returns a boolean indicating if value that is being held is present in given 'PaginationIndices' 9822 func (fpaivs *MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_PaginationIndices) bool { 9823 switch fpaivs.Selector() { 9824 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9825 return false // repeated/map field 9826 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9827 return false // repeated/map field 9828 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9829 return false // repeated/map field 9830 default: 9831 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_PaginationIndices: %d", fpaivs.Selector())) 9832 } 9833 } 9834 9835 // MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues allows storing slice of values for PaginationIndices fields according to their type 9836 type MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues interface { 9837 gotenobject.FieldPathArrayOfValues 9838 MetricDescriptorIndicesPaginationIndices_FieldPath 9839 } 9840 9841 func ParseMetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues, error) { 9842 fp, err := ParseMetricDescriptorIndicesPaginationIndices_FieldPath(pathStr) 9843 if err != nil { 9844 return nil, err 9845 } 9846 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 9847 if err != nil { 9848 return nil, status.Errorf(codes.InvalidArgument, "error parsing PaginationIndices field path array of values from %s: %v", valuesStr, err) 9849 } 9850 return fpaov.(MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues), nil 9851 } 9852 9853 func MustParseMetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues { 9854 fpaov, err := ParseMetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues(pathStr, valuesStr) 9855 if err != nil { 9856 panic(err) 9857 } 9858 return fpaov 9859 } 9860 9861 type MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues struct { 9862 MetricDescriptorIndicesPaginationIndices_FieldTerminalPath 9863 values interface{} 9864 } 9865 9866 var _ MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues = (*MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues)(nil) 9867 9868 func (fpaov *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 9869 switch fpaov.selector { 9870 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorName: 9871 for _, v := range fpaov.values.([]string) { 9872 values = append(values, v) 9873 } 9874 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorResourceTypes: 9875 for _, v := range fpaov.values.([][]string) { 9876 values = append(values, v) 9877 } 9878 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorPartitionLabelSets: 9879 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_LabelsGroup) { 9880 values = append(values, v) 9881 } 9882 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorViews: 9883 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_PaginationView) { 9884 values = append(values, v) 9885 } 9886 case MetricDescriptorIndicesPaginationIndices_FieldPathSelectorFunctions: 9887 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_SortingFunction) { 9888 values = append(values, v) 9889 } 9890 } 9891 return 9892 } 9893 func (fpaov *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]string, bool) { 9894 res, ok := fpaov.values.([]string) 9895 return res, ok 9896 } 9897 func (fpaov *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues) AsResourceTypesArrayOfValues() ([][]string, bool) { 9898 res, ok := fpaov.values.([][]string) 9899 return res, ok 9900 } 9901 func (fpaov *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues) AsPartitionLabelSetsArrayOfValues() ([][]*MetricDescriptor_Indices_LabelsGroup, bool) { 9902 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_LabelsGroup) 9903 return res, ok 9904 } 9905 func (fpaov *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues) AsViewsArrayOfValues() ([][]*MetricDescriptor_Indices_PaginationView, bool) { 9906 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_PaginationView) 9907 return res, ok 9908 } 9909 func (fpaov *MetricDescriptorIndicesPaginationIndices_FieldTerminalPathArrayOfValues) AsFunctionsArrayOfValues() ([][]*MetricDescriptor_Indices_SortingFunction, bool) { 9910 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_SortingFunction) 9911 return res, ok 9912 } 9913 9914 type MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayOfValues struct { 9915 MetricDescriptorIndicesPaginationIndices_FieldPath 9916 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 9917 } 9918 9919 var _ MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues = (*MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayOfValues)(nil) 9920 9921 func (fpsaov *MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 9922 return fpsaov.subPathArrayOfValues.GetRawValues() 9923 } 9924 func (fpsaov *MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayOfValues) AsPartitionLabelSetsPathArrayOfValues() (MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues, bool) { 9925 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesLabelsGroup_FieldPathArrayOfValues) 9926 return res, ok 9927 } 9928 func (fpsaov *MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayOfValues) AsViewsPathArrayOfValues() (MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues, bool) { 9929 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesPaginationView_FieldPathArrayOfValues) 9930 return res, ok 9931 } 9932 func (fpsaov *MetricDescriptorIndicesPaginationIndices_FieldSubPathArrayOfValues) AsFunctionsPathArrayOfValues() (MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues, bool) { 9933 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesSortingFunction_FieldPathArrayOfValues) 9934 return res, ok 9935 } 9936 9937 // FieldPath provides implementation to handle 9938 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 9939 type MetricDescriptorIndicesIndexGroups_FieldPath interface { 9940 gotenobject.FieldPath 9941 Selector() MetricDescriptorIndicesIndexGroups_FieldPathSelector 9942 Get(source *MetricDescriptor_Indices_IndexGroups) []interface{} 9943 GetSingle(source *MetricDescriptor_Indices_IndexGroups) (interface{}, bool) 9944 ClearValue(item *MetricDescriptor_Indices_IndexGroups) 9945 9946 // Those methods build corresponding MetricDescriptorIndicesIndexGroups_FieldPathValue 9947 // (or array of values) and holds passed value. Panics if injected type is incorrect. 9948 WithIValue(value interface{}) MetricDescriptorIndicesIndexGroups_FieldPathValue 9949 WithIArrayOfValues(values interface{}) MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues 9950 WithIArrayItemValue(value interface{}) MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue 9951 } 9952 9953 type MetricDescriptorIndicesIndexGroups_FieldPathSelector int32 9954 9955 const ( 9956 MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices MetricDescriptorIndicesIndexGroups_FieldPathSelector = 0 9957 MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices MetricDescriptorIndicesIndexGroups_FieldPathSelector = 1 9958 MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices MetricDescriptorIndicesIndexGroups_FieldPathSelector = 2 9959 ) 9960 9961 func (s MetricDescriptorIndicesIndexGroups_FieldPathSelector) String() string { 9962 switch s { 9963 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 9964 return "pre_aggregated_indices" 9965 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 9966 return "non_aggregated_indices" 9967 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 9968 return "pagination_indices" 9969 default: 9970 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", s)) 9971 } 9972 } 9973 9974 func BuildMetricDescriptorIndicesIndexGroups_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorIndicesIndexGroups_FieldPath, error) { 9975 if len(fp) == 0 { 9976 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_Indices_IndexGroups") 9977 } 9978 if len(fp) == 1 { 9979 switch fp[0] { 9980 case "pre_aggregated_indices", "preAggregatedIndices", "pre-aggregated-indices": 9981 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPath{selector: MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices}, nil 9982 case "non_aggregated_indices", "nonAggregatedIndices", "non-aggregated-indices": 9983 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPath{selector: MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices}, nil 9984 case "pagination_indices", "paginationIndices", "pagination-indices": 9985 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPath{selector: MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices}, nil 9986 } 9987 } else { 9988 switch fp[0] { 9989 case "pre_aggregated_indices", "preAggregatedIndices", "pre-aggregated-indices": 9990 if subpath, err := BuildMetricDescriptorIndicesPreAggregatedIndices_FieldPath(fp[1:]); err != nil { 9991 return nil, err 9992 } else { 9993 return &MetricDescriptorIndicesIndexGroups_FieldSubPath{selector: MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices, subPath: subpath}, nil 9994 } 9995 case "non_aggregated_indices", "nonAggregatedIndices", "non-aggregated-indices": 9996 if subpath, err := BuildMetricDescriptorIndicesNonAggregatedIndices_FieldPath(fp[1:]); err != nil { 9997 return nil, err 9998 } else { 9999 return &MetricDescriptorIndicesIndexGroups_FieldSubPath{selector: MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices, subPath: subpath}, nil 10000 } 10001 case "pagination_indices", "paginationIndices", "pagination-indices": 10002 if subpath, err := BuildMetricDescriptorIndicesPaginationIndices_FieldPath(fp[1:]); err != nil { 10003 return nil, err 10004 } else { 10005 return &MetricDescriptorIndicesIndexGroups_FieldSubPath{selector: MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices, subPath: subpath}, nil 10006 } 10007 } 10008 } 10009 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_Indices_IndexGroups", fp) 10010 } 10011 10012 func ParseMetricDescriptorIndicesIndexGroups_FieldPath(rawField string) (MetricDescriptorIndicesIndexGroups_FieldPath, error) { 10013 fp, err := gotenobject.ParseRawFieldPath(rawField) 10014 if err != nil { 10015 return nil, err 10016 } 10017 return BuildMetricDescriptorIndicesIndexGroups_FieldPath(fp) 10018 } 10019 10020 func MustParseMetricDescriptorIndicesIndexGroups_FieldPath(rawField string) MetricDescriptorIndicesIndexGroups_FieldPath { 10021 fp, err := ParseMetricDescriptorIndicesIndexGroups_FieldPath(rawField) 10022 if err != nil { 10023 panic(err) 10024 } 10025 return fp 10026 } 10027 10028 type MetricDescriptorIndicesIndexGroups_FieldTerminalPath struct { 10029 selector MetricDescriptorIndicesIndexGroups_FieldPathSelector 10030 } 10031 10032 var _ MetricDescriptorIndicesIndexGroups_FieldPath = (*MetricDescriptorIndicesIndexGroups_FieldTerminalPath)(nil) 10033 10034 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) Selector() MetricDescriptorIndicesIndexGroups_FieldPathSelector { 10035 return fp.selector 10036 } 10037 10038 // String returns path representation in proto convention 10039 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) String() string { 10040 return fp.selector.String() 10041 } 10042 10043 // JSONString returns path representation is JSON convention 10044 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) JSONString() string { 10045 return strcase.ToLowerCamel(fp.String()) 10046 } 10047 10048 // Get returns all values pointed by specific field from source MetricDescriptor_Indices_IndexGroups 10049 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) Get(source *MetricDescriptor_Indices_IndexGroups) (values []interface{}) { 10050 if source != nil { 10051 switch fp.selector { 10052 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10053 for _, value := range source.GetPreAggregatedIndices() { 10054 values = append(values, value) 10055 } 10056 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10057 for _, value := range source.GetNonAggregatedIndices() { 10058 values = append(values, value) 10059 } 10060 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10061 for _, value := range source.GetPaginationIndices() { 10062 values = append(values, value) 10063 } 10064 default: 10065 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fp.selector)) 10066 } 10067 } 10068 return 10069 } 10070 10071 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 10072 return fp.Get(source.(*MetricDescriptor_Indices_IndexGroups)) 10073 } 10074 10075 // GetSingle returns value pointed by specific field of from source MetricDescriptor_Indices_IndexGroups 10076 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) GetSingle(source *MetricDescriptor_Indices_IndexGroups) (interface{}, bool) { 10077 switch fp.selector { 10078 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10079 res := source.GetPreAggregatedIndices() 10080 return res, res != nil 10081 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10082 res := source.GetNonAggregatedIndices() 10083 return res, res != nil 10084 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10085 res := source.GetPaginationIndices() 10086 return res, res != nil 10087 default: 10088 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fp.selector)) 10089 } 10090 } 10091 10092 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 10093 return fp.GetSingle(source.(*MetricDescriptor_Indices_IndexGroups)) 10094 } 10095 10096 // GetDefault returns a default value of the field type 10097 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) GetDefault() interface{} { 10098 switch fp.selector { 10099 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10100 return ([]*MetricDescriptor_Indices_PreAggregatedIndices)(nil) 10101 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10102 return ([]*MetricDescriptor_Indices_NonAggregatedIndices)(nil) 10103 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10104 return ([]*MetricDescriptor_Indices_PaginationIndices)(nil) 10105 default: 10106 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fp.selector)) 10107 } 10108 } 10109 10110 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) ClearValue(item *MetricDescriptor_Indices_IndexGroups) { 10111 if item != nil { 10112 switch fp.selector { 10113 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10114 item.PreAggregatedIndices = nil 10115 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10116 item.NonAggregatedIndices = nil 10117 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10118 item.PaginationIndices = nil 10119 default: 10120 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fp.selector)) 10121 } 10122 } 10123 } 10124 10125 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) ClearValueRaw(item proto.Message) { 10126 fp.ClearValue(item.(*MetricDescriptor_Indices_IndexGroups)) 10127 } 10128 10129 // IsLeaf - whether field path is holds simple value 10130 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) IsLeaf() bool { 10131 return false 10132 } 10133 10134 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 10135 return []gotenobject.FieldPath{fp} 10136 } 10137 10138 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorIndicesIndexGroups_FieldPathValue { 10139 switch fp.selector { 10140 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10141 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_PreAggregatedIndices)} 10142 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10143 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_NonAggregatedIndices)} 10144 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10145 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_Indices_PaginationIndices)} 10146 default: 10147 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fp.selector)) 10148 } 10149 } 10150 10151 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 10152 return fp.WithIValue(value) 10153 } 10154 10155 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues { 10156 fpaov := &MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp} 10157 switch fp.selector { 10158 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10159 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_PreAggregatedIndices)} 10160 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10161 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_NonAggregatedIndices)} 10162 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10163 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_Indices_PaginationIndices)} 10164 default: 10165 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fp.selector)) 10166 } 10167 return fpaov 10168 } 10169 10170 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 10171 return fp.WithIArrayOfValues(values) 10172 } 10173 10174 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue { 10175 switch fp.selector { 10176 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10177 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_PreAggregatedIndices)} 10178 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10179 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_NonAggregatedIndices)} 10180 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10181 return &MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue{MetricDescriptorIndicesIndexGroups_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_Indices_PaginationIndices)} 10182 default: 10183 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fp.selector)) 10184 } 10185 } 10186 10187 func (fp *MetricDescriptorIndicesIndexGroups_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 10188 return fp.WithIArrayItemValue(value) 10189 } 10190 10191 type MetricDescriptorIndicesIndexGroups_FieldSubPath struct { 10192 selector MetricDescriptorIndicesIndexGroups_FieldPathSelector 10193 subPath gotenobject.FieldPath 10194 } 10195 10196 var _ MetricDescriptorIndicesIndexGroups_FieldPath = (*MetricDescriptorIndicesIndexGroups_FieldSubPath)(nil) 10197 10198 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) Selector() MetricDescriptorIndicesIndexGroups_FieldPathSelector { 10199 return fps.selector 10200 } 10201 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) AsPreAggregatedIndicesSubPath() (MetricDescriptorIndicesPreAggregatedIndices_FieldPath, bool) { 10202 res, ok := fps.subPath.(MetricDescriptorIndicesPreAggregatedIndices_FieldPath) 10203 return res, ok 10204 } 10205 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) AsNonAggregatedIndicesSubPath() (MetricDescriptorIndicesNonAggregatedIndices_FieldPath, bool) { 10206 res, ok := fps.subPath.(MetricDescriptorIndicesNonAggregatedIndices_FieldPath) 10207 return res, ok 10208 } 10209 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) AsPaginationIndicesSubPath() (MetricDescriptorIndicesPaginationIndices_FieldPath, bool) { 10210 res, ok := fps.subPath.(MetricDescriptorIndicesPaginationIndices_FieldPath) 10211 return res, ok 10212 } 10213 10214 // String returns path representation in proto convention 10215 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) String() string { 10216 return fps.selector.String() + "." + fps.subPath.String() 10217 } 10218 10219 // JSONString returns path representation is JSON convention 10220 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) JSONString() string { 10221 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 10222 } 10223 10224 // Get returns all values pointed by selected field from source MetricDescriptor_Indices_IndexGroups 10225 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) Get(source *MetricDescriptor_Indices_IndexGroups) (values []interface{}) { 10226 switch fps.selector { 10227 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10228 for _, item := range source.GetPreAggregatedIndices() { 10229 values = append(values, fps.subPath.GetRaw(item)...) 10230 } 10231 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10232 for _, item := range source.GetNonAggregatedIndices() { 10233 values = append(values, fps.subPath.GetRaw(item)...) 10234 } 10235 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10236 for _, item := range source.GetPaginationIndices() { 10237 values = append(values, fps.subPath.GetRaw(item)...) 10238 } 10239 default: 10240 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fps.selector)) 10241 } 10242 return 10243 } 10244 10245 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) GetRaw(source proto.Message) []interface{} { 10246 return fps.Get(source.(*MetricDescriptor_Indices_IndexGroups)) 10247 } 10248 10249 // GetSingle returns value of selected field from source MetricDescriptor_Indices_IndexGroups 10250 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) GetSingle(source *MetricDescriptor_Indices_IndexGroups) (interface{}, bool) { 10251 switch fps.selector { 10252 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10253 if len(source.GetPreAggregatedIndices()) == 0 { 10254 return nil, false 10255 } 10256 return fps.subPath.GetSingleRaw(source.GetPreAggregatedIndices()[0]) 10257 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10258 if len(source.GetNonAggregatedIndices()) == 0 { 10259 return nil, false 10260 } 10261 return fps.subPath.GetSingleRaw(source.GetNonAggregatedIndices()[0]) 10262 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10263 if len(source.GetPaginationIndices()) == 0 { 10264 return nil, false 10265 } 10266 return fps.subPath.GetSingleRaw(source.GetPaginationIndices()[0]) 10267 default: 10268 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fps.selector)) 10269 } 10270 } 10271 10272 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 10273 return fps.GetSingle(source.(*MetricDescriptor_Indices_IndexGroups)) 10274 } 10275 10276 // GetDefault returns a default value of the field type 10277 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) GetDefault() interface{} { 10278 return fps.subPath.GetDefault() 10279 } 10280 10281 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) ClearValue(item *MetricDescriptor_Indices_IndexGroups) { 10282 if item != nil { 10283 switch fps.selector { 10284 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10285 for _, subItem := range item.PreAggregatedIndices { 10286 fps.subPath.ClearValueRaw(subItem) 10287 } 10288 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10289 for _, subItem := range item.NonAggregatedIndices { 10290 fps.subPath.ClearValueRaw(subItem) 10291 } 10292 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10293 for _, subItem := range item.PaginationIndices { 10294 fps.subPath.ClearValueRaw(subItem) 10295 } 10296 default: 10297 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fps.selector)) 10298 } 10299 } 10300 } 10301 10302 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) ClearValueRaw(item proto.Message) { 10303 fps.ClearValue(item.(*MetricDescriptor_Indices_IndexGroups)) 10304 } 10305 10306 // IsLeaf - whether field path is holds simple value 10307 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) IsLeaf() bool { 10308 return fps.subPath.IsLeaf() 10309 } 10310 10311 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 10312 iPaths := []gotenobject.FieldPath{&MetricDescriptorIndicesIndexGroups_FieldTerminalPath{selector: fps.selector}} 10313 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 10314 return iPaths 10315 } 10316 10317 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) WithIValue(value interface{}) MetricDescriptorIndicesIndexGroups_FieldPathValue { 10318 return &MetricDescriptorIndicesIndexGroups_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 10319 } 10320 10321 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 10322 return fps.WithIValue(value) 10323 } 10324 10325 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues { 10326 return &MetricDescriptorIndicesIndexGroups_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 10327 } 10328 10329 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 10330 return fps.WithIArrayOfValues(values) 10331 } 10332 10333 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue { 10334 return &MetricDescriptorIndicesIndexGroups_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 10335 } 10336 10337 func (fps *MetricDescriptorIndicesIndexGroups_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 10338 return fps.WithIArrayItemValue(value) 10339 } 10340 10341 // MetricDescriptorIndicesIndexGroups_FieldPathValue allows storing values for IndexGroups fields according to their type 10342 type MetricDescriptorIndicesIndexGroups_FieldPathValue interface { 10343 MetricDescriptorIndicesIndexGroups_FieldPath 10344 gotenobject.FieldPathValue 10345 SetTo(target **MetricDescriptor_Indices_IndexGroups) 10346 CompareWith(*MetricDescriptor_Indices_IndexGroups) (cmp int, comparable bool) 10347 } 10348 10349 func ParseMetricDescriptorIndicesIndexGroups_FieldPathValue(pathStr, valueStr string) (MetricDescriptorIndicesIndexGroups_FieldPathValue, error) { 10350 fp, err := ParseMetricDescriptorIndicesIndexGroups_FieldPath(pathStr) 10351 if err != nil { 10352 return nil, err 10353 } 10354 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 10355 if err != nil { 10356 return nil, status.Errorf(codes.InvalidArgument, "error parsing IndexGroups field path value from %s: %v", valueStr, err) 10357 } 10358 return fpv.(MetricDescriptorIndicesIndexGroups_FieldPathValue), nil 10359 } 10360 10361 func MustParseMetricDescriptorIndicesIndexGroups_FieldPathValue(pathStr, valueStr string) MetricDescriptorIndicesIndexGroups_FieldPathValue { 10362 fpv, err := ParseMetricDescriptorIndicesIndexGroups_FieldPathValue(pathStr, valueStr) 10363 if err != nil { 10364 panic(err) 10365 } 10366 return fpv 10367 } 10368 10369 type MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue struct { 10370 MetricDescriptorIndicesIndexGroups_FieldTerminalPath 10371 value interface{} 10372 } 10373 10374 var _ MetricDescriptorIndicesIndexGroups_FieldPathValue = (*MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue)(nil) 10375 10376 // GetRawValue returns raw value stored under selected path for 'IndexGroups' as interface{} 10377 func (fpv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue) GetRawValue() interface{} { 10378 return fpv.value 10379 } 10380 func (fpv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue) AsPreAggregatedIndicesValue() ([]*MetricDescriptor_Indices_PreAggregatedIndices, bool) { 10381 res, ok := fpv.value.([]*MetricDescriptor_Indices_PreAggregatedIndices) 10382 return res, ok 10383 } 10384 func (fpv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue) AsNonAggregatedIndicesValue() ([]*MetricDescriptor_Indices_NonAggregatedIndices, bool) { 10385 res, ok := fpv.value.([]*MetricDescriptor_Indices_NonAggregatedIndices) 10386 return res, ok 10387 } 10388 func (fpv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue) AsPaginationIndicesValue() ([]*MetricDescriptor_Indices_PaginationIndices, bool) { 10389 res, ok := fpv.value.([]*MetricDescriptor_Indices_PaginationIndices) 10390 return res, ok 10391 } 10392 10393 // SetTo stores value for selected field for object IndexGroups 10394 func (fpv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue) SetTo(target **MetricDescriptor_Indices_IndexGroups) { 10395 if *target == nil { 10396 *target = new(MetricDescriptor_Indices_IndexGroups) 10397 } 10398 switch fpv.selector { 10399 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10400 (*target).PreAggregatedIndices = fpv.value.([]*MetricDescriptor_Indices_PreAggregatedIndices) 10401 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10402 (*target).NonAggregatedIndices = fpv.value.([]*MetricDescriptor_Indices_NonAggregatedIndices) 10403 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10404 (*target).PaginationIndices = fpv.value.([]*MetricDescriptor_Indices_PaginationIndices) 10405 default: 10406 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fpv.selector)) 10407 } 10408 } 10409 10410 func (fpv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue) SetToRaw(target proto.Message) { 10411 typedObject := target.(*MetricDescriptor_Indices_IndexGroups) 10412 fpv.SetTo(&typedObject) 10413 } 10414 10415 // CompareWith compares value in the 'MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_Indices_IndexGroups'. 10416 func (fpv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_Indices_IndexGroups) (int, bool) { 10417 switch fpv.selector { 10418 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10419 return 0, false 10420 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10421 return 0, false 10422 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10423 return 0, false 10424 default: 10425 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fpv.selector)) 10426 } 10427 } 10428 10429 func (fpv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 10430 return fpv.CompareWith(source.(*MetricDescriptor_Indices_IndexGroups)) 10431 } 10432 10433 type MetricDescriptorIndicesIndexGroups_FieldSubPathValue struct { 10434 MetricDescriptorIndicesIndexGroups_FieldPath 10435 subPathValue gotenobject.FieldPathValue 10436 } 10437 10438 var _ MetricDescriptorIndicesIndexGroups_FieldPathValue = (*MetricDescriptorIndicesIndexGroups_FieldSubPathValue)(nil) 10439 10440 func (fpvs *MetricDescriptorIndicesIndexGroups_FieldSubPathValue) AsPreAggregatedIndicesPathValue() (MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue, bool) { 10441 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesPreAggregatedIndices_FieldPathValue) 10442 return res, ok 10443 } 10444 func (fpvs *MetricDescriptorIndicesIndexGroups_FieldSubPathValue) AsNonAggregatedIndicesPathValue() (MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue, bool) { 10445 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesNonAggregatedIndices_FieldPathValue) 10446 return res, ok 10447 } 10448 func (fpvs *MetricDescriptorIndicesIndexGroups_FieldSubPathValue) AsPaginationIndicesPathValue() (MetricDescriptorIndicesPaginationIndices_FieldPathValue, bool) { 10449 res, ok := fpvs.subPathValue.(MetricDescriptorIndicesPaginationIndices_FieldPathValue) 10450 return res, ok 10451 } 10452 10453 func (fpvs *MetricDescriptorIndicesIndexGroups_FieldSubPathValue) SetTo(target **MetricDescriptor_Indices_IndexGroups) { 10454 if *target == nil { 10455 *target = new(MetricDescriptor_Indices_IndexGroups) 10456 } 10457 switch fpvs.Selector() { 10458 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10459 panic("FieldPath setter is unsupported for array subpaths") 10460 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10461 panic("FieldPath setter is unsupported for array subpaths") 10462 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10463 panic("FieldPath setter is unsupported for array subpaths") 10464 default: 10465 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fpvs.Selector())) 10466 } 10467 } 10468 10469 func (fpvs *MetricDescriptorIndicesIndexGroups_FieldSubPathValue) SetToRaw(target proto.Message) { 10470 typedObject := target.(*MetricDescriptor_Indices_IndexGroups) 10471 fpvs.SetTo(&typedObject) 10472 } 10473 10474 func (fpvs *MetricDescriptorIndicesIndexGroups_FieldSubPathValue) GetRawValue() interface{} { 10475 return fpvs.subPathValue.GetRawValue() 10476 } 10477 10478 func (fpvs *MetricDescriptorIndicesIndexGroups_FieldSubPathValue) CompareWith(source *MetricDescriptor_Indices_IndexGroups) (int, bool) { 10479 switch fpvs.Selector() { 10480 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10481 return 0, false // repeated field 10482 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10483 return 0, false // repeated field 10484 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10485 return 0, false // repeated field 10486 default: 10487 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fpvs.Selector())) 10488 } 10489 } 10490 10491 func (fpvs *MetricDescriptorIndicesIndexGroups_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 10492 return fpvs.CompareWith(source.(*MetricDescriptor_Indices_IndexGroups)) 10493 } 10494 10495 // MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue allows storing single item in Path-specific values for IndexGroups according to their type 10496 // Present only for array (repeated) types. 10497 type MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue interface { 10498 gotenobject.FieldPathArrayItemValue 10499 MetricDescriptorIndicesIndexGroups_FieldPath 10500 ContainsValue(*MetricDescriptor_Indices_IndexGroups) bool 10501 } 10502 10503 // ParseMetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 10504 func ParseMetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue, error) { 10505 fp, err := ParseMetricDescriptorIndicesIndexGroups_FieldPath(pathStr) 10506 if err != nil { 10507 return nil, err 10508 } 10509 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 10510 if err != nil { 10511 return nil, status.Errorf(codes.InvalidArgument, "error parsing IndexGroups field path array item value from %s: %v", valueStr, err) 10512 } 10513 return fpaiv.(MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue), nil 10514 } 10515 10516 func MustParseMetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue { 10517 fpaiv, err := ParseMetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue(pathStr, valueStr) 10518 if err != nil { 10519 panic(err) 10520 } 10521 return fpaiv 10522 } 10523 10524 type MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue struct { 10525 MetricDescriptorIndicesIndexGroups_FieldTerminalPath 10526 value interface{} 10527 } 10528 10529 var _ MetricDescriptorIndicesIndexGroups_FieldPathArrayItemValue = (*MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue)(nil) 10530 10531 // GetRawValue returns stored element value for array in object MetricDescriptor_Indices_IndexGroups as interface{} 10532 func (fpaiv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 10533 return fpaiv.value 10534 } 10535 func (fpaiv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue) AsPreAggregatedIndicesItemValue() (*MetricDescriptor_Indices_PreAggregatedIndices, bool) { 10536 res, ok := fpaiv.value.(*MetricDescriptor_Indices_PreAggregatedIndices) 10537 return res, ok 10538 } 10539 func (fpaiv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue) AsNonAggregatedIndicesItemValue() (*MetricDescriptor_Indices_NonAggregatedIndices, bool) { 10540 res, ok := fpaiv.value.(*MetricDescriptor_Indices_NonAggregatedIndices) 10541 return res, ok 10542 } 10543 func (fpaiv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue) AsPaginationIndicesItemValue() (*MetricDescriptor_Indices_PaginationIndices, bool) { 10544 res, ok := fpaiv.value.(*MetricDescriptor_Indices_PaginationIndices) 10545 return res, ok 10546 } 10547 10548 func (fpaiv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_Indices_IndexGroups) (interface{}, bool) { 10549 return nil, false 10550 } 10551 10552 func (fpaiv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 10553 return fpaiv.GetSingle(source.(*MetricDescriptor_Indices_IndexGroups)) 10554 } 10555 10556 // Contains returns a boolean indicating if value that is being held is present in given 'IndexGroups' 10557 func (fpaiv *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_IndexGroups) bool { 10558 slice := fpaiv.MetricDescriptorIndicesIndexGroups_FieldTerminalPath.Get(source) 10559 for _, v := range slice { 10560 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 10561 if proto.Equal(asProtoMsg, v.(proto.Message)) { 10562 return true 10563 } 10564 } else if reflect.DeepEqual(v, fpaiv.value) { 10565 return true 10566 } 10567 } 10568 return false 10569 } 10570 10571 type MetricDescriptorIndicesIndexGroups_FieldSubPathArrayItemValue struct { 10572 MetricDescriptorIndicesIndexGroups_FieldPath 10573 subPathItemValue gotenobject.FieldPathArrayItemValue 10574 } 10575 10576 // GetRawValue returns stored array item value 10577 func (fpaivs *MetricDescriptorIndicesIndexGroups_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 10578 return fpaivs.subPathItemValue.GetRawItemValue() 10579 } 10580 func (fpaivs *MetricDescriptorIndicesIndexGroups_FieldSubPathArrayItemValue) AsPreAggregatedIndicesPathItemValue() (MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue, bool) { 10581 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayItemValue) 10582 return res, ok 10583 } 10584 func (fpaivs *MetricDescriptorIndicesIndexGroups_FieldSubPathArrayItemValue) AsNonAggregatedIndicesPathItemValue() (MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue, bool) { 10585 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayItemValue) 10586 return res, ok 10587 } 10588 func (fpaivs *MetricDescriptorIndicesIndexGroups_FieldSubPathArrayItemValue) AsPaginationIndicesPathItemValue() (MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue, bool) { 10589 res, ok := fpaivs.subPathItemValue.(MetricDescriptorIndicesPaginationIndices_FieldPathArrayItemValue) 10590 return res, ok 10591 } 10592 10593 // Contains returns a boolean indicating if value that is being held is present in given 'IndexGroups' 10594 func (fpaivs *MetricDescriptorIndicesIndexGroups_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor_Indices_IndexGroups) bool { 10595 switch fpaivs.Selector() { 10596 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10597 return false // repeated/map field 10598 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10599 return false // repeated/map field 10600 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10601 return false // repeated/map field 10602 default: 10603 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_Indices_IndexGroups: %d", fpaivs.Selector())) 10604 } 10605 } 10606 10607 // MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues allows storing slice of values for IndexGroups fields according to their type 10608 type MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues interface { 10609 gotenobject.FieldPathArrayOfValues 10610 MetricDescriptorIndicesIndexGroups_FieldPath 10611 } 10612 10613 func ParseMetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues, error) { 10614 fp, err := ParseMetricDescriptorIndicesIndexGroups_FieldPath(pathStr) 10615 if err != nil { 10616 return nil, err 10617 } 10618 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 10619 if err != nil { 10620 return nil, status.Errorf(codes.InvalidArgument, "error parsing IndexGroups field path array of values from %s: %v", valuesStr, err) 10621 } 10622 return fpaov.(MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues), nil 10623 } 10624 10625 func MustParseMetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues { 10626 fpaov, err := ParseMetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues(pathStr, valuesStr) 10627 if err != nil { 10628 panic(err) 10629 } 10630 return fpaov 10631 } 10632 10633 type MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues struct { 10634 MetricDescriptorIndicesIndexGroups_FieldTerminalPath 10635 values interface{} 10636 } 10637 10638 var _ MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues = (*MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues)(nil) 10639 10640 func (fpaov *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 10641 switch fpaov.selector { 10642 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPreAggregatedIndices: 10643 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_PreAggregatedIndices) { 10644 values = append(values, v) 10645 } 10646 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorNonAggregatedIndices: 10647 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_NonAggregatedIndices) { 10648 values = append(values, v) 10649 } 10650 case MetricDescriptorIndicesIndexGroups_FieldPathSelectorPaginationIndices: 10651 for _, v := range fpaov.values.([][]*MetricDescriptor_Indices_PaginationIndices) { 10652 values = append(values, v) 10653 } 10654 } 10655 return 10656 } 10657 func (fpaov *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues) AsPreAggregatedIndicesArrayOfValues() ([][]*MetricDescriptor_Indices_PreAggregatedIndices, bool) { 10658 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_PreAggregatedIndices) 10659 return res, ok 10660 } 10661 func (fpaov *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues) AsNonAggregatedIndicesArrayOfValues() ([][]*MetricDescriptor_Indices_NonAggregatedIndices, bool) { 10662 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_NonAggregatedIndices) 10663 return res, ok 10664 } 10665 func (fpaov *MetricDescriptorIndicesIndexGroups_FieldTerminalPathArrayOfValues) AsPaginationIndicesArrayOfValues() ([][]*MetricDescriptor_Indices_PaginationIndices, bool) { 10666 res, ok := fpaov.values.([][]*MetricDescriptor_Indices_PaginationIndices) 10667 return res, ok 10668 } 10669 10670 type MetricDescriptorIndicesIndexGroups_FieldSubPathArrayOfValues struct { 10671 MetricDescriptorIndicesIndexGroups_FieldPath 10672 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 10673 } 10674 10675 var _ MetricDescriptorIndicesIndexGroups_FieldPathArrayOfValues = (*MetricDescriptorIndicesIndexGroups_FieldSubPathArrayOfValues)(nil) 10676 10677 func (fpsaov *MetricDescriptorIndicesIndexGroups_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 10678 return fpsaov.subPathArrayOfValues.GetRawValues() 10679 } 10680 func (fpsaov *MetricDescriptorIndicesIndexGroups_FieldSubPathArrayOfValues) AsPreAggregatedIndicesPathArrayOfValues() (MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues, bool) { 10681 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesPreAggregatedIndices_FieldPathArrayOfValues) 10682 return res, ok 10683 } 10684 func (fpsaov *MetricDescriptorIndicesIndexGroups_FieldSubPathArrayOfValues) AsNonAggregatedIndicesPathArrayOfValues() (MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues, bool) { 10685 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesNonAggregatedIndices_FieldPathArrayOfValues) 10686 return res, ok 10687 } 10688 func (fpsaov *MetricDescriptorIndicesIndexGroups_FieldSubPathArrayOfValues) AsPaginationIndicesPathArrayOfValues() (MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues, bool) { 10689 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorIndicesPaginationIndices_FieldPathArrayOfValues) 10690 return res, ok 10691 } 10692 10693 // FieldPath provides implementation to handle 10694 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 10695 type MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath interface { 10696 gotenobject.FieldPath 10697 Selector() MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelector 10698 Get(source *MetricDescriptor_BinaryIndices_PreAggregatedIndex) []interface{} 10699 GetSingle(source *MetricDescriptor_BinaryIndices_PreAggregatedIndex) (interface{}, bool) 10700 ClearValue(item *MetricDescriptor_BinaryIndices_PreAggregatedIndex) 10701 10702 // Those methods build corresponding MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue 10703 // (or array of values) and holds passed value. Panics if injected type is incorrect. 10704 WithIValue(value interface{}) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue 10705 WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues 10706 WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue 10707 } 10708 10709 type MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelector int32 10710 10711 const ( 10712 MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelector = 0 10713 MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelector = 1 10714 MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelector = 2 10715 ) 10716 10717 func (s MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelector) String() string { 10718 switch s { 10719 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 10720 return "key_data" 10721 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 10722 return "writing_aligners" 10723 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 10724 return "closed_aligners" 10725 default: 10726 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", s)) 10727 } 10728 } 10729 10730 func BuildMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath, error) { 10731 if len(fp) == 0 { 10732 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_BinaryIndices_PreAggregatedIndex") 10733 } 10734 if len(fp) == 1 { 10735 switch fp[0] { 10736 case "key_data", "keyData", "key-data": 10737 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData}, nil 10738 case "writing_aligners", "writingAligners", "writing-aligners": 10739 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners}, nil 10740 case "closed_aligners", "closedAligners", "closed-aligners": 10741 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners}, nil 10742 } 10743 } 10744 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_BinaryIndices_PreAggregatedIndex", fp) 10745 } 10746 10747 func ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(rawField string) (MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath, error) { 10748 fp, err := gotenobject.ParseRawFieldPath(rawField) 10749 if err != nil { 10750 return nil, err 10751 } 10752 return BuildMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(fp) 10753 } 10754 10755 func MustParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(rawField string) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath { 10756 fp, err := ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(rawField) 10757 if err != nil { 10758 panic(err) 10759 } 10760 return fp 10761 } 10762 10763 type MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath struct { 10764 selector MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelector 10765 } 10766 10767 var _ MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath = (*MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath)(nil) 10768 10769 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) Selector() MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelector { 10770 return fp.selector 10771 } 10772 10773 // String returns path representation in proto convention 10774 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) String() string { 10775 return fp.selector.String() 10776 } 10777 10778 // JSONString returns path representation is JSON convention 10779 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) JSONString() string { 10780 return strcase.ToLowerCamel(fp.String()) 10781 } 10782 10783 // Get returns all values pointed by specific field from source MetricDescriptor_BinaryIndices_PreAggregatedIndex 10784 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) Get(source *MetricDescriptor_BinaryIndices_PreAggregatedIndex) (values []interface{}) { 10785 if source != nil { 10786 switch fp.selector { 10787 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 10788 values = append(values, source.KeyData) 10789 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 10790 for _, value := range source.GetWritingAligners() { 10791 values = append(values, value) 10792 } 10793 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 10794 for _, value := range source.GetClosedAligners() { 10795 values = append(values, value) 10796 } 10797 default: 10798 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", fp.selector)) 10799 } 10800 } 10801 return 10802 } 10803 10804 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 10805 return fp.Get(source.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex)) 10806 } 10807 10808 // GetSingle returns value pointed by specific field of from source MetricDescriptor_BinaryIndices_PreAggregatedIndex 10809 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) GetSingle(source *MetricDescriptor_BinaryIndices_PreAggregatedIndex) (interface{}, bool) { 10810 switch fp.selector { 10811 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 10812 res := source.GetKeyData() 10813 return res, res != nil 10814 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 10815 res := source.GetWritingAligners() 10816 return res, res != nil 10817 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 10818 res := source.GetClosedAligners() 10819 return res, res != nil 10820 default: 10821 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", fp.selector)) 10822 } 10823 } 10824 10825 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 10826 return fp.GetSingle(source.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex)) 10827 } 10828 10829 // GetDefault returns a default value of the field type 10830 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) GetDefault() interface{} { 10831 switch fp.selector { 10832 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 10833 return ([]byte)(nil) 10834 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 10835 return ([][]byte)(nil) 10836 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 10837 return ([][]byte)(nil) 10838 default: 10839 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", fp.selector)) 10840 } 10841 } 10842 10843 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) ClearValue(item *MetricDescriptor_BinaryIndices_PreAggregatedIndex) { 10844 if item != nil { 10845 switch fp.selector { 10846 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 10847 item.KeyData = nil 10848 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 10849 item.WritingAligners = nil 10850 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 10851 item.ClosedAligners = nil 10852 default: 10853 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", fp.selector)) 10854 } 10855 } 10856 } 10857 10858 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) ClearValueRaw(item proto.Message) { 10859 fp.ClearValue(item.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex)) 10860 } 10861 10862 // IsLeaf - whether field path is holds simple value 10863 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) IsLeaf() bool { 10864 return fp.selector == MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData || 10865 fp.selector == MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners || 10866 fp.selector == MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners 10867 } 10868 10869 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 10870 return []gotenobject.FieldPath{fp} 10871 } 10872 10873 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue { 10874 switch fp.selector { 10875 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 10876 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue{MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: *fp, value: value.([]byte)} 10877 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 10878 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue{MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: *fp, value: value.([][]byte)} 10879 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 10880 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue{MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: *fp, value: value.([][]byte)} 10881 default: 10882 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", fp.selector)) 10883 } 10884 } 10885 10886 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 10887 return fp.WithIValue(value) 10888 } 10889 10890 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues { 10891 fpaov := &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: *fp} 10892 switch fp.selector { 10893 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 10894 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: *fp, values: values.([][]byte)} 10895 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 10896 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: *fp, values: values.([][][]byte)} 10897 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 10898 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: *fp, values: values.([][][]byte)} 10899 default: 10900 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", fp.selector)) 10901 } 10902 return fpaov 10903 } 10904 10905 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 10906 return fp.WithIArrayOfValues(values) 10907 } 10908 10909 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue { 10910 switch fp.selector { 10911 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 10912 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: *fp, value: value.([]byte)} 10913 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 10914 return &MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath: *fp, value: value.([]byte)} 10915 default: 10916 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", fp.selector)) 10917 } 10918 } 10919 10920 func (fp *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 10921 return fp.WithIArrayItemValue(value) 10922 } 10923 10924 // MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue allows storing values for PreAggregatedIndex fields according to their type 10925 type MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue interface { 10926 MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath 10927 gotenobject.FieldPathValue 10928 SetTo(target **MetricDescriptor_BinaryIndices_PreAggregatedIndex) 10929 CompareWith(*MetricDescriptor_BinaryIndices_PreAggregatedIndex) (cmp int, comparable bool) 10930 } 10931 10932 func ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue(pathStr, valueStr string) (MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue, error) { 10933 fp, err := ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(pathStr) 10934 if err != nil { 10935 return nil, err 10936 } 10937 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 10938 if err != nil { 10939 return nil, status.Errorf(codes.InvalidArgument, "error parsing PreAggregatedIndex field path value from %s: %v", valueStr, err) 10940 } 10941 return fpv.(MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue), nil 10942 } 10943 10944 func MustParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue(pathStr, valueStr string) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue { 10945 fpv, err := ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue(pathStr, valueStr) 10946 if err != nil { 10947 panic(err) 10948 } 10949 return fpv 10950 } 10951 10952 type MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue struct { 10953 MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath 10954 value interface{} 10955 } 10956 10957 var _ MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue = (*MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue)(nil) 10958 10959 // GetRawValue returns raw value stored under selected path for 'PreAggregatedIndex' as interface{} 10960 func (fpv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue) GetRawValue() interface{} { 10961 return fpv.value 10962 } 10963 func (fpv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue) AsKeyDataValue() ([]byte, bool) { 10964 res, ok := fpv.value.([]byte) 10965 return res, ok 10966 } 10967 func (fpv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue) AsWritingAlignersValue() ([][]byte, bool) { 10968 res, ok := fpv.value.([][]byte) 10969 return res, ok 10970 } 10971 func (fpv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue) AsClosedAlignersValue() ([][]byte, bool) { 10972 res, ok := fpv.value.([][]byte) 10973 return res, ok 10974 } 10975 10976 // SetTo stores value for selected field for object PreAggregatedIndex 10977 func (fpv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue) SetTo(target **MetricDescriptor_BinaryIndices_PreAggregatedIndex) { 10978 if *target == nil { 10979 *target = new(MetricDescriptor_BinaryIndices_PreAggregatedIndex) 10980 } 10981 switch fpv.selector { 10982 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 10983 (*target).KeyData = fpv.value.([]byte) 10984 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 10985 (*target).WritingAligners = fpv.value.([][]byte) 10986 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 10987 (*target).ClosedAligners = fpv.value.([][]byte) 10988 default: 10989 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", fpv.selector)) 10990 } 10991 } 10992 10993 func (fpv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue) SetToRaw(target proto.Message) { 10994 typedObject := target.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex) 10995 fpv.SetTo(&typedObject) 10996 } 10997 10998 // CompareWith compares value in the 'MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_BinaryIndices_PreAggregatedIndex'. 10999 func (fpv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_BinaryIndices_PreAggregatedIndex) (int, bool) { 11000 switch fpv.selector { 11001 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 11002 return 0, false 11003 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 11004 return 0, false 11005 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 11006 return 0, false 11007 default: 11008 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PreAggregatedIndex: %d", fpv.selector)) 11009 } 11010 } 11011 11012 func (fpv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 11013 return fpv.CompareWith(source.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex)) 11014 } 11015 11016 // MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue allows storing single item in Path-specific values for PreAggregatedIndex according to their type 11017 // Present only for array (repeated) types. 11018 type MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue interface { 11019 gotenobject.FieldPathArrayItemValue 11020 MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath 11021 ContainsValue(*MetricDescriptor_BinaryIndices_PreAggregatedIndex) bool 11022 } 11023 11024 // ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 11025 func ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue, error) { 11026 fp, err := ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(pathStr) 11027 if err != nil { 11028 return nil, err 11029 } 11030 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 11031 if err != nil { 11032 return nil, status.Errorf(codes.InvalidArgument, "error parsing PreAggregatedIndex field path array item value from %s: %v", valueStr, err) 11033 } 11034 return fpaiv.(MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue), nil 11035 } 11036 11037 func MustParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue { 11038 fpaiv, err := ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue(pathStr, valueStr) 11039 if err != nil { 11040 panic(err) 11041 } 11042 return fpaiv 11043 } 11044 11045 type MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue struct { 11046 MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath 11047 value interface{} 11048 } 11049 11050 var _ MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue = (*MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue)(nil) 11051 11052 // GetRawValue returns stored element value for array in object MetricDescriptor_BinaryIndices_PreAggregatedIndex as interface{} 11053 func (fpaiv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 11054 return fpaiv.value 11055 } 11056 func (fpaiv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue) AsWritingAlignersItemValue() ([]byte, bool) { 11057 res, ok := fpaiv.value.([]byte) 11058 return res, ok 11059 } 11060 func (fpaiv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue) AsClosedAlignersItemValue() ([]byte, bool) { 11061 res, ok := fpaiv.value.([]byte) 11062 return res, ok 11063 } 11064 11065 func (fpaiv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_BinaryIndices_PreAggregatedIndex) (interface{}, bool) { 11066 return nil, false 11067 } 11068 11069 func (fpaiv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 11070 return fpaiv.GetSingle(source.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex)) 11071 } 11072 11073 // Contains returns a boolean indicating if value that is being held is present in given 'PreAggregatedIndex' 11074 func (fpaiv *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_BinaryIndices_PreAggregatedIndex) bool { 11075 slice := fpaiv.MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath.Get(source) 11076 for _, v := range slice { 11077 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 11078 if proto.Equal(asProtoMsg, v.(proto.Message)) { 11079 return true 11080 } 11081 } else if reflect.DeepEqual(v, fpaiv.value) { 11082 return true 11083 } 11084 } 11085 return false 11086 } 11087 11088 // MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues allows storing slice of values for PreAggregatedIndex fields according to their type 11089 type MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues interface { 11090 gotenobject.FieldPathArrayOfValues 11091 MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath 11092 } 11093 11094 func ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues, error) { 11095 fp, err := ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(pathStr) 11096 if err != nil { 11097 return nil, err 11098 } 11099 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 11100 if err != nil { 11101 return nil, status.Errorf(codes.InvalidArgument, "error parsing PreAggregatedIndex field path array of values from %s: %v", valuesStr, err) 11102 } 11103 return fpaov.(MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues), nil 11104 } 11105 11106 func MustParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues { 11107 fpaov, err := ParseMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues(pathStr, valuesStr) 11108 if err != nil { 11109 panic(err) 11110 } 11111 return fpaov 11112 } 11113 11114 type MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues struct { 11115 MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPath 11116 values interface{} 11117 } 11118 11119 var _ MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues = (*MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues)(nil) 11120 11121 func (fpaov *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 11122 switch fpaov.selector { 11123 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorKeyData: 11124 for _, v := range fpaov.values.([][]byte) { 11125 values = append(values, v) 11126 } 11127 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorWritingAligners: 11128 for _, v := range fpaov.values.([][][]byte) { 11129 values = append(values, v) 11130 } 11131 case MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathSelectorClosedAligners: 11132 for _, v := range fpaov.values.([][][]byte) { 11133 values = append(values, v) 11134 } 11135 } 11136 return 11137 } 11138 func (fpaov *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues) AsKeyDataArrayOfValues() ([][]byte, bool) { 11139 res, ok := fpaov.values.([][]byte) 11140 return res, ok 11141 } 11142 func (fpaov *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues) AsWritingAlignersArrayOfValues() ([][][]byte, bool) { 11143 res, ok := fpaov.values.([][][]byte) 11144 return res, ok 11145 } 11146 func (fpaov *MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldTerminalPathArrayOfValues) AsClosedAlignersArrayOfValues() ([][][]byte, bool) { 11147 res, ok := fpaov.values.([][][]byte) 11148 return res, ok 11149 } 11150 11151 // FieldPath provides implementation to handle 11152 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 11153 type MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath interface { 11154 gotenobject.FieldPath 11155 Selector() MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelector 11156 Get(source *MetricDescriptor_BinaryIndices_PaginatingIndex) []interface{} 11157 GetSingle(source *MetricDescriptor_BinaryIndices_PaginatingIndex) (interface{}, bool) 11158 ClearValue(item *MetricDescriptor_BinaryIndices_PaginatingIndex) 11159 11160 // Those methods build corresponding MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue 11161 // (or array of values) and holds passed value. Panics if injected type is incorrect. 11162 WithIValue(value interface{}) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue 11163 WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues 11164 WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue 11165 } 11166 11167 type MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelector int32 11168 11169 const ( 11170 MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelector = 0 11171 MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelector = 1 11172 MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelector = 2 11173 ) 11174 11175 func (s MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelector) String() string { 11176 switch s { 11177 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11178 return "key_data" 11179 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11180 return "writing_functions" 11181 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11182 return "closed_functions" 11183 default: 11184 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", s)) 11185 } 11186 } 11187 11188 func BuildMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath, error) { 11189 if len(fp) == 0 { 11190 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_BinaryIndices_PaginatingIndex") 11191 } 11192 if len(fp) == 1 { 11193 switch fp[0] { 11194 case "key_data", "keyData", "key-data": 11195 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData}, nil 11196 case "writing_functions", "writingFunctions", "writing-functions": 11197 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions}, nil 11198 case "closed_functions", "closedFunctions", "closed-functions": 11199 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions}, nil 11200 } 11201 } 11202 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_BinaryIndices_PaginatingIndex", fp) 11203 } 11204 11205 func ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(rawField string) (MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath, error) { 11206 fp, err := gotenobject.ParseRawFieldPath(rawField) 11207 if err != nil { 11208 return nil, err 11209 } 11210 return BuildMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(fp) 11211 } 11212 11213 func MustParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(rawField string) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath { 11214 fp, err := ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(rawField) 11215 if err != nil { 11216 panic(err) 11217 } 11218 return fp 11219 } 11220 11221 type MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath struct { 11222 selector MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelector 11223 } 11224 11225 var _ MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath = (*MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath)(nil) 11226 11227 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) Selector() MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelector { 11228 return fp.selector 11229 } 11230 11231 // String returns path representation in proto convention 11232 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) String() string { 11233 return fp.selector.String() 11234 } 11235 11236 // JSONString returns path representation is JSON convention 11237 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) JSONString() string { 11238 return strcase.ToLowerCamel(fp.String()) 11239 } 11240 11241 // Get returns all values pointed by specific field from source MetricDescriptor_BinaryIndices_PaginatingIndex 11242 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) Get(source *MetricDescriptor_BinaryIndices_PaginatingIndex) (values []interface{}) { 11243 if source != nil { 11244 switch fp.selector { 11245 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11246 values = append(values, source.KeyData) 11247 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11248 for _, value := range source.GetWritingFunctions() { 11249 values = append(values, value) 11250 } 11251 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11252 for _, value := range source.GetClosedFunctions() { 11253 values = append(values, value) 11254 } 11255 default: 11256 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", fp.selector)) 11257 } 11258 } 11259 return 11260 } 11261 11262 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 11263 return fp.Get(source.(*MetricDescriptor_BinaryIndices_PaginatingIndex)) 11264 } 11265 11266 // GetSingle returns value pointed by specific field of from source MetricDescriptor_BinaryIndices_PaginatingIndex 11267 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) GetSingle(source *MetricDescriptor_BinaryIndices_PaginatingIndex) (interface{}, bool) { 11268 switch fp.selector { 11269 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11270 res := source.GetKeyData() 11271 return res, res != nil 11272 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11273 res := source.GetWritingFunctions() 11274 return res, res != nil 11275 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11276 res := source.GetClosedFunctions() 11277 return res, res != nil 11278 default: 11279 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", fp.selector)) 11280 } 11281 } 11282 11283 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 11284 return fp.GetSingle(source.(*MetricDescriptor_BinaryIndices_PaginatingIndex)) 11285 } 11286 11287 // GetDefault returns a default value of the field type 11288 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) GetDefault() interface{} { 11289 switch fp.selector { 11290 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11291 return ([]byte)(nil) 11292 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11293 return ([][]byte)(nil) 11294 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11295 return ([][]byte)(nil) 11296 default: 11297 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", fp.selector)) 11298 } 11299 } 11300 11301 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) ClearValue(item *MetricDescriptor_BinaryIndices_PaginatingIndex) { 11302 if item != nil { 11303 switch fp.selector { 11304 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11305 item.KeyData = nil 11306 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11307 item.WritingFunctions = nil 11308 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11309 item.ClosedFunctions = nil 11310 default: 11311 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", fp.selector)) 11312 } 11313 } 11314 } 11315 11316 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) ClearValueRaw(item proto.Message) { 11317 fp.ClearValue(item.(*MetricDescriptor_BinaryIndices_PaginatingIndex)) 11318 } 11319 11320 // IsLeaf - whether field path is holds simple value 11321 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) IsLeaf() bool { 11322 return fp.selector == MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData || 11323 fp.selector == MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions || 11324 fp.selector == MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions 11325 } 11326 11327 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 11328 return []gotenobject.FieldPath{fp} 11329 } 11330 11331 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue { 11332 switch fp.selector { 11333 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11334 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue{MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: *fp, value: value.([]byte)} 11335 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11336 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue{MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: *fp, value: value.([][]byte)} 11337 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11338 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue{MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: *fp, value: value.([][]byte)} 11339 default: 11340 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", fp.selector)) 11341 } 11342 } 11343 11344 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 11345 return fp.WithIValue(value) 11346 } 11347 11348 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues { 11349 fpaov := &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: *fp} 11350 switch fp.selector { 11351 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11352 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: *fp, values: values.([][]byte)} 11353 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11354 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: *fp, values: values.([][][]byte)} 11355 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11356 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: *fp, values: values.([][][]byte)} 11357 default: 11358 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", fp.selector)) 11359 } 11360 return fpaov 11361 } 11362 11363 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 11364 return fp.WithIArrayOfValues(values) 11365 } 11366 11367 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue { 11368 switch fp.selector { 11369 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11370 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: *fp, value: value.([]byte)} 11371 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11372 return &MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath: *fp, value: value.([]byte)} 11373 default: 11374 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", fp.selector)) 11375 } 11376 } 11377 11378 func (fp *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 11379 return fp.WithIArrayItemValue(value) 11380 } 11381 11382 // MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue allows storing values for PaginatingIndex fields according to their type 11383 type MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue interface { 11384 MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath 11385 gotenobject.FieldPathValue 11386 SetTo(target **MetricDescriptor_BinaryIndices_PaginatingIndex) 11387 CompareWith(*MetricDescriptor_BinaryIndices_PaginatingIndex) (cmp int, comparable bool) 11388 } 11389 11390 func ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue(pathStr, valueStr string) (MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue, error) { 11391 fp, err := ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(pathStr) 11392 if err != nil { 11393 return nil, err 11394 } 11395 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 11396 if err != nil { 11397 return nil, status.Errorf(codes.InvalidArgument, "error parsing PaginatingIndex field path value from %s: %v", valueStr, err) 11398 } 11399 return fpv.(MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue), nil 11400 } 11401 11402 func MustParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue(pathStr, valueStr string) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue { 11403 fpv, err := ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue(pathStr, valueStr) 11404 if err != nil { 11405 panic(err) 11406 } 11407 return fpv 11408 } 11409 11410 type MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue struct { 11411 MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath 11412 value interface{} 11413 } 11414 11415 var _ MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue = (*MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue)(nil) 11416 11417 // GetRawValue returns raw value stored under selected path for 'PaginatingIndex' as interface{} 11418 func (fpv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue) GetRawValue() interface{} { 11419 return fpv.value 11420 } 11421 func (fpv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue) AsKeyDataValue() ([]byte, bool) { 11422 res, ok := fpv.value.([]byte) 11423 return res, ok 11424 } 11425 func (fpv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue) AsWritingFunctionsValue() ([][]byte, bool) { 11426 res, ok := fpv.value.([][]byte) 11427 return res, ok 11428 } 11429 func (fpv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue) AsClosedFunctionsValue() ([][]byte, bool) { 11430 res, ok := fpv.value.([][]byte) 11431 return res, ok 11432 } 11433 11434 // SetTo stores value for selected field for object PaginatingIndex 11435 func (fpv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue) SetTo(target **MetricDescriptor_BinaryIndices_PaginatingIndex) { 11436 if *target == nil { 11437 *target = new(MetricDescriptor_BinaryIndices_PaginatingIndex) 11438 } 11439 switch fpv.selector { 11440 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11441 (*target).KeyData = fpv.value.([]byte) 11442 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11443 (*target).WritingFunctions = fpv.value.([][]byte) 11444 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11445 (*target).ClosedFunctions = fpv.value.([][]byte) 11446 default: 11447 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", fpv.selector)) 11448 } 11449 } 11450 11451 func (fpv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue) SetToRaw(target proto.Message) { 11452 typedObject := target.(*MetricDescriptor_BinaryIndices_PaginatingIndex) 11453 fpv.SetTo(&typedObject) 11454 } 11455 11456 // CompareWith compares value in the 'MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_BinaryIndices_PaginatingIndex'. 11457 func (fpv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_BinaryIndices_PaginatingIndex) (int, bool) { 11458 switch fpv.selector { 11459 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11460 return 0, false 11461 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11462 return 0, false 11463 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11464 return 0, false 11465 default: 11466 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_PaginatingIndex: %d", fpv.selector)) 11467 } 11468 } 11469 11470 func (fpv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 11471 return fpv.CompareWith(source.(*MetricDescriptor_BinaryIndices_PaginatingIndex)) 11472 } 11473 11474 // MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue allows storing single item in Path-specific values for PaginatingIndex according to their type 11475 // Present only for array (repeated) types. 11476 type MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue interface { 11477 gotenobject.FieldPathArrayItemValue 11478 MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath 11479 ContainsValue(*MetricDescriptor_BinaryIndices_PaginatingIndex) bool 11480 } 11481 11482 // ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 11483 func ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue, error) { 11484 fp, err := ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(pathStr) 11485 if err != nil { 11486 return nil, err 11487 } 11488 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 11489 if err != nil { 11490 return nil, status.Errorf(codes.InvalidArgument, "error parsing PaginatingIndex field path array item value from %s: %v", valueStr, err) 11491 } 11492 return fpaiv.(MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue), nil 11493 } 11494 11495 func MustParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue { 11496 fpaiv, err := ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue(pathStr, valueStr) 11497 if err != nil { 11498 panic(err) 11499 } 11500 return fpaiv 11501 } 11502 11503 type MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue struct { 11504 MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath 11505 value interface{} 11506 } 11507 11508 var _ MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue = (*MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue)(nil) 11509 11510 // GetRawValue returns stored element value for array in object MetricDescriptor_BinaryIndices_PaginatingIndex as interface{} 11511 func (fpaiv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 11512 return fpaiv.value 11513 } 11514 func (fpaiv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue) AsWritingFunctionsItemValue() ([]byte, bool) { 11515 res, ok := fpaiv.value.([]byte) 11516 return res, ok 11517 } 11518 func (fpaiv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue) AsClosedFunctionsItemValue() ([]byte, bool) { 11519 res, ok := fpaiv.value.([]byte) 11520 return res, ok 11521 } 11522 11523 func (fpaiv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_BinaryIndices_PaginatingIndex) (interface{}, bool) { 11524 return nil, false 11525 } 11526 11527 func (fpaiv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 11528 return fpaiv.GetSingle(source.(*MetricDescriptor_BinaryIndices_PaginatingIndex)) 11529 } 11530 11531 // Contains returns a boolean indicating if value that is being held is present in given 'PaginatingIndex' 11532 func (fpaiv *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_BinaryIndices_PaginatingIndex) bool { 11533 slice := fpaiv.MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath.Get(source) 11534 for _, v := range slice { 11535 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 11536 if proto.Equal(asProtoMsg, v.(proto.Message)) { 11537 return true 11538 } 11539 } else if reflect.DeepEqual(v, fpaiv.value) { 11540 return true 11541 } 11542 } 11543 return false 11544 } 11545 11546 // MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues allows storing slice of values for PaginatingIndex fields according to their type 11547 type MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues interface { 11548 gotenobject.FieldPathArrayOfValues 11549 MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath 11550 } 11551 11552 func ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues, error) { 11553 fp, err := ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(pathStr) 11554 if err != nil { 11555 return nil, err 11556 } 11557 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 11558 if err != nil { 11559 return nil, status.Errorf(codes.InvalidArgument, "error parsing PaginatingIndex field path array of values from %s: %v", valuesStr, err) 11560 } 11561 return fpaov.(MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues), nil 11562 } 11563 11564 func MustParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues { 11565 fpaov, err := ParseMetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues(pathStr, valuesStr) 11566 if err != nil { 11567 panic(err) 11568 } 11569 return fpaov 11570 } 11571 11572 type MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues struct { 11573 MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPath 11574 values interface{} 11575 } 11576 11577 var _ MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues = (*MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues)(nil) 11578 11579 func (fpaov *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 11580 switch fpaov.selector { 11581 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorKeyData: 11582 for _, v := range fpaov.values.([][]byte) { 11583 values = append(values, v) 11584 } 11585 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorWritingFunctions: 11586 for _, v := range fpaov.values.([][][]byte) { 11587 values = append(values, v) 11588 } 11589 case MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathSelectorClosedFunctions: 11590 for _, v := range fpaov.values.([][][]byte) { 11591 values = append(values, v) 11592 } 11593 } 11594 return 11595 } 11596 func (fpaov *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues) AsKeyDataArrayOfValues() ([][]byte, bool) { 11597 res, ok := fpaov.values.([][]byte) 11598 return res, ok 11599 } 11600 func (fpaov *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues) AsWritingFunctionsArrayOfValues() ([][][]byte, bool) { 11601 res, ok := fpaov.values.([][][]byte) 11602 return res, ok 11603 } 11604 func (fpaov *MetricDescriptorBinaryIndicesPaginatingIndex_FieldTerminalPathArrayOfValues) AsClosedFunctionsArrayOfValues() ([][][]byte, bool) { 11605 res, ok := fpaov.values.([][][]byte) 11606 return res, ok 11607 } 11608 11609 // FieldPath provides implementation to handle 11610 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 11611 type MetricDescriptorBinaryIndicesByResourceType_FieldPath interface { 11612 gotenobject.FieldPath 11613 Selector() MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector 11614 Get(source *MetricDescriptor_BinaryIndices_ByResourceType) []interface{} 11615 GetSingle(source *MetricDescriptor_BinaryIndices_ByResourceType) (interface{}, bool) 11616 ClearValue(item *MetricDescriptor_BinaryIndices_ByResourceType) 11617 11618 // Those methods build corresponding MetricDescriptorBinaryIndicesByResourceType_FieldPathValue 11619 // (or array of values) and holds passed value. Panics if injected type is incorrect. 11620 WithIValue(value interface{}) MetricDescriptorBinaryIndicesByResourceType_FieldPathValue 11621 WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues 11622 WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue 11623 } 11624 11625 type MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector int32 11626 11627 const ( 11628 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector = 0 11629 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector = 1 11630 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector = 2 11631 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector = 3 11632 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector = 4 11633 MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector = 5 11634 ) 11635 11636 func (s MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector) String() string { 11637 switch s { 11638 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 11639 return "resource_type" 11640 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 11641 return "aggs_encoder" 11642 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11643 return "pre_aggregated_indices" 11644 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11645 return "paginating_indices" 11646 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 11647 return "non_aggregated_indices" 11648 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 11649 return "name_parts" 11650 default: 11651 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", s)) 11652 } 11653 } 11654 11655 func BuildMetricDescriptorBinaryIndicesByResourceType_FieldPath(fp gotenobject.RawFieldPath) (MetricDescriptorBinaryIndicesByResourceType_FieldPath, error) { 11656 if len(fp) == 0 { 11657 return nil, status.Error(codes.InvalidArgument, "empty field path for object MetricDescriptor_BinaryIndices_ByResourceType") 11658 } 11659 if len(fp) == 1 { 11660 switch fp[0] { 11661 case "resource_type", "resourceType", "resource-type": 11662 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType}, nil 11663 case "aggs_encoder", "aggsEncoder", "aggs-encoder": 11664 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder}, nil 11665 case "pre_aggregated_indices", "preAggregatedIndices", "pre-aggregated-indices": 11666 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices}, nil 11667 case "paginating_indices", "paginatingIndices", "paginating-indices": 11668 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices}, nil 11669 case "non_aggregated_indices", "nonAggregatedIndices", "non-aggregated-indices": 11670 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices}, nil 11671 case "name_parts", "nameParts", "name-parts": 11672 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts}, nil 11673 } 11674 } else { 11675 switch fp[0] { 11676 case "pre_aggregated_indices", "preAggregatedIndices", "pre-aggregated-indices": 11677 if subpath, err := BuildMetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath(fp[1:]); err != nil { 11678 return nil, err 11679 } else { 11680 return &MetricDescriptorBinaryIndicesByResourceType_FieldSubPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices, subPath: subpath}, nil 11681 } 11682 case "paginating_indices", "paginatingIndices", "paginating-indices": 11683 if subpath, err := BuildMetricDescriptorBinaryIndicesPaginatingIndex_FieldPath(fp[1:]); err != nil { 11684 return nil, err 11685 } else { 11686 return &MetricDescriptorBinaryIndicesByResourceType_FieldSubPath{selector: MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices, subPath: subpath}, nil 11687 } 11688 } 11689 } 11690 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object MetricDescriptor_BinaryIndices_ByResourceType", fp) 11691 } 11692 11693 func ParseMetricDescriptorBinaryIndicesByResourceType_FieldPath(rawField string) (MetricDescriptorBinaryIndicesByResourceType_FieldPath, error) { 11694 fp, err := gotenobject.ParseRawFieldPath(rawField) 11695 if err != nil { 11696 return nil, err 11697 } 11698 return BuildMetricDescriptorBinaryIndicesByResourceType_FieldPath(fp) 11699 } 11700 11701 func MustParseMetricDescriptorBinaryIndicesByResourceType_FieldPath(rawField string) MetricDescriptorBinaryIndicesByResourceType_FieldPath { 11702 fp, err := ParseMetricDescriptorBinaryIndicesByResourceType_FieldPath(rawField) 11703 if err != nil { 11704 panic(err) 11705 } 11706 return fp 11707 } 11708 11709 type MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath struct { 11710 selector MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector 11711 } 11712 11713 var _ MetricDescriptorBinaryIndicesByResourceType_FieldPath = (*MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath)(nil) 11714 11715 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) Selector() MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector { 11716 return fp.selector 11717 } 11718 11719 // String returns path representation in proto convention 11720 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) String() string { 11721 return fp.selector.String() 11722 } 11723 11724 // JSONString returns path representation is JSON convention 11725 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) JSONString() string { 11726 return strcase.ToLowerCamel(fp.String()) 11727 } 11728 11729 // Get returns all values pointed by specific field from source MetricDescriptor_BinaryIndices_ByResourceType 11730 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) Get(source *MetricDescriptor_BinaryIndices_ByResourceType) (values []interface{}) { 11731 if source != nil { 11732 switch fp.selector { 11733 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 11734 values = append(values, source.ResourceType) 11735 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 11736 for _, value := range source.GetAggsEncoder() { 11737 values = append(values, value) 11738 } 11739 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11740 for _, value := range source.GetPreAggregatedIndices() { 11741 values = append(values, value) 11742 } 11743 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11744 for _, value := range source.GetPaginatingIndices() { 11745 values = append(values, value) 11746 } 11747 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 11748 for _, value := range source.GetNonAggregatedIndices() { 11749 values = append(values, value) 11750 } 11751 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 11752 for _, value := range source.GetNameParts() { 11753 values = append(values, value) 11754 } 11755 default: 11756 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fp.selector)) 11757 } 11758 } 11759 return 11760 } 11761 11762 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 11763 return fp.Get(source.(*MetricDescriptor_BinaryIndices_ByResourceType)) 11764 } 11765 11766 // GetSingle returns value pointed by specific field of from source MetricDescriptor_BinaryIndices_ByResourceType 11767 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) GetSingle(source *MetricDescriptor_BinaryIndices_ByResourceType) (interface{}, bool) { 11768 switch fp.selector { 11769 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 11770 return source.GetResourceType(), source != nil 11771 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 11772 res := source.GetAggsEncoder() 11773 return res, res != nil 11774 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11775 res := source.GetPreAggregatedIndices() 11776 return res, res != nil 11777 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11778 res := source.GetPaginatingIndices() 11779 return res, res != nil 11780 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 11781 res := source.GetNonAggregatedIndices() 11782 return res, res != nil 11783 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 11784 res := source.GetNameParts() 11785 return res, res != nil 11786 default: 11787 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fp.selector)) 11788 } 11789 } 11790 11791 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 11792 return fp.GetSingle(source.(*MetricDescriptor_BinaryIndices_ByResourceType)) 11793 } 11794 11795 // GetDefault returns a default value of the field type 11796 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) GetDefault() interface{} { 11797 switch fp.selector { 11798 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 11799 return "" 11800 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 11801 return ([][]byte)(nil) 11802 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11803 return ([]*MetricDescriptor_BinaryIndices_PreAggregatedIndex)(nil) 11804 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11805 return ([]*MetricDescriptor_BinaryIndices_PaginatingIndex)(nil) 11806 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 11807 return ([][]byte)(nil) 11808 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 11809 return ([]string)(nil) 11810 default: 11811 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fp.selector)) 11812 } 11813 } 11814 11815 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) ClearValue(item *MetricDescriptor_BinaryIndices_ByResourceType) { 11816 if item != nil { 11817 switch fp.selector { 11818 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 11819 item.ResourceType = "" 11820 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 11821 item.AggsEncoder = nil 11822 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11823 item.PreAggregatedIndices = nil 11824 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11825 item.PaginatingIndices = nil 11826 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 11827 item.NonAggregatedIndices = nil 11828 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 11829 item.NameParts = nil 11830 default: 11831 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fp.selector)) 11832 } 11833 } 11834 } 11835 11836 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) ClearValueRaw(item proto.Message) { 11837 fp.ClearValue(item.(*MetricDescriptor_BinaryIndices_ByResourceType)) 11838 } 11839 11840 // IsLeaf - whether field path is holds simple value 11841 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) IsLeaf() bool { 11842 return fp.selector == MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType || 11843 fp.selector == MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder || 11844 fp.selector == MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices || 11845 fp.selector == MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts 11846 } 11847 11848 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 11849 return []gotenobject.FieldPath{fp} 11850 } 11851 11852 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) WithIValue(value interface{}) MetricDescriptorBinaryIndicesByResourceType_FieldPathValue { 11853 switch fp.selector { 11854 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 11855 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.(string)} 11856 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 11857 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.([][]byte)} 11858 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11859 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_BinaryIndices_PreAggregatedIndex)} 11860 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11861 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.([]*MetricDescriptor_BinaryIndices_PaginatingIndex)} 11862 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 11863 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.([][]byte)} 11864 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 11865 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.([]string)} 11866 default: 11867 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fp.selector)) 11868 } 11869 } 11870 11871 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 11872 return fp.WithIValue(value) 11873 } 11874 11875 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues { 11876 fpaov := &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp} 11877 switch fp.selector { 11878 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 11879 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, values: values.([]string)} 11880 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 11881 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, values: values.([][][]byte)} 11882 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11883 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_BinaryIndices_PreAggregatedIndex)} 11884 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11885 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, values: values.([][]*MetricDescriptor_BinaryIndices_PaginatingIndex)} 11886 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 11887 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, values: values.([][][]byte)} 11888 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 11889 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, values: values.([][]string)} 11890 default: 11891 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fp.selector)) 11892 } 11893 return fpaov 11894 } 11895 11896 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 11897 return fp.WithIArrayOfValues(values) 11898 } 11899 11900 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue { 11901 switch fp.selector { 11902 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 11903 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.([]byte)} 11904 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11905 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex)} 11906 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11907 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.(*MetricDescriptor_BinaryIndices_PaginatingIndex)} 11908 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 11909 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.([]byte)} 11910 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 11911 return &MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue{MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath: *fp, value: value.(string)} 11912 default: 11913 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fp.selector)) 11914 } 11915 } 11916 11917 func (fp *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 11918 return fp.WithIArrayItemValue(value) 11919 } 11920 11921 type MetricDescriptorBinaryIndicesByResourceType_FieldSubPath struct { 11922 selector MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector 11923 subPath gotenobject.FieldPath 11924 } 11925 11926 var _ MetricDescriptorBinaryIndicesByResourceType_FieldPath = (*MetricDescriptorBinaryIndicesByResourceType_FieldSubPath)(nil) 11927 11928 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) Selector() MetricDescriptorBinaryIndicesByResourceType_FieldPathSelector { 11929 return fps.selector 11930 } 11931 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) AsPreAggregatedIndicesSubPath() (MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath, bool) { 11932 res, ok := fps.subPath.(MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPath) 11933 return res, ok 11934 } 11935 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) AsPaginatingIndicesSubPath() (MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath, bool) { 11936 res, ok := fps.subPath.(MetricDescriptorBinaryIndicesPaginatingIndex_FieldPath) 11937 return res, ok 11938 } 11939 11940 // String returns path representation in proto convention 11941 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) String() string { 11942 return fps.selector.String() + "." + fps.subPath.String() 11943 } 11944 11945 // JSONString returns path representation is JSON convention 11946 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) JSONString() string { 11947 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 11948 } 11949 11950 // Get returns all values pointed by selected field from source MetricDescriptor_BinaryIndices_ByResourceType 11951 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) Get(source *MetricDescriptor_BinaryIndices_ByResourceType) (values []interface{}) { 11952 switch fps.selector { 11953 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11954 for _, item := range source.GetPreAggregatedIndices() { 11955 values = append(values, fps.subPath.GetRaw(item)...) 11956 } 11957 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11958 for _, item := range source.GetPaginatingIndices() { 11959 values = append(values, fps.subPath.GetRaw(item)...) 11960 } 11961 default: 11962 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fps.selector)) 11963 } 11964 return 11965 } 11966 11967 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) GetRaw(source proto.Message) []interface{} { 11968 return fps.Get(source.(*MetricDescriptor_BinaryIndices_ByResourceType)) 11969 } 11970 11971 // GetSingle returns value of selected field from source MetricDescriptor_BinaryIndices_ByResourceType 11972 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) GetSingle(source *MetricDescriptor_BinaryIndices_ByResourceType) (interface{}, bool) { 11973 switch fps.selector { 11974 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 11975 if len(source.GetPreAggregatedIndices()) == 0 { 11976 return nil, false 11977 } 11978 return fps.subPath.GetSingleRaw(source.GetPreAggregatedIndices()[0]) 11979 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 11980 if len(source.GetPaginatingIndices()) == 0 { 11981 return nil, false 11982 } 11983 return fps.subPath.GetSingleRaw(source.GetPaginatingIndices()[0]) 11984 default: 11985 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fps.selector)) 11986 } 11987 } 11988 11989 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 11990 return fps.GetSingle(source.(*MetricDescriptor_BinaryIndices_ByResourceType)) 11991 } 11992 11993 // GetDefault returns a default value of the field type 11994 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) GetDefault() interface{} { 11995 return fps.subPath.GetDefault() 11996 } 11997 11998 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) ClearValue(item *MetricDescriptor_BinaryIndices_ByResourceType) { 11999 if item != nil { 12000 switch fps.selector { 12001 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 12002 for _, subItem := range item.PreAggregatedIndices { 12003 fps.subPath.ClearValueRaw(subItem) 12004 } 12005 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 12006 for _, subItem := range item.PaginatingIndices { 12007 fps.subPath.ClearValueRaw(subItem) 12008 } 12009 default: 12010 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fps.selector)) 12011 } 12012 } 12013 } 12014 12015 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) ClearValueRaw(item proto.Message) { 12016 fps.ClearValue(item.(*MetricDescriptor_BinaryIndices_ByResourceType)) 12017 } 12018 12019 // IsLeaf - whether field path is holds simple value 12020 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) IsLeaf() bool { 12021 return fps.subPath.IsLeaf() 12022 } 12023 12024 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 12025 iPaths := []gotenobject.FieldPath{&MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath{selector: fps.selector}} 12026 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 12027 return iPaths 12028 } 12029 12030 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) WithIValue(value interface{}) MetricDescriptorBinaryIndicesByResourceType_FieldPathValue { 12031 return &MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 12032 } 12033 12034 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 12035 return fps.WithIValue(value) 12036 } 12037 12038 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) WithIArrayOfValues(values interface{}) MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues { 12039 return &MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 12040 } 12041 12042 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 12043 return fps.WithIArrayOfValues(values) 12044 } 12045 12046 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) WithIArrayItemValue(value interface{}) MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue { 12047 return &MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 12048 } 12049 12050 func (fps *MetricDescriptorBinaryIndicesByResourceType_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 12051 return fps.WithIArrayItemValue(value) 12052 } 12053 12054 // MetricDescriptorBinaryIndicesByResourceType_FieldPathValue allows storing values for ByResourceType fields according to their type 12055 type MetricDescriptorBinaryIndicesByResourceType_FieldPathValue interface { 12056 MetricDescriptorBinaryIndicesByResourceType_FieldPath 12057 gotenobject.FieldPathValue 12058 SetTo(target **MetricDescriptor_BinaryIndices_ByResourceType) 12059 CompareWith(*MetricDescriptor_BinaryIndices_ByResourceType) (cmp int, comparable bool) 12060 } 12061 12062 func ParseMetricDescriptorBinaryIndicesByResourceType_FieldPathValue(pathStr, valueStr string) (MetricDescriptorBinaryIndicesByResourceType_FieldPathValue, error) { 12063 fp, err := ParseMetricDescriptorBinaryIndicesByResourceType_FieldPath(pathStr) 12064 if err != nil { 12065 return nil, err 12066 } 12067 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 12068 if err != nil { 12069 return nil, status.Errorf(codes.InvalidArgument, "error parsing ByResourceType field path value from %s: %v", valueStr, err) 12070 } 12071 return fpv.(MetricDescriptorBinaryIndicesByResourceType_FieldPathValue), nil 12072 } 12073 12074 func MustParseMetricDescriptorBinaryIndicesByResourceType_FieldPathValue(pathStr, valueStr string) MetricDescriptorBinaryIndicesByResourceType_FieldPathValue { 12075 fpv, err := ParseMetricDescriptorBinaryIndicesByResourceType_FieldPathValue(pathStr, valueStr) 12076 if err != nil { 12077 panic(err) 12078 } 12079 return fpv 12080 } 12081 12082 type MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue struct { 12083 MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath 12084 value interface{} 12085 } 12086 12087 var _ MetricDescriptorBinaryIndicesByResourceType_FieldPathValue = (*MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue)(nil) 12088 12089 // GetRawValue returns raw value stored under selected path for 'ByResourceType' as interface{} 12090 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) GetRawValue() interface{} { 12091 return fpv.value 12092 } 12093 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) AsResourceTypeValue() (string, bool) { 12094 res, ok := fpv.value.(string) 12095 return res, ok 12096 } 12097 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) AsAggsEncoderValue() ([][]byte, bool) { 12098 res, ok := fpv.value.([][]byte) 12099 return res, ok 12100 } 12101 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) AsPreAggregatedIndicesValue() ([]*MetricDescriptor_BinaryIndices_PreAggregatedIndex, bool) { 12102 res, ok := fpv.value.([]*MetricDescriptor_BinaryIndices_PreAggregatedIndex) 12103 return res, ok 12104 } 12105 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) AsPaginatingIndicesValue() ([]*MetricDescriptor_BinaryIndices_PaginatingIndex, bool) { 12106 res, ok := fpv.value.([]*MetricDescriptor_BinaryIndices_PaginatingIndex) 12107 return res, ok 12108 } 12109 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) AsNonAggregatedIndicesValue() ([][]byte, bool) { 12110 res, ok := fpv.value.([][]byte) 12111 return res, ok 12112 } 12113 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) AsNamePartsValue() ([]string, bool) { 12114 res, ok := fpv.value.([]string) 12115 return res, ok 12116 } 12117 12118 // SetTo stores value for selected field for object ByResourceType 12119 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) SetTo(target **MetricDescriptor_BinaryIndices_ByResourceType) { 12120 if *target == nil { 12121 *target = new(MetricDescriptor_BinaryIndices_ByResourceType) 12122 } 12123 switch fpv.selector { 12124 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 12125 (*target).ResourceType = fpv.value.(string) 12126 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 12127 (*target).AggsEncoder = fpv.value.([][]byte) 12128 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 12129 (*target).PreAggregatedIndices = fpv.value.([]*MetricDescriptor_BinaryIndices_PreAggregatedIndex) 12130 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 12131 (*target).PaginatingIndices = fpv.value.([]*MetricDescriptor_BinaryIndices_PaginatingIndex) 12132 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 12133 (*target).NonAggregatedIndices = fpv.value.([][]byte) 12134 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 12135 (*target).NameParts = fpv.value.([]string) 12136 default: 12137 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fpv.selector)) 12138 } 12139 } 12140 12141 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) SetToRaw(target proto.Message) { 12142 typedObject := target.(*MetricDescriptor_BinaryIndices_ByResourceType) 12143 fpv.SetTo(&typedObject) 12144 } 12145 12146 // CompareWith compares value in the 'MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue' with the value under path in 'MetricDescriptor_BinaryIndices_ByResourceType'. 12147 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) CompareWith(source *MetricDescriptor_BinaryIndices_ByResourceType) (int, bool) { 12148 switch fpv.selector { 12149 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 12150 leftValue := fpv.value.(string) 12151 rightValue := source.GetResourceType() 12152 if (leftValue) == (rightValue) { 12153 return 0, true 12154 } else if (leftValue) < (rightValue) { 12155 return -1, true 12156 } else { 12157 return 1, true 12158 } 12159 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 12160 return 0, false 12161 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 12162 return 0, false 12163 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 12164 return 0, false 12165 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 12166 return 0, false 12167 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 12168 return 0, false 12169 default: 12170 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fpv.selector)) 12171 } 12172 } 12173 12174 func (fpv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 12175 return fpv.CompareWith(source.(*MetricDescriptor_BinaryIndices_ByResourceType)) 12176 } 12177 12178 type MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue struct { 12179 MetricDescriptorBinaryIndicesByResourceType_FieldPath 12180 subPathValue gotenobject.FieldPathValue 12181 } 12182 12183 var _ MetricDescriptorBinaryIndicesByResourceType_FieldPathValue = (*MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue)(nil) 12184 12185 func (fpvs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue) AsPreAggregatedIndicesPathValue() (MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue, bool) { 12186 res, ok := fpvs.subPathValue.(MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathValue) 12187 return res, ok 12188 } 12189 func (fpvs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue) AsPaginatingIndicesPathValue() (MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue, bool) { 12190 res, ok := fpvs.subPathValue.(MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathValue) 12191 return res, ok 12192 } 12193 12194 func (fpvs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue) SetTo(target **MetricDescriptor_BinaryIndices_ByResourceType) { 12195 if *target == nil { 12196 *target = new(MetricDescriptor_BinaryIndices_ByResourceType) 12197 } 12198 switch fpvs.Selector() { 12199 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 12200 panic("FieldPath setter is unsupported for array subpaths") 12201 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 12202 panic("FieldPath setter is unsupported for array subpaths") 12203 default: 12204 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fpvs.Selector())) 12205 } 12206 } 12207 12208 func (fpvs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue) SetToRaw(target proto.Message) { 12209 typedObject := target.(*MetricDescriptor_BinaryIndices_ByResourceType) 12210 fpvs.SetTo(&typedObject) 12211 } 12212 12213 func (fpvs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue) GetRawValue() interface{} { 12214 return fpvs.subPathValue.GetRawValue() 12215 } 12216 12217 func (fpvs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue) CompareWith(source *MetricDescriptor_BinaryIndices_ByResourceType) (int, bool) { 12218 switch fpvs.Selector() { 12219 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 12220 return 0, false // repeated field 12221 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 12222 return 0, false // repeated field 12223 default: 12224 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fpvs.Selector())) 12225 } 12226 } 12227 12228 func (fpvs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 12229 return fpvs.CompareWith(source.(*MetricDescriptor_BinaryIndices_ByResourceType)) 12230 } 12231 12232 // MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue allows storing single item in Path-specific values for ByResourceType according to their type 12233 // Present only for array (repeated) types. 12234 type MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue interface { 12235 gotenobject.FieldPathArrayItemValue 12236 MetricDescriptorBinaryIndicesByResourceType_FieldPath 12237 ContainsValue(*MetricDescriptor_BinaryIndices_ByResourceType) bool 12238 } 12239 12240 // ParseMetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 12241 func ParseMetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue(pathStr, valueStr string) (MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue, error) { 12242 fp, err := ParseMetricDescriptorBinaryIndicesByResourceType_FieldPath(pathStr) 12243 if err != nil { 12244 return nil, err 12245 } 12246 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 12247 if err != nil { 12248 return nil, status.Errorf(codes.InvalidArgument, "error parsing ByResourceType field path array item value from %s: %v", valueStr, err) 12249 } 12250 return fpaiv.(MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue), nil 12251 } 12252 12253 func MustParseMetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue(pathStr, valueStr string) MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue { 12254 fpaiv, err := ParseMetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue(pathStr, valueStr) 12255 if err != nil { 12256 panic(err) 12257 } 12258 return fpaiv 12259 } 12260 12261 type MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue struct { 12262 MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath 12263 value interface{} 12264 } 12265 12266 var _ MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayItemValue = (*MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue)(nil) 12267 12268 // GetRawValue returns stored element value for array in object MetricDescriptor_BinaryIndices_ByResourceType as interface{} 12269 func (fpaiv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 12270 return fpaiv.value 12271 } 12272 func (fpaiv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue) AsAggsEncoderItemValue() ([]byte, bool) { 12273 res, ok := fpaiv.value.([]byte) 12274 return res, ok 12275 } 12276 func (fpaiv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue) AsPreAggregatedIndicesItemValue() (*MetricDescriptor_BinaryIndices_PreAggregatedIndex, bool) { 12277 res, ok := fpaiv.value.(*MetricDescriptor_BinaryIndices_PreAggregatedIndex) 12278 return res, ok 12279 } 12280 func (fpaiv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue) AsPaginatingIndicesItemValue() (*MetricDescriptor_BinaryIndices_PaginatingIndex, bool) { 12281 res, ok := fpaiv.value.(*MetricDescriptor_BinaryIndices_PaginatingIndex) 12282 return res, ok 12283 } 12284 func (fpaiv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue) AsNonAggregatedIndicesItemValue() ([]byte, bool) { 12285 res, ok := fpaiv.value.([]byte) 12286 return res, ok 12287 } 12288 func (fpaiv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue) AsNamePartsItemValue() (string, bool) { 12289 res, ok := fpaiv.value.(string) 12290 return res, ok 12291 } 12292 12293 func (fpaiv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue) GetSingle(source *MetricDescriptor_BinaryIndices_ByResourceType) (interface{}, bool) { 12294 return nil, false 12295 } 12296 12297 func (fpaiv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 12298 return fpaiv.GetSingle(source.(*MetricDescriptor_BinaryIndices_ByResourceType)) 12299 } 12300 12301 // Contains returns a boolean indicating if value that is being held is present in given 'ByResourceType' 12302 func (fpaiv *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayItemValue) ContainsValue(source *MetricDescriptor_BinaryIndices_ByResourceType) bool { 12303 slice := fpaiv.MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath.Get(source) 12304 for _, v := range slice { 12305 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 12306 if proto.Equal(asProtoMsg, v.(proto.Message)) { 12307 return true 12308 } 12309 } else if reflect.DeepEqual(v, fpaiv.value) { 12310 return true 12311 } 12312 } 12313 return false 12314 } 12315 12316 type MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayItemValue struct { 12317 MetricDescriptorBinaryIndicesByResourceType_FieldPath 12318 subPathItemValue gotenobject.FieldPathArrayItemValue 12319 } 12320 12321 // GetRawValue returns stored array item value 12322 func (fpaivs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 12323 return fpaivs.subPathItemValue.GetRawItemValue() 12324 } 12325 func (fpaivs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayItemValue) AsPreAggregatedIndicesPathItemValue() (MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue, bool) { 12326 res, ok := fpaivs.subPathItemValue.(MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayItemValue) 12327 return res, ok 12328 } 12329 func (fpaivs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayItemValue) AsPaginatingIndicesPathItemValue() (MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue, bool) { 12330 res, ok := fpaivs.subPathItemValue.(MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayItemValue) 12331 return res, ok 12332 } 12333 12334 // Contains returns a boolean indicating if value that is being held is present in given 'ByResourceType' 12335 func (fpaivs *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayItemValue) ContainsValue(source *MetricDescriptor_BinaryIndices_ByResourceType) bool { 12336 switch fpaivs.Selector() { 12337 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 12338 return false // repeated/map field 12339 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 12340 return false // repeated/map field 12341 default: 12342 panic(fmt.Sprintf("Invalid selector for MetricDescriptor_BinaryIndices_ByResourceType: %d", fpaivs.Selector())) 12343 } 12344 } 12345 12346 // MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues allows storing slice of values for ByResourceType fields according to their type 12347 type MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues interface { 12348 gotenobject.FieldPathArrayOfValues 12349 MetricDescriptorBinaryIndicesByResourceType_FieldPath 12350 } 12351 12352 func ParseMetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues(pathStr, valuesStr string) (MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues, error) { 12353 fp, err := ParseMetricDescriptorBinaryIndicesByResourceType_FieldPath(pathStr) 12354 if err != nil { 12355 return nil, err 12356 } 12357 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 12358 if err != nil { 12359 return nil, status.Errorf(codes.InvalidArgument, "error parsing ByResourceType field path array of values from %s: %v", valuesStr, err) 12360 } 12361 return fpaov.(MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues), nil 12362 } 12363 12364 func MustParseMetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues(pathStr, valuesStr string) MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues { 12365 fpaov, err := ParseMetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues(pathStr, valuesStr) 12366 if err != nil { 12367 panic(err) 12368 } 12369 return fpaov 12370 } 12371 12372 type MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues struct { 12373 MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPath 12374 values interface{} 12375 } 12376 12377 var _ MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues = (*MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues)(nil) 12378 12379 func (fpaov *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 12380 switch fpaov.selector { 12381 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorResourceType: 12382 for _, v := range fpaov.values.([]string) { 12383 values = append(values, v) 12384 } 12385 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorAggsEncoder: 12386 for _, v := range fpaov.values.([][][]byte) { 12387 values = append(values, v) 12388 } 12389 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPreAggregatedIndices: 12390 for _, v := range fpaov.values.([][]*MetricDescriptor_BinaryIndices_PreAggregatedIndex) { 12391 values = append(values, v) 12392 } 12393 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorPaginatingIndices: 12394 for _, v := range fpaov.values.([][]*MetricDescriptor_BinaryIndices_PaginatingIndex) { 12395 values = append(values, v) 12396 } 12397 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNonAggregatedIndices: 12398 for _, v := range fpaov.values.([][][]byte) { 12399 values = append(values, v) 12400 } 12401 case MetricDescriptorBinaryIndicesByResourceType_FieldPathSelectorNameParts: 12402 for _, v := range fpaov.values.([][]string) { 12403 values = append(values, v) 12404 } 12405 } 12406 return 12407 } 12408 func (fpaov *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues) AsResourceTypeArrayOfValues() ([]string, bool) { 12409 res, ok := fpaov.values.([]string) 12410 return res, ok 12411 } 12412 func (fpaov *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues) AsAggsEncoderArrayOfValues() ([][][]byte, bool) { 12413 res, ok := fpaov.values.([][][]byte) 12414 return res, ok 12415 } 12416 func (fpaov *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues) AsPreAggregatedIndicesArrayOfValues() ([][]*MetricDescriptor_BinaryIndices_PreAggregatedIndex, bool) { 12417 res, ok := fpaov.values.([][]*MetricDescriptor_BinaryIndices_PreAggregatedIndex) 12418 return res, ok 12419 } 12420 func (fpaov *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues) AsPaginatingIndicesArrayOfValues() ([][]*MetricDescriptor_BinaryIndices_PaginatingIndex, bool) { 12421 res, ok := fpaov.values.([][]*MetricDescriptor_BinaryIndices_PaginatingIndex) 12422 return res, ok 12423 } 12424 func (fpaov *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues) AsNonAggregatedIndicesArrayOfValues() ([][][]byte, bool) { 12425 res, ok := fpaov.values.([][][]byte) 12426 return res, ok 12427 } 12428 func (fpaov *MetricDescriptorBinaryIndicesByResourceType_FieldTerminalPathArrayOfValues) AsNamePartsArrayOfValues() ([][]string, bool) { 12429 res, ok := fpaov.values.([][]string) 12430 return res, ok 12431 } 12432 12433 type MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayOfValues struct { 12434 MetricDescriptorBinaryIndicesByResourceType_FieldPath 12435 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 12436 } 12437 12438 var _ MetricDescriptorBinaryIndicesByResourceType_FieldPathArrayOfValues = (*MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayOfValues)(nil) 12439 12440 func (fpsaov *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 12441 return fpsaov.subPathArrayOfValues.GetRawValues() 12442 } 12443 func (fpsaov *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayOfValues) AsPreAggregatedIndicesPathArrayOfValues() (MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues, bool) { 12444 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorBinaryIndicesPreAggregatedIndex_FieldPathArrayOfValues) 12445 return res, ok 12446 } 12447 func (fpsaov *MetricDescriptorBinaryIndicesByResourceType_FieldSubPathArrayOfValues) AsPaginatingIndicesPathArrayOfValues() (MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues, bool) { 12448 res, ok := fpsaov.subPathArrayOfValues.(MetricDescriptorBinaryIndicesPaginatingIndex_FieldPathArrayOfValues) 12449 return res, ok 12450 }