8
8
// For information on using the generated types, please see the documentation:
9
9
// https://github.com/apple/swift-protobuf/
10
10
11
- // Copyright 2024 Google LLC
11
+ // Copyright 2025 Google LLC
12
12
//
13
13
// Licensed under the Apache License, Version 2.0 (the "License");
14
14
// you may not use this file except in compliance with the License.
@@ -80,11 +80,12 @@ struct Google_Rpc_ErrorInfo: Sendable {
80
80
81
81
/// Additional structured details about this error.
82
82
///
83
- /// Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in
83
+ /// Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should
84
+ /// ideally be lowerCamelCase. Also, they must be limited to 64 characters in
84
85
/// length. When identifying the current value of an exceeded limit, the units
85
86
/// should be contained in the key, not the value. For example, rather than
86
- /// {"instanceLimit": "100/request"}, should be returned as,
87
- /// {"instanceLimitPerRequest": "100"}, if the client exceeds the number of
87
+ /// ` {"instanceLimit": "100/request"}` , should be returned as,
88
+ /// ` {"instanceLimitPerRequest": "100"}` , if the client exceeds the number of
88
89
/// instances that can be created in a single (batch) request.
89
90
var metadata : Dictionary < String , String > = [ : ]
90
91
@@ -187,9 +188,83 @@ struct Google_Rpc_QuotaFailure: Sendable {
187
188
/// exceeded".
188
189
var description_p : String = String ( )
189
190
191
+ /// The API Service from which the `QuotaFailure.Violation` orginates. In
192
+ /// some cases, Quota issues originate from an API Service other than the one
193
+ /// that was called. In other words, a dependency of the called API Service
194
+ /// could be the cause of the `QuotaFailure`, and this field would have the
195
+ /// dependency API service name.
196
+ ///
197
+ /// For example, if the called API is Kubernetes Engine API
198
+ /// (container.googleapis.com), and a quota violation occurs in the
199
+ /// Kubernetes Engine API itself, this field would be
200
+ /// "container.googleapis.com". On the other hand, if the quota violation
201
+ /// occurs when the Kubernetes Engine API creates VMs in the Compute Engine
202
+ /// API (compute.googleapis.com), this field would be
203
+ /// "compute.googleapis.com".
204
+ var apiService : String = String ( )
205
+
206
+ /// The metric of the violated quota. A quota metric is a named counter to
207
+ /// measure usage, such as API requests or CPUs. When an activity occurs in a
208
+ /// service, such as Virtual Machine allocation, one or more quota metrics
209
+ /// may be affected.
210
+ ///
211
+ /// For example, "compute.googleapis.com/cpus_per_vm_family",
212
+ /// "storage.googleapis.com/internet_egress_bandwidth".
213
+ var quotaMetric : String = String ( )
214
+
215
+ /// The id of the violated quota. Also know as "limit name", this is the
216
+ /// unique identifier of a quota in the context of an API service.
217
+ ///
218
+ /// For example, "CPUS-PER-VM-FAMILY-per-project-region".
219
+ var quotaID : String = String ( )
220
+
221
+ /// The dimensions of the violated quota. Every non-global quota is enforced
222
+ /// on a set of dimensions. While quota metric defines what to count, the
223
+ /// dimensions specify for what aspects the counter should be increased.
224
+ ///
225
+ /// For example, the quota "CPUs per region per VM family" enforces a limit
226
+ /// on the metric "compute.googleapis.com/cpus_per_vm_family" on dimensions
227
+ /// "region" and "vm_family". And if the violation occurred in region
228
+ /// "us-central1" and for VM family "n1", the quota_dimensions would be,
229
+ ///
230
+ /// {
231
+ /// "region": "us-central1",
232
+ /// "vm_family": "n1",
233
+ /// }
234
+ ///
235
+ /// When a quota is enforced globally, the quota_dimensions would always be
236
+ /// empty.
237
+ var quotaDimensions : Dictionary < String , String > = [ : ]
238
+
239
+ /// The enforced quota value at the time of the `QuotaFailure`.
240
+ ///
241
+ /// For example, if the enforced quota value at the time of the
242
+ /// `QuotaFailure` on the number of CPUs is "10", then the value of this
243
+ /// field would reflect this quantity.
244
+ var quotaValue : Int64 = 0
245
+
246
+ /// The new quota value being rolled out at the time of the violation. At the
247
+ /// completion of the rollout, this value will be enforced in place of
248
+ /// quota_value. If no rollout is in progress at the time of the violation,
249
+ /// this field is not set.
250
+ ///
251
+ /// For example, if at the time of the violation a rollout is in progress
252
+ /// changing the number of CPUs quota from 10 to 20, 20 would be the value of
253
+ /// this field.
254
+ var futureQuotaValue : Int64 {
255
+ get { return _futureQuotaValue ?? 0 }
256
+ set { _futureQuotaValue = newValue}
257
+ }
258
+ /// Returns true if `futureQuotaValue` has been explicitly set.
259
+ var hasFutureQuotaValue : Bool { return self . _futureQuotaValue != nil }
260
+ /// Clears the value of `futureQuotaValue`. Subsequent reads from it will return its default value.
261
+ mutating func clearFutureQuotaValue( ) { self . _futureQuotaValue = nil }
262
+
190
263
var unknownFields = SwiftProtobuf . UnknownStorage ( )
191
264
192
265
init ( ) { }
266
+
267
+ fileprivate var _futureQuotaValue : Int64 ? = nil
193
268
}
194
269
195
270
init ( ) { }
@@ -300,9 +375,30 @@ struct Google_Rpc_BadRequest: Sendable {
300
375
/// A description of why the request element is bad.
301
376
var description_p : String = String ( )
302
377
378
+ /// The reason of the field-level error. This is a constant value that
379
+ /// identifies the proximate cause of the field-level error. It should
380
+ /// uniquely identify the type of the FieldViolation within the scope of the
381
+ /// google.rpc.ErrorInfo.domain. This should be at most 63
382
+ /// characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`,
383
+ /// which represents UPPER_SNAKE_CASE.
384
+ var reason : String = String ( )
385
+
386
+ /// Provides a localized error message for field-level errors that is safe to
387
+ /// return to the API consumer.
388
+ var localizedMessage : Google_Rpc_LocalizedMessage {
389
+ get { return _localizedMessage ?? Google_Rpc_LocalizedMessage ( ) }
390
+ set { _localizedMessage = newValue}
391
+ }
392
+ /// Returns true if `localizedMessage` has been explicitly set.
393
+ var hasLocalizedMessage : Bool { return self . _localizedMessage != nil }
394
+ /// Clears the value of `localizedMessage`. Subsequent reads from it will return its default value.
395
+ mutating func clearLocalizedMessage( ) { self . _localizedMessage = nil }
396
+
303
397
var unknownFields = SwiftProtobuf . UnknownStorage ( )
304
398
305
399
init ( ) { }
400
+
401
+ fileprivate var _localizedMessage : Google_Rpc_LocalizedMessage ? = nil
306
402
}
307
403
308
404
init ( ) { }
@@ -574,6 +670,12 @@ extension Google_Rpc_QuotaFailure.Violation: SwiftProtobuf.Message, SwiftProtobu
574
670
static let _protobuf_nameMap : SwiftProtobuf . _NameMap = [
575
671
1 : . same( proto: " subject " ) ,
576
672
2 : . same( proto: " description " ) ,
673
+ 3 : . standard( proto: " api_service " ) ,
674
+ 4 : . standard( proto: " quota_metric " ) ,
675
+ 5 : . standard( proto: " quota_id " ) ,
676
+ 6 : . standard( proto: " quota_dimensions " ) ,
677
+ 7 : . standard( proto: " quota_value " ) ,
678
+ 8 : . standard( proto: " future_quota_value " ) ,
577
679
]
578
680
579
681
mutating func decodeMessage< D: SwiftProtobuf . Decoder > ( decoder: inout D ) throws {
@@ -584,24 +686,58 @@ extension Google_Rpc_QuotaFailure.Violation: SwiftProtobuf.Message, SwiftProtobu
584
686
switch fieldNumber {
585
687
case 1 : try { try decoder. decodeSingularStringField ( value: & self . subject) } ( )
586
688
case 2 : try { try decoder. decodeSingularStringField ( value: & self . description_p) } ( )
689
+ case 3 : try { try decoder. decodeSingularStringField ( value: & self . apiService) } ( )
690
+ case 4 : try { try decoder. decodeSingularStringField ( value: & self . quotaMetric) } ( )
691
+ case 5 : try { try decoder. decodeSingularStringField ( value: & self . quotaID) } ( )
692
+ case 6 : try { try decoder. decodeMapField ( fieldType: SwiftProtobuf . _ProtobufMap < SwiftProtobuf . ProtobufString , SwiftProtobuf . ProtobufString > . self, value: & self . quotaDimensions) } ( )
693
+ case 7 : try { try decoder. decodeSingularInt64Field ( value: & self . quotaValue) } ( )
694
+ case 8 : try { try decoder. decodeSingularInt64Field ( value: & self . _futureQuotaValue) } ( )
587
695
default : break
588
696
}
589
697
}
590
698
}
591
699
592
700
func traverse< V: SwiftProtobuf . Visitor > ( visitor: inout V ) throws {
701
+ // The use of inline closures is to circumvent an issue where the compiler
702
+ // allocates stack space for every if/case branch local when no optimizations
703
+ // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
704
+ // https://github.com/apple/swift-protobuf/issues/1182
593
705
if !self . subject. isEmpty {
594
706
try visitor. visitSingularStringField ( value: self . subject, fieldNumber: 1 )
595
707
}
596
708
if !self . description_p. isEmpty {
597
709
try visitor. visitSingularStringField ( value: self . description_p, fieldNumber: 2 )
598
710
}
711
+ if !self . apiService. isEmpty {
712
+ try visitor. visitSingularStringField ( value: self . apiService, fieldNumber: 3 )
713
+ }
714
+ if !self . quotaMetric. isEmpty {
715
+ try visitor. visitSingularStringField ( value: self . quotaMetric, fieldNumber: 4 )
716
+ }
717
+ if !self . quotaID. isEmpty {
718
+ try visitor. visitSingularStringField ( value: self . quotaID, fieldNumber: 5 )
719
+ }
720
+ if !self . quotaDimensions. isEmpty {
721
+ try visitor. visitMapField ( fieldType: SwiftProtobuf . _ProtobufMap < SwiftProtobuf . ProtobufString , SwiftProtobuf . ProtobufString > . self, value: self . quotaDimensions, fieldNumber: 6 )
722
+ }
723
+ if self . quotaValue != 0 {
724
+ try visitor. visitSingularInt64Field ( value: self . quotaValue, fieldNumber: 7 )
725
+ }
726
+ try { if let v = self . _futureQuotaValue {
727
+ try visitor. visitSingularInt64Field ( value: v, fieldNumber: 8 )
728
+ } } ( )
599
729
try unknownFields. traverse ( visitor: & visitor)
600
730
}
601
731
602
732
static func == ( lhs: Google_Rpc_QuotaFailure . Violation , rhs: Google_Rpc_QuotaFailure . Violation ) -> Bool {
603
733
if lhs. subject != rhs. subject { return false }
604
734
if lhs. description_p != rhs. description_p { return false }
735
+ if lhs. apiService != rhs. apiService { return false }
736
+ if lhs. quotaMetric != rhs. quotaMetric { return false }
737
+ if lhs. quotaID != rhs. quotaID { return false }
738
+ if lhs. quotaDimensions != rhs. quotaDimensions { return false }
739
+ if lhs. quotaValue != rhs. quotaValue { return false }
740
+ if lhs. _futureQuotaValue != rhs. _futureQuotaValue { return false }
605
741
if lhs. unknownFields != rhs. unknownFields { return false }
606
742
return true
607
743
}
@@ -720,6 +856,8 @@ extension Google_Rpc_BadRequest.FieldViolation: SwiftProtobuf.Message, SwiftProt
720
856
static let _protobuf_nameMap : SwiftProtobuf . _NameMap = [
721
857
1 : . same( proto: " field " ) ,
722
858
2 : . same( proto: " description " ) ,
859
+ 3 : . same( proto: " reason " ) ,
860
+ 4 : . standard( proto: " localized_message " ) ,
723
861
]
724
862
725
863
mutating func decodeMessage< D: SwiftProtobuf . Decoder > ( decoder: inout D ) throws {
@@ -730,24 +868,38 @@ extension Google_Rpc_BadRequest.FieldViolation: SwiftProtobuf.Message, SwiftProt
730
868
switch fieldNumber {
731
869
case 1 : try { try decoder. decodeSingularStringField ( value: & self . field) } ( )
732
870
case 2 : try { try decoder. decodeSingularStringField ( value: & self . description_p) } ( )
871
+ case 3 : try { try decoder. decodeSingularStringField ( value: & self . reason) } ( )
872
+ case 4 : try { try decoder. decodeSingularMessageField ( value: & self . _localizedMessage) } ( )
733
873
default : break
734
874
}
735
875
}
736
876
}
737
877
738
878
func traverse< V: SwiftProtobuf . Visitor > ( visitor: inout V ) throws {
879
+ // The use of inline closures is to circumvent an issue where the compiler
880
+ // allocates stack space for every if/case branch local when no optimizations
881
+ // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
882
+ // https://github.com/apple/swift-protobuf/issues/1182
739
883
if !self . field. isEmpty {
740
884
try visitor. visitSingularStringField ( value: self . field, fieldNumber: 1 )
741
885
}
742
886
if !self . description_p. isEmpty {
743
887
try visitor. visitSingularStringField ( value: self . description_p, fieldNumber: 2 )
744
888
}
889
+ if !self . reason. isEmpty {
890
+ try visitor. visitSingularStringField ( value: self . reason, fieldNumber: 3 )
891
+ }
892
+ try { if let v = self . _localizedMessage {
893
+ try visitor. visitSingularMessageField ( value: v, fieldNumber: 4 )
894
+ } } ( )
745
895
try unknownFields. traverse ( visitor: & visitor)
746
896
}
747
897
748
898
static func == ( lhs: Google_Rpc_BadRequest . FieldViolation , rhs: Google_Rpc_BadRequest . FieldViolation ) -> Bool {
749
899
if lhs. field != rhs. field { return false }
750
900
if lhs. description_p != rhs. description_p { return false }
901
+ if lhs. reason != rhs. reason { return false }
902
+ if lhs. _localizedMessage != rhs. _localizedMessage { return false }
751
903
if lhs. unknownFields != rhs. unknownFields { return false }
752
904
return true
753
905
}
0 commit comments