1313// limitations under the License.
1414
1515import * as protos from '../../protos/protos' ;
16- import {
17- BasicClusterConfig ,
18- ICluster ,
19- SetClusterMetadataOptions ,
20- } from '../cluster' ;
16+ import { ICluster , SetClusterMetadataOptions } from '../cluster' ;
2117import { google } from '../../protos/protos' ;
2218
2319export class ClusterUtils {
@@ -28,9 +24,7 @@ export class ClusterUtils {
2824 static incompleteConfigError =
2925 'All of autoscaling configurations must be specified at the same time (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent).' ;
3026
31- static validateClusterMetadata (
32- metadata : SetClusterMetadataOptions | BasicClusterConfig
33- ) : void {
27+ static validateClusterMetadata ( metadata : SetClusterMetadataOptions ) : void {
3428 if ( metadata . nodes ) {
3529 if (
3630 metadata . minServeNodes ||
@@ -92,8 +86,7 @@ export class ClusterUtils {
9286 }
9387
9488 static getClusterBaseConfig (
95- metadata : SetClusterMetadataOptions | BasicClusterConfig ,
96- location : string | undefined | null ,
89+ metadata : SetClusterMetadataOptions ,
9790 name : string | undefined
9891 ) : google . bigtable . admin . v2 . ICluster {
9992 let clusterConfig ;
@@ -114,6 +107,7 @@ export class ClusterUtils {
114107 } ,
115108 } ;
116109 }
110+ const location = metadata ?. location ;
117111 return Object . assign (
118112 { } ,
119113 name ? { name} : null ,
@@ -125,12 +119,11 @@ export class ClusterUtils {
125119
126120 static getClusterFromMetadata (
127121 metadata : SetClusterMetadataOptions ,
128- location : string | undefined | null ,
129122 name : string
130123 ) : google . bigtable . admin . v2 . ICluster {
131124 const cluster : ICluster | SetClusterMetadataOptions = Object . assign (
132125 { } ,
133- this . getClusterBaseConfig ( metadata , location , name ) ,
126+ this . getClusterBaseConfig ( metadata , name ) ,
134127 metadata
135128 ) ;
136129 delete ( cluster as SetClusterMetadataOptions ) . nodes ;
@@ -142,11 +135,10 @@ export class ClusterUtils {
142135
143136 static getRequestFromMetadata (
144137 metadata : SetClusterMetadataOptions ,
145- location : string | undefined | null ,
146138 name : string
147139 ) : protos . google . bigtable . admin . v2 . IPartialUpdateClusterRequest {
148140 return {
149- cluster : this . getClusterFromMetadata ( metadata , location , name ) ,
141+ cluster : this . getClusterFromMetadata ( metadata , name ) ,
150142 updateMask : { paths : this . getUpdateMask ( metadata ) } ,
151143 } ;
152144 }
0 commit comments