File tree Expand file tree Collapse file tree 5 files changed +382
-6
lines changed Expand file tree Collapse file tree 5 files changed +382
-6
lines changed Original file line number Diff line number Diff line change @@ -65,11 +65,10 @@ class CdsLoadBalancingConfig implements TypedLoadBalancingConfig {
65
65
}
66
66
67
67
static createFromJson ( obj : any ) : CdsLoadBalancingConfig {
68
- if ( 'cluster' in obj ) {
69
- return new CdsLoadBalancingConfig ( obj . cluster ) ;
70
- } else {
71
- throw new Error ( 'Missing "cluster" in cds load balancing config' ) ;
68
+ if ( ! ( 'cluster' in obj && typeof obj . cluster === 'string' ) ) {
69
+ throw new Error ( 'cds config must have a string field cluster' ) ;
72
70
}
71
+ return new CdsLoadBalancingConfig ( obj . cluster ) ;
73
72
}
74
73
}
75
74
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ class LrsLoadBalancingConfig implements TypedLoadBalancingConfig {
46
46
[ TYPE_NAME ] : {
47
47
cluster_name : this . clusterName ,
48
48
eds_service_name : this . edsServiceName ,
49
- lrs_load_reporting_server_name : this . lrsLoadReportingServer ,
49
+ lrs_load_reporting_server : this . lrsLoadReportingServer ,
50
50
locality : this . locality ,
51
51
child_policy : [ this . childPolicy . toJsonObject ( ) ]
52
52
}
@@ -97,6 +97,9 @@ class LrsLoadBalancingConfig implements TypedLoadBalancingConfig {
97
97
if ( ! ( 'child_policy' in obj && Array . isArray ( obj . child_policy ) ) ) {
98
98
throw new Error ( 'lrs config must have a child_policy array' ) ;
99
99
}
100
+ if ( ! ( 'lrs_load_reporting_server' in obj && obj . lrs_load_reporting_server !== null && typeof obj . lrs_load_reporting_server === 'object' ) ) {
101
+ throw new Error ( 'lrs config must have an object field lrs_load_reporting_server' ) ;
102
+ }
100
103
const childConfig = selectLbConfigFromList ( obj . child_policy ) ;
101
104
if ( ! childConfig ) {
102
105
throw new Error ( 'lrs config child_policy parsing failed' ) ;
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ class PriorityLoadBalancingConfig implements TypedLoadBalancingConfig {
81
81
const childrenField : { [ key : string ] : object } = { }
82
82
for ( const [ childName , childValue ] of this . children . entries ( ) ) {
83
83
childrenField [ childName ] = {
84
- config : [ childValue . config . toJsonObject ( ) ]
84
+ config : [ childValue . config . toJsonObject ( ) ] ,
85
+ ignore_reresolution_requests : childValue . ignore_reresolution_requests
85
86
} ;
86
87
}
87
88
return {
Original file line number Diff line number Diff line change @@ -112,6 +112,9 @@ const SUPPORTED_CHANNEL_CREDS_TYPES = [
112
112
] ;
113
113
114
114
export function validateXdsServerConfig ( obj : any ) : XdsServerConfig {
115
+ if ( ! ( typeof obj === 'object' && obj !== null ) ) {
116
+ throw new Error ( 'xDS server config must be an object' ) ;
117
+ }
115
118
if ( ! ( 'server_uri' in obj ) ) {
116
119
throw new Error ( 'server_uri field missing in xds_servers element' ) ;
117
120
}
You can’t perform that action at this time.
0 commit comments