1 5
// Copyright 2020 Google LLC
2 5
//
3 5
// Licensed under the Apache License, Version 2.0 (the "License");
4 5
// you may not use this file except in compliance with the License.
5 5
// You may obtain a copy of the License at
6 5
//
7 5
//     https://www.apache.org/licenses/LICENSE-2.0
8 5
//
9 5
// Unless required by applicable law or agreed to in writing, software
10 5
// distributed under the License is distributed on an "AS IS" BASIS,
11 5
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 5
// See the License for the specific language governing permissions and
13 5
// limitations under the License.
14 5
//
15 5
// ** This file is automatically generated by gapic-generator-typescript. **
16 5
// ** https://github.com/googleapis/gapic-generator-typescript **
17 5
// ** All changes to this file may be overwritten. **
18 5

19 5
/* global window */
20 5
import * as gax from 'google-gax';
21 5
import {
22 5
  Callback,
23 5
  CallOptions,
24 5
  Descriptors,
25 5
  ClientOptions,
26 5
  LROperation,
27 5
  PaginationCallback,
28 5
  GaxCall,
29 5
} from 'google-gax';
30 5
import * as path from 'path';
31 5

32 5
import {Transform} from 'stream';
33 5
import {RequestType} from 'google-gax/build/src/apitypes';
34 5
import * as protos from '../../protos/protos';
35 5
/**
36 5
 * Client JSON configuration object, loaded from
37 5
 * `src/v1beta/game_server_clusters_service_client_config.json`.
38 5
 * This file defines retry strategy and timeouts for all API methods in this library.
39 5
 */
40 5
import * as gapicConfig from './game_server_clusters_service_client_config.json';
41 5
import {operationsProtos} from 'google-gax';
42 5
const version = require('../../../package.json').version;
43 5

44 5
/**
45 5
 *  The game server cluster maps to Kubernetes clusters running Agones and is
46 5
 *  used to manage fleets within clusters.
47 5
 * @class
48 5
 * @memberof v1beta
49 5
 */
50 5
export class GameServerClustersServiceClient {
51 5
  private _terminated = false;
52 5
  private _opts: ClientOptions;
53 5
  private _gaxModule: typeof gax | typeof gax.fallback;
54 5
  private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
55 5
  private _protos: {};
56 5
  private _defaults: {[method: string]: gax.CallSettings};
57 5
  auth: gax.GoogleAuth;
58 5
  descriptors: Descriptors = {
59 5
    page: {},
60 5
    stream: {},
61 5
    longrunning: {},
62 5
    batching: {},
63 5
  };
64 5
  innerApiCalls: {[name: string]: Function};
65 5
  pathTemplates: {[name: string]: gax.PathTemplate};
66 5
  operationsClient: gax.OperationsClient;
67 5
  gameServerClustersServiceStub?: Promise<{[name: string]: Function}>;
68 5

69 5
  /**
70 5
   * Construct an instance of GameServerClustersServiceClient.
71 5
   *
72 5
   * @param {object} [options] - The configuration object.
73 5
   * The options accepted by the constructor are described in detail
74 5
   * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
75 5
   * The common options are:
76 5
   * @param {object} [options.credentials] - Credentials object.
77 5
   * @param {string} [options.credentials.client_email]
78 5
   * @param {string} [options.credentials.private_key]
79 5
   * @param {string} [options.email] - Account email address. Required when
80 5
   *     using a .pem or .p12 keyFilename.
81 5
   * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
82 5
   *     .p12 key downloaded from the Google Developers Console. If you provide
83 5
   *     a path to a JSON file, the projectId option below is not necessary.
84 5
   *     NOTE: .pem and .p12 require you to specify options.email as well.
85 5
   * @param {number} [options.port] - The port on which to connect to
86 5
   *     the remote host.
87 5
   * @param {string} [options.projectId] - The project ID from the Google
88 5
   *     Developer's Console, e.g. 'grape-spaceship-123'. We will also check
89 5
   *     the environment variable GCLOUD_PROJECT for your project ID. If your
90 5
   *     app is running in an environment which supports
91 5
   *     {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
92 5
   *     your project ID will be detected automatically.
93 5
   * @param {string} [options.apiEndpoint] - The domain name of the
94 5
   *     API remote host.
95 5
   * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
96 5
   *     Follows the structure of {@link gapicConfig}.
97 5
   * @param {boolean} [options.fallback] - Use HTTP fallback mode.
98 5
   *     In fallback mode, a special browser-compatible transport implementation is used
99 5
   *     instead of gRPC transport. In browser context (if the `window` object is defined)
100 5
   *     the fallback mode is enabled automatically; set `options.fallback` to `false`
101 5
   *     if you need to override this behavior.
102 5
   */
103 5
  constructor(opts?: ClientOptions) {
104 5
    // Ensure that options include all the required fields.
105 5
    const staticMembers = this
106 5
      .constructor as typeof GameServerClustersServiceClient;
107 5
    const servicePath =
108 5
      opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
109 5
    const port = opts?.port || staticMembers.port;
110 5
    const clientConfig = opts?.clientConfig ?? {};
111 5
    const fallback =
112 5
      opts?.fallback ??
113 5
      (typeof window !== 'undefined' && typeof window?.fetch === 'function');
114 5
    opts = Object.assign({servicePath, port, clientConfig, fallback}, opts);
115 5

116 5
    // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
117 5
    if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
118 0
      opts['scopes'] = staticMembers.scopes;
119 0
    }
120 5

121 5
    // Choose either gRPC or proto-over-HTTP implementation of google-gax.
122 5
    this._gaxModule = opts.fallback ? gax.fallback : gax;
123 5

124 5
    // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
125 5
    this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
126 5

127 5
    // Save options to use in initialize() method.
128 5
    this._opts = opts;
129 5

130 5
    // Save the auth object to the client, for use by other methods.
131 5
    this.auth = this._gaxGrpc.auth as gax.GoogleAuth;
132 5

133 5
    // Set the default scopes in auth client if needed.
134 5
    if (servicePath === staticMembers.servicePath) {
135 5
      this.auth.defaultScopes = staticMembers.scopes;
136 5
    }
137 5

138 5
    // Determine the client header string.
139 5
    const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
140 5
    if (typeof process !== 'undefined' && 'versions' in process) {
141 5
      clientHeader.push(`gl-node/${process.versions.node}`);
142 5
    } else {
143 0
      clientHeader.push(`gl-web/${this._gaxModule.version}`);
144 0
    }
145 5
    if (!opts.fallback) {
146 5
      clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
147 5
    }
148 5
    if (opts.libName && opts.libVersion) {
149 0
      clientHeader.push(`${opts.libName}/${opts.libVersion}`);
150 0
    }
151 5
    // Load the applicable protos.
152 5
    // For Node.js, pass the path to JSON proto file.
153 5
    // For browsers, pass the JSON content.
154 5

155 5
    const nodejsProtoPath = path.join(
156 5
      __dirname,
157 5
      '..',
158 5
      '..',
159 5
      'protos',
160 5
      'protos.json'
161 5
    );
162 5
    this._protos = this._gaxGrpc.loadProto(
163 5
      opts.fallback
164 5
        ? // eslint-disable-next-line @typescript-eslint/no-var-requires
165 5
          require('../../protos/protos.json')
166 5
        : nodejsProtoPath
167 5
    );
168 5

169 5
    // This API contains "path templates"; forward-slash-separated
170 5
    // identifiers to uniquely identify resources within the API.
171 5
    // Create useful helper objects for these.
172 5
    this.pathTemplates = {
173 5
      gameServerClusterPathTemplate: new this._gaxModule.PathTemplate(
174 5
        'projects/{project}/locations/{location}/realms/{realm}/gameServerClusters/{cluster}'
175 5
      ),
176 5
      gameServerConfigPathTemplate: new this._gaxModule.PathTemplate(
177 5
        'projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}'
178 5
      ),
179 5
      gameServerDeploymentPathTemplate: new this._gaxModule.PathTemplate(
180 5
        'projects/{project}/locations/{location}/gameServerDeployments/{deployment}'
181 5
      ),
182 5
      gameServerDeploymentRolloutPathTemplate: new this._gaxModule.PathTemplate(
183 5
        'projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout'
184 5
      ),
185 5
      realmPathTemplate: new this._gaxModule.PathTemplate(
186 5
        'projects/{project}/locations/{location}/realms/{realm}'
187 5
      ),
188 5
    };
189 5

190 5
    // Some of the methods on this service return "paged" results,
191 5
    // (e.g. 50 results at a time, with tokens to get subsequent
192 5
    // pages). Denote the keys used for pagination and results.
193 5
    this.descriptors.page = {
194 5
      listGameServerClusters: new this._gaxModule.PageDescriptor(
195 5
        'pageToken',
196 5
        'nextPageToken',
197 5
        'gameServerClusters'
198 5
      ),
199 5
    };
200 5

201 5
    // This API contains "long-running operations", which return a
202 5
    // an Operation object that allows for tracking of the operation,
203 5
    // rather than holding a request open.
204 5
    const protoFilesRoot = opts.fallback
205 5
      ? this._gaxModule.protobuf.Root.fromJSON(
206 5
          // eslint-disable-next-line @typescript-eslint/no-var-requires
207 5
          require('../../protos/protos.json')
208 5
        )
209 5
      : this._gaxModule.protobuf.loadSync(nodejsProtoPath);
210 5

211 5
    this.operationsClient = this._gaxModule
212 5
      .lro({
213 5
        auth: this.auth,
214 5
        grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
215 5
      })
216 5
      .operationsClient(opts);
217 5
    const createGameServerClusterResponse = protoFilesRoot.lookup(
218 5
      '.google.cloud.gaming.v1beta.GameServerCluster'
219 5
    ) as gax.protobuf.Type;
220 5
    const createGameServerClusterMetadata = protoFilesRoot.lookup(
221 5
      '.google.cloud.gaming.v1beta.OperationMetadata'
222 5
    ) as gax.protobuf.Type;
223 5
    const deleteGameServerClusterResponse = protoFilesRoot.lookup(
224 5
      '.google.protobuf.Empty'
225 5
    ) as gax.protobuf.Type;
226 5
    const deleteGameServerClusterMetadata = protoFilesRoot.lookup(
227 5
      '.google.cloud.gaming.v1beta.OperationMetadata'
228 5
    ) as gax.protobuf.Type;
229 5
    const updateGameServerClusterResponse = protoFilesRoot.lookup(
230 5
      '.google.cloud.gaming.v1beta.GameServerCluster'
231 5
    ) as gax.protobuf.Type;
232 5
    const updateGameServerClusterMetadata = protoFilesRoot.lookup(
233 5
      '.google.cloud.gaming.v1beta.OperationMetadata'
234 5
    ) as gax.protobuf.Type;
235 5

236 5
    this.descriptors.longrunning = {
237 5
      createGameServerCluster: new this._gaxModule.LongrunningDescriptor(
238 5
        this.operationsClient,
239 5
        createGameServerClusterResponse.decode.bind(
240 5
          createGameServerClusterResponse
241 5
        ),
242 5
        createGameServerClusterMetadata.decode.bind(
243 5
          createGameServerClusterMetadata
244 5
        )
245 5
      ),
246 5
      deleteGameServerCluster: new this._gaxModule.LongrunningDescriptor(
247 5
        this.operationsClient,
248 5
        deleteGameServerClusterResponse.decode.bind(
249 5
          deleteGameServerClusterResponse
250 5
        ),
251 5
        deleteGameServerClusterMetadata.decode.bind(
252 5
          deleteGameServerClusterMetadata
253 5
        )
254 5
      ),
255 5
      updateGameServerCluster: new this._gaxModule.LongrunningDescriptor(
256 5
        this.operationsClient,
257 5
        updateGameServerClusterResponse.decode.bind(
258 5
          updateGameServerClusterResponse
259 5
        ),
260 5
        updateGameServerClusterMetadata.decode.bind(
261 5
          updateGameServerClusterMetadata
262 5
        )
263 5
      ),
264 5
    };
265 5

266 5
    // Put together the default options sent with requests.
267 5
    this._defaults = this._gaxGrpc.constructSettings(
268 5
      'google.cloud.gaming.v1beta.GameServerClustersService',
269 5
      gapicConfig as gax.ClientConfig,
270 5
      opts.clientConfig || {},
271 5
      {'x-goog-api-client': clientHeader.join(' ')}
272 5
    );
273 5

274 5
    // Set up a dictionary of "inner API calls"; the core implementation
275 5
    // of calling the API is handled in `google-gax`, with this code
276 5
    // merely providing the destination and request information.
277 5
    this.innerApiCalls = {};
278 5
  }
279 5

280 5
  /**
281 5
   * Initialize the client.
282 5
   * Performs asynchronous operations (such as authentication) and prepares the client.
283 5
   * This function will be called automatically when any class method is called for the
284 5
   * first time, but if you need to initialize it before calling an actual method,
285 5
   * feel free to call initialize() directly.
286 5
   *
287 5
   * You can await on this method if you want to make sure the client is initialized.
288 5
   *
289 5
   * @returns {Promise} A promise that resolves to an authenticated service stub.
290 5
   */
291 5
  initialize() {
292 5
    // If the client stub promise is already initialized, return immediately.
293 5
    if (this.gameServerClustersServiceStub) {
294 5
      return this.gameServerClustersServiceStub;
295 5
    }
296 5

297 5
    // Put together the "service stub" for
298 5
    // google.cloud.gaming.v1beta.GameServerClustersService.
299 5
    this.gameServerClustersServiceStub = this._gaxGrpc.createStub(
300 5
      this._opts.fallback
301 5
        ? (this._protos as protobuf.Root).lookupService(
302 0
            'google.cloud.gaming.v1beta.GameServerClustersService'
303 5
          )
304 5
        : // eslint-disable-next-line @typescript-eslint/no-explicit-any
305 5
          (this._protos as any).google.cloud.gaming.v1beta
306 5
            .GameServerClustersService,
307 5
      this._opts
308 5
    ) as Promise<{[method: string]: Function}>;
309 5

310 5
    // Iterate over each of the methods that the service provides
311 5
    // and create an API call method for each.
312 5
    const gameServerClustersServiceStubMethods = [
313 5
      'listGameServerClusters',
314 5
      'getGameServerCluster',
315 5
      'createGameServerCluster',
316 5
      'previewCreateGameServerCluster',
317 5
      'deleteGameServerCluster',
318 5
      'previewDeleteGameServerCluster',
319 5
      'updateGameServerCluster',
320 5
      'previewUpdateGameServerCluster',
321 5
    ];
322 5
    for (const methodName of gameServerClustersServiceStubMethods) {
323 5
      const callPromise = this.gameServerClustersServiceStub.then(
324 5
        stub => (...args: Array<{}>) => {
325 0
          if (this._terminated) {
326 0
            return Promise.reject('The client has already been closed.');
327 0
          }
328 0
          const func = stub[methodName];
329 0
          return func.apply(stub, args);
330 5
        },
331 5
        (err: Error | null | undefined) => () => {
332 0
          throw err;
333 0
        }
334 5
      );
335 5

336 5
      const descriptor =
337 5
        this.descriptors.page[methodName] ||
338 5
        this.descriptors.longrunning[methodName] ||
339 5
        undefined;
340 5
      const apiCall = this._gaxModule.createApiCall(
341 5
        callPromise,
342 5
        this._defaults[methodName],
343 5
        descriptor
344 5
      );
345 5

346 5
      this.innerApiCalls[methodName] = apiCall;
347 5
    }
348 5

349 5
    return this.gameServerClustersServiceStub;
350 5
  }
351 5

352 5
  /**
353 5
   * The DNS address for this API service.
354 5
   * @returns {string} The DNS address for this service.
355 5
   */
356 5
  static get servicePath() {
357 5
    return 'gameservices.googleapis.com';
358 5
  }
359 5

360 5
  /**
361 5
   * The DNS address for this API service - same as servicePath(),
362 5
   * exists for compatibility reasons.
363 5
   * @returns {string} The DNS address for this service.
364 5
   */
365 5
  static get apiEndpoint() {
366 5
    return 'gameservices.googleapis.com';
367 5
  }
368 5

369 5
  /**
370 5
   * The port for this API service.
371 5
   * @returns {number} The default port for this service.
372 5
   */
373 5
  static get port() {
374 5
    return 443;
375 5
  }
376 5

377 5
  /**
378 5
   * The scopes needed to make gRPC calls for every method defined
379 5
   * in this service.
380 5
   * @returns {string[]} List of default scopes.
381 5
   */
382 5
  static get scopes() {
383 5
    return ['https://www.googleapis.com/auth/cloud-platform'];
384 5
  }
385 5

386 5
  getProjectId(): Promise<string>;
387 5
  getProjectId(callback: Callback<string, undefined, undefined>): void;
388 5
  /**
389 5
   * Return the project ID used by this class.
390 5
   * @returns {Promise} A promise that resolves to string containing the project ID.
391 5
   */
392 5
  getProjectId(
393 5
    callback?: Callback<string, undefined, undefined>
394 5
  ): Promise<string> | void {
395 5
    if (callback) {
396 5
      this.auth.getProjectId(callback);
397 5
      return;
398 5
    }
399 5
    return this.auth.getProjectId();
400 5
  }
401 5

402 5
  // -------------------
403 5
  // -- Service calls --
404 5
  // -------------------
405 5
  getGameServerCluster(
406 5
    request: protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest,
407 5
    options?: CallOptions
408 5
  ): Promise<
409 5
    [
410 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster,
411 5
      (
412 5
        | protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest
413 5
        | undefined
414 5
      ),
415 5
      {} | undefined
416 5
    ]
417 5
  >;
418 5
  getGameServerCluster(
419 5
    request: protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest,
420 5
    options: CallOptions,
421 5
    callback: Callback<
422 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster,
423 5
      | protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest
424 5
      | null
425 5
      | undefined,
426 5
      {} | null | undefined
427 5
    >
428 5
  ): void;
429 5
  getGameServerCluster(
430 5
    request: protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest,
431 5
    callback: Callback<
432 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster,
433 5
      | protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest
434 5
      | null
435 5
      | undefined,
436 5
      {} | null | undefined
437 5
    >
438 5
  ): void;
439 5
  /**
440 5
   * Gets details of a single game server cluster.
441 5
   *
442 5
   * @param {Object} request
443 5
   *   The request object that will be sent.
444 5
   * @param {string} request.name
445 5
   *   Required. The name of the game server cluster to retrieve. Uses the form:
446 5
   *
447 5
   *   `projects/{project}/locations/{location}/realms/{realm-id}/gameServerClusters/{cluster}`.
448 5
   * @param {object} [options]
449 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
450 5
   * @returns {Promise} - The promise which resolves to an array.
451 5
   *   The first element of the array is an object representing [GameServerCluster]{@link google.cloud.gaming.v1beta.GameServerCluster}.
452 5
   *   Please see the
453 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
454 5
   *   for more details and examples.
455 5
   * @example
456 5
   * const [response] = await client.getGameServerCluster(request);
457 5
   */
458 5
  getGameServerCluster(
459 5
    request: protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest,
460 5
    optionsOrCallback?:
461 5
      | CallOptions
462 5
      | Callback<
463 5
          protos.google.cloud.gaming.v1beta.IGameServerCluster,
464 5
          | protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest
465 5
          | null
466 5
          | undefined,
467 5
          {} | null | undefined
468 5
        >,
469 5
    callback?: Callback<
470 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster,
471 5
      | protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest
472 5
      | null
473 5
      | undefined,
474 5
      {} | null | undefined
475 5
    >
476 5
  ): Promise<
477 5
    [
478 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster,
479 5
      (
480 5
        | protos.google.cloud.gaming.v1beta.IGetGameServerClusterRequest
481 5
        | undefined
482 5
      ),
483 5
      {} | undefined
484 5
    ]
485 5
  > | void {
486 5
    request = request || {};
487 5
    let options: CallOptions;
488 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
489 5
      callback = optionsOrCallback;
490 5
      options = {};
491 5
    } else {
492 5
      options = optionsOrCallback as CallOptions;
493 5
    }
494 5
    options = options || {};
495 5
    options.otherArgs = options.otherArgs || {};
496 5
    options.otherArgs.headers = options.otherArgs.headers || {};
497 5
    options.otherArgs.headers[
498 5
      'x-goog-request-params'
499 5
    ] = gax.routingHeader.fromParams({
500 5
      name: request.name || '',
501 5
    });
502 5
    this.initialize();
503 5
    return this.innerApiCalls.getGameServerCluster(request, options, callback);
504 5
  }
505 5
  previewCreateGameServerCluster(
506 5
    request: protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest,
507 5
    options?: CallOptions
508 5
  ): Promise<
509 5
    [
510 5
      protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterResponse,
511 5
      (
512 5
        | protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest
513 5
        | undefined
514 5
      ),
515 5
      {} | undefined
516 5
    ]
517 5
  >;
518 5
  previewCreateGameServerCluster(
519 5
    request: protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest,
520 5
    options: CallOptions,
521 5
    callback: Callback<
522 5
      protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterResponse,
523 5
      | protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest
524 5
      | null
525 5
      | undefined,
526 5
      {} | null | undefined
527 5
    >
528 5
  ): void;
529 5
  previewCreateGameServerCluster(
530 5
    request: protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest,
531 5
    callback: Callback<
532 5
      protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterResponse,
533 5
      | protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest
534 5
      | null
535 5
      | undefined,
536 5
      {} | null | undefined
537 5
    >
538 5
  ): void;
539 5
  /**
540 5
   * Previews creation of a new game server cluster in a given project and
541 5
   * location.
542 5
   *
543 5
   * @param {Object} request
544 5
   *   The request object that will be sent.
545 5
   * @param {string} request.parent
546 5
   *   Required. The parent resource name. Uses the form:
547 5
   *   `projects/{project}/locations/{location}/realms/{realm}`.
548 5
   * @param {string} request.gameServerClusterId
549 5
   *   Required. The ID of the game server cluster resource to be created.
550 5
   * @param {google.cloud.gaming.v1beta.GameServerCluster} request.gameServerCluster
551 5
   *   Required. The game server cluster resource to be created.
552 5
   * @param {google.protobuf.Timestamp} [request.previewTime]
553 5
   *   Optional. The target timestamp to compute the preview.
554 5
   * @param {object} [options]
555 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
556 5
   * @returns {Promise} - The promise which resolves to an array.
557 5
   *   The first element of the array is an object representing [PreviewCreateGameServerClusterResponse]{@link google.cloud.gaming.v1beta.PreviewCreateGameServerClusterResponse}.
558 5
   *   Please see the
559 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
560 5
   *   for more details and examples.
561 5
   * @example
562 5
   * const [response] = await client.previewCreateGameServerCluster(request);
563 5
   */
564 5
  previewCreateGameServerCluster(
565 5
    request: protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest,
566 5
    optionsOrCallback?:
567 5
      | CallOptions
568 5
      | Callback<
569 5
          protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterResponse,
570 5
          | protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest
571 5
          | null
572 5
          | undefined,
573 5
          {} | null | undefined
574 5
        >,
575 5
    callback?: Callback<
576 5
      protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterResponse,
577 5
      | protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest
578 5
      | null
579 5
      | undefined,
580 5
      {} | null | undefined
581 5
    >
582 5
  ): Promise<
583 5
    [
584 5
      protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterResponse,
585 5
      (
586 5
        | protos.google.cloud.gaming.v1beta.IPreviewCreateGameServerClusterRequest
587 5
        | undefined
588 5
      ),
589 5
      {} | undefined
590 5
    ]
591 5
  > | void {
592 5
    request = request || {};
593 5
    let options: CallOptions;
594 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
595 5
      callback = optionsOrCallback;
596 5
      options = {};
597 5
    } else {
598 5
      options = optionsOrCallback as CallOptions;
599 5
    }
600 5
    options = options || {};
601 5
    options.otherArgs = options.otherArgs || {};
602 5
    options.otherArgs.headers = options.otherArgs.headers || {};
603 5
    options.otherArgs.headers[
604 5
      'x-goog-request-params'
605 5
    ] = gax.routingHeader.fromParams({
606 5
      parent: request.parent || '',
607 5
    });
608 5
    this.initialize();
609 5
    return this.innerApiCalls.previewCreateGameServerCluster(
610 5
      request,
611 5
      options,
612 5
      callback
613 5
    );
614 5
  }
615 5
  previewDeleteGameServerCluster(
616 5
    request: protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest,
617 5
    options?: CallOptions
618 5
  ): Promise<
619 5
    [
620 5
      protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterResponse,
621 5
      (
622 5
        | protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest
623 5
        | undefined
624 5
      ),
625 5
      {} | undefined
626 5
    ]
627 5
  >;
628 5
  previewDeleteGameServerCluster(
629 5
    request: protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest,
630 5
    options: CallOptions,
631 5
    callback: Callback<
632 5
      protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterResponse,
633 5
      | protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest
634 5
      | null
635 5
      | undefined,
636 5
      {} | null | undefined
637 5
    >
638 5
  ): void;
639 5
  previewDeleteGameServerCluster(
640 5
    request: protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest,
641 5
    callback: Callback<
642 5
      protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterResponse,
643 5
      | protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest
644 5
      | null
645 5
      | undefined,
646 5
      {} | null | undefined
647 5
    >
648 5
  ): void;
649 5
  /**
650 5
   * Previews deletion of a single game server cluster.
651 5
   *
652 5
   * @param {Object} request
653 5
   *   The request object that will be sent.
654 5
   * @param {string} request.name
655 5
   *   Required. The name of the game server cluster to delete. Uses the form:
656 5
   *   `projects/{project}/locations/{location}/gameServerClusters/{cluster}`.
657 5
   * @param {google.protobuf.Timestamp} [request.previewTime]
658 5
   *   Optional. The target timestamp to compute the preview.
659 5
   * @param {object} [options]
660 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
661 5
   * @returns {Promise} - The promise which resolves to an array.
662 5
   *   The first element of the array is an object representing [PreviewDeleteGameServerClusterResponse]{@link google.cloud.gaming.v1beta.PreviewDeleteGameServerClusterResponse}.
663 5
   *   Please see the
664 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
665 5
   *   for more details and examples.
666 5
   * @example
667 5
   * const [response] = await client.previewDeleteGameServerCluster(request);
668 5
   */
669 5
  previewDeleteGameServerCluster(
670 5
    request: protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest,
671 5
    optionsOrCallback?:
672 5
      | CallOptions
673 5
      | Callback<
674 5
          protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterResponse,
675 5
          | protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest
676 5
          | null
677 5
          | undefined,
678 5
          {} | null | undefined
679 5
        >,
680 5
    callback?: Callback<
681 5
      protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterResponse,
682 5
      | protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest
683 5
      | null
684 5
      | undefined,
685 5
      {} | null | undefined
686 5
    >
687 5
  ): Promise<
688 5
    [
689 5
      protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterResponse,
690 5
      (
691 5
        | protos.google.cloud.gaming.v1beta.IPreviewDeleteGameServerClusterRequest
692 5
        | undefined
693 5
      ),
694 5
      {} | undefined
695 5
    ]
696 5
  > | void {
697 5
    request = request || {};
698 5
    let options: CallOptions;
699 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
700 5
      callback = optionsOrCallback;
701 5
      options = {};
702 5
    } else {
703 5
      options = optionsOrCallback as CallOptions;
704 5
    }
705 5
    options = options || {};
706 5
    options.otherArgs = options.otherArgs || {};
707 5
    options.otherArgs.headers = options.otherArgs.headers || {};
708 5
    options.otherArgs.headers[
709 5
      'x-goog-request-params'
710 5
    ] = gax.routingHeader.fromParams({
711 5
      name: request.name || '',
712 5
    });
713 5
    this.initialize();
714 5
    return this.innerApiCalls.previewDeleteGameServerCluster(
715 5
      request,
716 5
      options,
717 5
      callback
718 5
    );
719 5
  }
720 5
  previewUpdateGameServerCluster(
721 5
    request: protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest,
722 5
    options?: CallOptions
723 5
  ): Promise<
724 5
    [
725 5
      protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterResponse,
726 5
      (
727 5
        | protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest
728 5
        | undefined
729 5
      ),
730 5
      {} | undefined
731 5
    ]
732 5
  >;
733 5
  previewUpdateGameServerCluster(
734 5
    request: protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest,
735 5
    options: CallOptions,
736 5
    callback: Callback<
737 5
      protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterResponse,
738 5
      | protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest
739 5
      | null
740 5
      | undefined,
741 5
      {} | null | undefined
742 5
    >
743 5
  ): void;
744 5
  previewUpdateGameServerCluster(
745 5
    request: protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest,
746 5
    callback: Callback<
747 5
      protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterResponse,
748 5
      | protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest
749 5
      | null
750 5
      | undefined,
751 5
      {} | null | undefined
752 5
    >
753 5
  ): void;
754 5
  /**
755 5
   * Previews updating a GameServerCluster.
756 5
   *
757 5
   * @param {Object} request
758 5
   *   The request object that will be sent.
759 5
   * @param {google.cloud.gaming.v1beta.GameServerCluster} request.gameServerCluster
760 5
   *   Required. The game server cluster to be updated.
761 5
   *   Only fields specified in update_mask are updated.
762 5
   * @param {google.protobuf.FieldMask} request.updateMask
763 5
   *   Required. Mask of fields to update. At least one path must be supplied in
764 5
   *   this field. For the `FieldMask` definition, see
765 5
   *
766 5
   *   https:
767 5
   *   //developers.google.com/protocol-buffers
768 5
   *   // /docs/reference/google.protobuf#fieldmask
769 5
   * @param {google.protobuf.Timestamp} [request.previewTime]
770 5
   *   Optional. The target timestamp to compute the preview.
771 5
   * @param {object} [options]
772 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
773 5
   * @returns {Promise} - The promise which resolves to an array.
774 5
   *   The first element of the array is an object representing [PreviewUpdateGameServerClusterResponse]{@link google.cloud.gaming.v1beta.PreviewUpdateGameServerClusterResponse}.
775 5
   *   Please see the
776 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
777 5
   *   for more details and examples.
778 5
   * @example
779 5
   * const [response] = await client.previewUpdateGameServerCluster(request);
780 5
   */
781 5
  previewUpdateGameServerCluster(
782 5
    request: protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest,
783 5
    optionsOrCallback?:
784 5
      | CallOptions
785 5
      | Callback<
786 5
          protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterResponse,
787 5
          | protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest
788 5
          | null
789 5
          | undefined,
790 5
          {} | null | undefined
791 5
        >,
792 5
    callback?: Callback<
793 5
      protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterResponse,
794 5
      | protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest
795 5
      | null
796 5
      | undefined,
797 5
      {} | null | undefined
798 5
    >
799 5
  ): Promise<
800 5
    [
801 5
      protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterResponse,
802 5
      (
803 5
        | protos.google.cloud.gaming.v1beta.IPreviewUpdateGameServerClusterRequest
804 5
        | undefined
805 5
      ),
806 5
      {} | undefined
807 5
    ]
808 5
  > | void {
809 5
    request = request || {};
810 5
    let options: CallOptions;
811 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
812 5
      callback = optionsOrCallback;
813 5
      options = {};
814 5
    } else {
815 5
      options = optionsOrCallback as CallOptions;
816 5
    }
817 5
    options = options || {};
818 5
    options.otherArgs = options.otherArgs || {};
819 5
    options.otherArgs.headers = options.otherArgs.headers || {};
820 5
    options.otherArgs.headers[
821 5
      'x-goog-request-params'
822 5
    ] = gax.routingHeader.fromParams({
823 5
      'game_server_cluster.name': request.gameServerCluster!.name || '',
824 5
    });
825 5
    this.initialize();
826 5
    return this.innerApiCalls.previewUpdateGameServerCluster(
827 5
      request,
828 5
      options,
829 5
      callback
830 5
    );
831 5
  }
832 5

833 5
  createGameServerCluster(
834 5
    request: protos.google.cloud.gaming.v1beta.ICreateGameServerClusterRequest,
835 5
    options?: CallOptions
836 5
  ): Promise<
837 5
    [
838 5
      LROperation<
839 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
840 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
841 5
      >,
842 5
      protos.google.longrunning.IOperation | undefined,
843 5
      {} | undefined
844 5
    ]
845 5
  >;
846 5
  createGameServerCluster(
847 5
    request: protos.google.cloud.gaming.v1beta.ICreateGameServerClusterRequest,
848 5
    options: CallOptions,
849 5
    callback: Callback<
850 5
      LROperation<
851 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
852 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
853 5
      >,
854 5
      protos.google.longrunning.IOperation | null | undefined,
855 5
      {} | null | undefined
856 5
    >
857 5
  ): void;
858 5
  createGameServerCluster(
859 5
    request: protos.google.cloud.gaming.v1beta.ICreateGameServerClusterRequest,
860 5
    callback: Callback<
861 5
      LROperation<
862 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
863 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
864 5
      >,
865 5
      protos.google.longrunning.IOperation | null | undefined,
866 5
      {} | null | undefined
867 5
    >
868 5
  ): void;
869 5
  /**
870 5
   * Creates a new game server cluster in a given project and location.
871 5
   *
872 5
   * @param {Object} request
873 5
   *   The request object that will be sent.
874 5
   * @param {string} request.parent
875 5
   *   Required. The parent resource name. Uses the form:
876 5
   *   `projects/{project}/locations/{location}/realms/{realm-id}`.
877 5
   * @param {string} request.gameServerClusterId
878 5
   *   Required. The ID of the game server cluster resource to be created.
879 5
   * @param {google.cloud.gaming.v1beta.GameServerCluster} request.gameServerCluster
880 5
   *   Required. The game server cluster resource to be created.
881 5
   * @param {object} [options]
882 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
883 5
   * @returns {Promise} - The promise which resolves to an array.
884 5
   *   The first element of the array is an object representing
885 5
   *   a long running operation. Its `promise()` method returns a promise
886 5
   *   you can `await` for.
887 5
   *   Please see the
888 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
889 5
   *   for more details and examples.
890 5
   * @example
891 5
   * const [operation] = await client.createGameServerCluster(request);
892 5
   * const [response] = await operation.promise();
893 5
   */
894 5
  createGameServerCluster(
895 5
    request: protos.google.cloud.gaming.v1beta.ICreateGameServerClusterRequest,
896 5
    optionsOrCallback?:
897 5
      | CallOptions
898 5
      | Callback<
899 5
          LROperation<
900 5
            protos.google.cloud.gaming.v1beta.IGameServerCluster,
901 5
            protos.google.cloud.gaming.v1beta.IOperationMetadata
902 5
          >,
903 5
          protos.google.longrunning.IOperation | null | undefined,
904 5
          {} | null | undefined
905 5
        >,
906 5
    callback?: Callback<
907 5
      LROperation<
908 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
909 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
910 5
      >,
911 5
      protos.google.longrunning.IOperation | null | undefined,
912 5
      {} | null | undefined
913 5
    >
914 5
  ): Promise<
915 5
    [
916 5
      LROperation<
917 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
918 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
919 5
      >,
920 5
      protos.google.longrunning.IOperation | undefined,
921 5
      {} | undefined
922 5
    ]
923 5
  > | void {
924 5
    request = request || {};
925 5
    let options: CallOptions;
926 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
927 5
      callback = optionsOrCallback;
928 5
      options = {};
929 5
    } else {
930 5
      options = optionsOrCallback as CallOptions;
931 5
    }
932 5
    options = options || {};
933 5
    options.otherArgs = options.otherArgs || {};
934 5
    options.otherArgs.headers = options.otherArgs.headers || {};
935 5
    options.otherArgs.headers[
936 5
      'x-goog-request-params'
937 5
    ] = gax.routingHeader.fromParams({
938 5
      parent: request.parent || '',
939 5
    });
940 5
    this.initialize();
941 5
    return this.innerApiCalls.createGameServerCluster(
942 5
      request,
943 5
      options,
944 5
      callback
945 5
    );
946 5
  }
947 5
  /**
948 5
   * Check the status of the long running operation returned by `createGameServerCluster()`.
949 5
   * @param {String} name
950 5
   *   The operation name that will be passed.
951 5
   * @returns {Promise} - The promise which resolves to an object.
952 5
   *   The decoded operation object has result and metadata field to get information from.
953 5
   *   Please see the
954 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
955 5
   *   for more details and examples.
956 5
   * @example
957 5
   * const decodedOperation = await checkCreateGameServerClusterProgress(name);
958 5
   * console.log(decodedOperation.result);
959 5
   * console.log(decodedOperation.done);
960 5
   * console.log(decodedOperation.metadata);
961 5
   */
962 5
  async checkCreateGameServerClusterProgress(
963 5
    name: string
964 5
  ): Promise<
965 5
    LROperation<
966 5
      protos.google.cloud.gaming.v1beta.GameServerCluster,
967 5
      protos.google.cloud.gaming.v1beta.OperationMetadata
968 5
    >
969 5
  > {
970 5
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
971 5
      {name}
972 5
    );
973 5
    const [operation] = await this.operationsClient.getOperation(request);
974 5
    const decodeOperation = new gax.Operation(
975 5
      operation,
976 5
      this.descriptors.longrunning.createGameServerCluster,
977 5
      gax.createDefaultBackoffSettings()
978 5
    );
979 5
    return decodeOperation as LROperation<
980 5
      protos.google.cloud.gaming.v1beta.GameServerCluster,
981 5
      protos.google.cloud.gaming.v1beta.OperationMetadata
982 5
    >;
983 5
  }
984 5
  deleteGameServerCluster(
985 5
    request: protos.google.cloud.gaming.v1beta.IDeleteGameServerClusterRequest,
986 5
    options?: CallOptions
987 5
  ): Promise<
988 5
    [
989 5
      LROperation<
990 5
        protos.google.protobuf.IEmpty,
991 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
992 5
      >,
993 5
      protos.google.longrunning.IOperation | undefined,
994 5
      {} | undefined
995 5
    ]
996 5
  >;
997 5
  deleteGameServerCluster(
998 5
    request: protos.google.cloud.gaming.v1beta.IDeleteGameServerClusterRequest,
999 5
    options: CallOptions,
1000 5
    callback: Callback<
1001 5
      LROperation<
1002 5
        protos.google.protobuf.IEmpty,
1003 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
1004 5
      >,
1005 5
      protos.google.longrunning.IOperation | null | undefined,
1006 5
      {} | null | undefined
1007 5
    >
1008 5
  ): void;
1009 5
  deleteGameServerCluster(
1010 5
    request: protos.google.cloud.gaming.v1beta.IDeleteGameServerClusterRequest,
1011 5
    callback: Callback<
1012 5
      LROperation<
1013 5
        protos.google.protobuf.IEmpty,
1014 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
1015 5
      >,
1016 5
      protos.google.longrunning.IOperation | null | undefined,
1017 5
      {} | null | undefined
1018 5
    >
1019 5
  ): void;
1020 5
  /**
1021 5
   * Deletes a single game server cluster.
1022 5
   *
1023 5
   * @param {Object} request
1024 5
   *   The request object that will be sent.
1025 5
   * @param {string} request.name
1026 5
   *   Required. The name of the game server cluster to delete. Uses the form:
1027 5
   *   `projects/{project}/locations/{location}/gameServerClusters/{cluster}`.
1028 5
   * @param {object} [options]
1029 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1030 5
   * @returns {Promise} - The promise which resolves to an array.
1031 5
   *   The first element of the array is an object representing
1032 5
   *   a long running operation. Its `promise()` method returns a promise
1033 5
   *   you can `await` for.
1034 5
   *   Please see the
1035 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1036 5
   *   for more details and examples.
1037 5
   * @example
1038 5
   * const [operation] = await client.deleteGameServerCluster(request);
1039 5
   * const [response] = await operation.promise();
1040 5
   */
1041 5
  deleteGameServerCluster(
1042 5
    request: protos.google.cloud.gaming.v1beta.IDeleteGameServerClusterRequest,
1043 5
    optionsOrCallback?:
1044 5
      | CallOptions
1045 5
      | Callback<
1046 5
          LROperation<
1047 5
            protos.google.protobuf.IEmpty,
1048 5
            protos.google.cloud.gaming.v1beta.IOperationMetadata
1049 5
          >,
1050 5
          protos.google.longrunning.IOperation | null | undefined,
1051 5
          {} | null | undefined
1052 5
        >,
1053 5
    callback?: Callback<
1054 5
      LROperation<
1055 5
        protos.google.protobuf.IEmpty,
1056 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
1057 5
      >,
1058 5
      protos.google.longrunning.IOperation | null | undefined,
1059 5
      {} | null | undefined
1060 5
    >
1061 5
  ): Promise<
1062 5
    [
1063 5
      LROperation<
1064 5
        protos.google.protobuf.IEmpty,
1065 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
1066 5
      >,
1067 5
      protos.google.longrunning.IOperation | undefined,
1068 5
      {} | undefined
1069 5
    ]
1070 5
  > | void {
1071 5
    request = request || {};
1072 5
    let options: CallOptions;
1073 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1074 5
      callback = optionsOrCallback;
1075 5
      options = {};
1076 5
    } else {
1077 5
      options = optionsOrCallback as CallOptions;
1078 5
    }
1079 5
    options = options || {};
1080 5
    options.otherArgs = options.otherArgs || {};
1081 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1082 5
    options.otherArgs.headers[
1083 5
      'x-goog-request-params'
1084 5
    ] = gax.routingHeader.fromParams({
1085 5
      name: request.name || '',
1086 5
    });
1087 5
    this.initialize();
1088 5
    return this.innerApiCalls.deleteGameServerCluster(
1089 5
      request,
1090 5
      options,
1091 5
      callback
1092 5
    );
1093 5
  }
1094 5
  /**
1095 5
   * Check the status of the long running operation returned by `deleteGameServerCluster()`.
1096 5
   * @param {String} name
1097 5
   *   The operation name that will be passed.
1098 5
   * @returns {Promise} - The promise which resolves to an object.
1099 5
   *   The decoded operation object has result and metadata field to get information from.
1100 5
   *   Please see the
1101 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1102 5
   *   for more details and examples.
1103 5
   * @example
1104 5
   * const decodedOperation = await checkDeleteGameServerClusterProgress(name);
1105 5
   * console.log(decodedOperation.result);
1106 5
   * console.log(decodedOperation.done);
1107 5
   * console.log(decodedOperation.metadata);
1108 5
   */
1109 5
  async checkDeleteGameServerClusterProgress(
1110 5
    name: string
1111 5
  ): Promise<
1112 5
    LROperation<
1113 5
      protos.google.protobuf.Empty,
1114 5
      protos.google.cloud.gaming.v1beta.OperationMetadata
1115 5
    >
1116 5
  > {
1117 5
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
1118 5
      {name}
1119 5
    );
1120 5
    const [operation] = await this.operationsClient.getOperation(request);
1121 5
    const decodeOperation = new gax.Operation(
1122 5
      operation,
1123 5
      this.descriptors.longrunning.deleteGameServerCluster,
1124 5
      gax.createDefaultBackoffSettings()
1125 5
    );
1126 5
    return decodeOperation as LROperation<
1127 5
      protos.google.protobuf.Empty,
1128 5
      protos.google.cloud.gaming.v1beta.OperationMetadata
1129 5
    >;
1130 5
  }
1131 5
  updateGameServerCluster(
1132 5
    request: protos.google.cloud.gaming.v1beta.IUpdateGameServerClusterRequest,
1133 5
    options?: CallOptions
1134 5
  ): Promise<
1135 5
    [
1136 5
      LROperation<
1137 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
1138 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
1139 5
      >,
1140 5
      protos.google.longrunning.IOperation | undefined,
1141 5
      {} | undefined
1142 5
    ]
1143 5
  >;
1144 5
  updateGameServerCluster(
1145 5
    request: protos.google.cloud.gaming.v1beta.IUpdateGameServerClusterRequest,
1146 5
    options: CallOptions,
1147 5
    callback: Callback<
1148 5
      LROperation<
1149 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
1150 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
1151 5
      >,
1152 5
      protos.google.longrunning.IOperation | null | undefined,
1153 5
      {} | null | undefined
1154 5
    >
1155 5
  ): void;
1156 5
  updateGameServerCluster(
1157 5
    request: protos.google.cloud.gaming.v1beta.IUpdateGameServerClusterRequest,
1158 5
    callback: Callback<
1159 5
      LROperation<
1160 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
1161 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
1162 5
      >,
1163 5
      protos.google.longrunning.IOperation | null | undefined,
1164 5
      {} | null | undefined
1165 5
    >
1166 5
  ): void;
1167 5
  /**
1168 5
   * Patches a single game server cluster.
1169 5
   *
1170 5
   * @param {Object} request
1171 5
   *   The request object that will be sent.
1172 5
   * @param {google.cloud.gaming.v1beta.GameServerCluster} request.gameServerCluster
1173 5
   *   Required. The game server cluster to be updated.
1174 5
   *   Only fields specified in update_mask are updated.
1175 5
   * @param {google.protobuf.FieldMask} request.updateMask
1176 5
   *   Required. Mask of fields to update. At least one path must be supplied in
1177 5
   *   this field. For the `FieldMask` definition, see
1178 5
   *
1179 5
   *   https:
1180 5
   *   //developers.google.com/protocol-buffers
1181 5
   *   // /docs/reference/google.protobuf#fieldmask
1182 5
   * @param {object} [options]
1183 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1184 5
   * @returns {Promise} - The promise which resolves to an array.
1185 5
   *   The first element of the array is an object representing
1186 5
   *   a long running operation. Its `promise()` method returns a promise
1187 5
   *   you can `await` for.
1188 5
   *   Please see the
1189 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1190 5
   *   for more details and examples.
1191 5
   * @example
1192 5
   * const [operation] = await client.updateGameServerCluster(request);
1193 5
   * const [response] = await operation.promise();
1194 5
   */
1195 5
  updateGameServerCluster(
1196 5
    request: protos.google.cloud.gaming.v1beta.IUpdateGameServerClusterRequest,
1197 5
    optionsOrCallback?:
1198 5
      | CallOptions
1199 5
      | Callback<
1200 5
          LROperation<
1201 5
            protos.google.cloud.gaming.v1beta.IGameServerCluster,
1202 5
            protos.google.cloud.gaming.v1beta.IOperationMetadata
1203 5
          >,
1204 5
          protos.google.longrunning.IOperation | null | undefined,
1205 5
          {} | null | undefined
1206 5
        >,
1207 5
    callback?: Callback<
1208 5
      LROperation<
1209 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
1210 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
1211 5
      >,
1212 5
      protos.google.longrunning.IOperation | null | undefined,
1213 5
      {} | null | undefined
1214 5
    >
1215 5
  ): Promise<
1216 5
    [
1217 5
      LROperation<
1218 5
        protos.google.cloud.gaming.v1beta.IGameServerCluster,
1219 5
        protos.google.cloud.gaming.v1beta.IOperationMetadata
1220 5
      >,
1221 5
      protos.google.longrunning.IOperation | undefined,
1222 5
      {} | undefined
1223 5
    ]
1224 5
  > | void {
1225 5
    request = request || {};
1226 5
    let options: CallOptions;
1227 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1228 5
      callback = optionsOrCallback;
1229 5
      options = {};
1230 5
    } else {
1231 5
      options = optionsOrCallback as CallOptions;
1232 5
    }
1233 5
    options = options || {};
1234 5
    options.otherArgs = options.otherArgs || {};
1235 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1236 5
    options.otherArgs.headers[
1237 5
      'x-goog-request-params'
1238 5
    ] = gax.routingHeader.fromParams({
1239 5
      'game_server_cluster.name': request.gameServerCluster!.name || '',
1240 5
    });
1241 5
    this.initialize();
1242 5
    return this.innerApiCalls.updateGameServerCluster(
1243 5
      request,
1244 5
      options,
1245 5
      callback
1246 5
    );
1247 5
  }
1248 5
  /**
1249 5
   * Check the status of the long running operation returned by `updateGameServerCluster()`.
1250 5
   * @param {String} name
1251 5
   *   The operation name that will be passed.
1252 5
   * @returns {Promise} - The promise which resolves to an object.
1253 5
   *   The decoded operation object has result and metadata field to get information from.
1254 5
   *   Please see the
1255 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1256 5
   *   for more details and examples.
1257 5
   * @example
1258 5
   * const decodedOperation = await checkUpdateGameServerClusterProgress(name);
1259 5
   * console.log(decodedOperation.result);
1260 5
   * console.log(decodedOperation.done);
1261 5
   * console.log(decodedOperation.metadata);
1262 5
   */
1263 5
  async checkUpdateGameServerClusterProgress(
1264 5
    name: string
1265 5
  ): Promise<
1266 5
    LROperation<
1267 5
      protos.google.cloud.gaming.v1beta.GameServerCluster,
1268 5
      protos.google.cloud.gaming.v1beta.OperationMetadata
1269 5
    >
1270 5
  > {
1271 5
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
1272 5
      {name}
1273 5
    );
1274 5
    const [operation] = await this.operationsClient.getOperation(request);
1275 5
    const decodeOperation = new gax.Operation(
1276 5
      operation,
1277 5
      this.descriptors.longrunning.updateGameServerCluster,
1278 5
      gax.createDefaultBackoffSettings()
1279 5
    );
1280 5
    return decodeOperation as LROperation<
1281 5
      protos.google.cloud.gaming.v1beta.GameServerCluster,
1282 5
      protos.google.cloud.gaming.v1beta.OperationMetadata
1283 5
    >;
1284 5
  }
1285 5
  listGameServerClusters(
1286 5
    request: protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1287 5
    options?: CallOptions
1288 5
  ): Promise<
1289 5
    [
1290 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster[],
1291 5
      protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest | null,
1292 5
      protos.google.cloud.gaming.v1beta.IListGameServerClustersResponse
1293 5
    ]
1294 5
  >;
1295 5
  listGameServerClusters(
1296 5
    request: protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1297 5
    options: CallOptions,
1298 5
    callback: PaginationCallback<
1299 5
      protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1300 5
      | protos.google.cloud.gaming.v1beta.IListGameServerClustersResponse
1301 5
      | null
1302 5
      | undefined,
1303 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster
1304 5
    >
1305 5
  ): void;
1306 5
  listGameServerClusters(
1307 5
    request: protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1308 5
    callback: PaginationCallback<
1309 5
      protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1310 5
      | protos.google.cloud.gaming.v1beta.IListGameServerClustersResponse
1311 5
      | null
1312 5
      | undefined,
1313 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster
1314 5
    >
1315 5
  ): void;
1316 5
  /**
1317 5
   * Lists game server clusters in a given project and location.
1318 5
   *
1319 5
   * @param {Object} request
1320 5
   *   The request object that will be sent.
1321 5
   * @param {string} request.parent
1322 5
   *   Required. The parent resource name. Uses the form:
1323 5
   *   "projects/{project}/locations/{location}/realms/{realm}".
1324 5
   * @param {number} [request.pageSize]
1325 5
   *   Optional. The maximum number of items to return.  If unspecified, the server
1326 5
   *   will pick an appropriate default. The server may return fewer items than
1327 5
   *   requested. A caller should only rely on response's
1328 5
   *   {@link google.cloud.gaming.v1beta.ListGameServerClustersResponse.next_page_token|next_page_token} to
1329 5
   *   determine if there are more GameServerClusters left to be queried.
1330 5
   * @param {string} [request.pageToken]
1331 5
   *   Optional. The next_page_token value returned from a previous List request, if any.
1332 5
   * @param {string} [request.filter]
1333 5
   *   Optional. The filter to apply to list results.
1334 5
   * @param {string} [request.orderBy]
1335 5
   *   Optional. Specifies the ordering of results following syntax at
1336 5
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1337 5
   * @param {object} [options]
1338 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1339 5
   * @returns {Promise} - The promise which resolves to an array.
1340 5
   *   The first element of the array is Array of [GameServerCluster]{@link google.cloud.gaming.v1beta.GameServerCluster}.
1341 5
   *   The client library will perform auto-pagination by default: it will call the API as many
1342 5
   *   times as needed and will merge results from all the pages into this array.
1343 5
   *   Note that it can affect your quota.
1344 5
   *   We recommend using `listGameServerClustersAsync()`
1345 5
   *   method described below for async iteration which you can stop as needed.
1346 5
   *   Please see the
1347 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1348 5
   *   for more details and examples.
1349 5
   */
1350 5
  listGameServerClusters(
1351 5
    request: protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1352 5
    optionsOrCallback?:
1353 5
      | CallOptions
1354 5
      | PaginationCallback<
1355 5
          protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1356 5
          | protos.google.cloud.gaming.v1beta.IListGameServerClustersResponse
1357 5
          | null
1358 5
          | undefined,
1359 5
          protos.google.cloud.gaming.v1beta.IGameServerCluster
1360 5
        >,
1361 5
    callback?: PaginationCallback<
1362 5
      protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1363 5
      | protos.google.cloud.gaming.v1beta.IListGameServerClustersResponse
1364 5
      | null
1365 5
      | undefined,
1366 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster
1367 5
    >
1368 5
  ): Promise<
1369 5
    [
1370 5
      protos.google.cloud.gaming.v1beta.IGameServerCluster[],
1371 5
      protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest | null,
1372 5
      protos.google.cloud.gaming.v1beta.IListGameServerClustersResponse
1373 5
    ]
1374 5
  > | void {
1375 5
    request = request || {};
1376 5
    let options: CallOptions;
1377 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1378 5
      callback = optionsOrCallback;
1379 5
      options = {};
1380 5
    } else {
1381 5
      options = optionsOrCallback as CallOptions;
1382 5
    }
1383 5
    options = options || {};
1384 5
    options.otherArgs = options.otherArgs || {};
1385 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1386 5
    options.otherArgs.headers[
1387 5
      'x-goog-request-params'
1388 5
    ] = gax.routingHeader.fromParams({
1389 5
      parent: request.parent || '',
1390 5
    });
1391 5
    this.initialize();
1392 5
    return this.innerApiCalls.listGameServerClusters(
1393 5
      request,
1394 5
      options,
1395 5
      callback
1396 5
    );
1397 5
  }
1398 5

1399 5
  /**
1400 5
   * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
1401 5
   * @param {Object} request
1402 5
   *   The request object that will be sent.
1403 5
   * @param {string} request.parent
1404 5
   *   Required. The parent resource name. Uses the form:
1405 5
   *   "projects/{project}/locations/{location}/realms/{realm}".
1406 5
   * @param {number} [request.pageSize]
1407 5
   *   Optional. The maximum number of items to return.  If unspecified, the server
1408 5
   *   will pick an appropriate default. The server may return fewer items than
1409 5
   *   requested. A caller should only rely on response's
1410 5
   *   {@link google.cloud.gaming.v1beta.ListGameServerClustersResponse.next_page_token|next_page_token} to
1411 5
   *   determine if there are more GameServerClusters left to be queried.
1412 5
   * @param {string} [request.pageToken]
1413 5
   *   Optional. The next_page_token value returned from a previous List request, if any.
1414 5
   * @param {string} [request.filter]
1415 5
   *   Optional. The filter to apply to list results.
1416 5
   * @param {string} [request.orderBy]
1417 5
   *   Optional. Specifies the ordering of results following syntax at
1418 5
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1419 5
   * @param {object} [options]
1420 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1421 5
   * @returns {Stream}
1422 5
   *   An object stream which emits an object representing [GameServerCluster]{@link google.cloud.gaming.v1beta.GameServerCluster} on 'data' event.
1423 5
   *   The client library will perform auto-pagination by default: it will call the API as many
1424 5
   *   times as needed. Note that it can affect your quota.
1425 5
   *   We recommend using `listGameServerClustersAsync()`
1426 5
   *   method described below for async iteration which you can stop as needed.
1427 5
   *   Please see the
1428 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1429 5
   *   for more details and examples.
1430 5
   */
1431 5
  listGameServerClustersStream(
1432 5
    request?: protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1433 5
    options?: CallOptions
1434 5
  ): Transform {
1435 5
    request = request || {};
1436 5
    options = options || {};
1437 5
    options.otherArgs = options.otherArgs || {};
1438 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1439 5
    options.otherArgs.headers[
1440 5
      'x-goog-request-params'
1441 5
    ] = gax.routingHeader.fromParams({
1442 5
      parent: request.parent || '',
1443 5
    });
1444 5
    const callSettings = new gax.CallSettings(options);
1445 5
    this.initialize();
1446 5
    return this.descriptors.page.listGameServerClusters.createStream(
1447 5
      this.innerApiCalls.listGameServerClusters as gax.GaxCall,
1448 5
      request,
1449 5
      callSettings
1450 5
    );
1451 5
  }
1452 5

1453 5
  /**
1454 5
   * Equivalent to `listGameServerClusters`, but returns an iterable object.
1455 5
   *
1456 5
   * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1457 5
   * @param {Object} request
1458 5
   *   The request object that will be sent.
1459 5
   * @param {string} request.parent
1460 5
   *   Required. The parent resource name. Uses the form:
1461 5
   *   "projects/{project}/locations/{location}/realms/{realm}".
1462 5
   * @param {number} [request.pageSize]
1463 5
   *   Optional. The maximum number of items to return.  If unspecified, the server
1464 5
   *   will pick an appropriate default. The server may return fewer items than
1465 5
   *   requested. A caller should only rely on response's
1466 5
   *   {@link google.cloud.gaming.v1beta.ListGameServerClustersResponse.next_page_token|next_page_token} to
1467 5
   *   determine if there are more GameServerClusters left to be queried.
1468 5
   * @param {string} [request.pageToken]
1469 5
   *   Optional. The next_page_token value returned from a previous List request, if any.
1470 5
   * @param {string} [request.filter]
1471 5
   *   Optional. The filter to apply to list results.
1472 5
   * @param {string} [request.orderBy]
1473 5
   *   Optional. Specifies the ordering of results following syntax at
1474 5
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1475 5
   * @param {object} [options]
1476 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1477 5
   * @returns {Object}
1478 5
   *   An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
1479 5
   *   When you iterate the returned iterable, each element will be an object representing
1480 5
   *   [GameServerCluster]{@link google.cloud.gaming.v1beta.GameServerCluster}. The API will be called under the hood as needed, once per the page,
1481 5
   *   so you can stop the iteration when you don't need more results.
1482 5
   *   Please see the
1483 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1484 5
   *   for more details and examples.
1485 5
   * @example
1486 5
   * const iterable = client.listGameServerClustersAsync(request);
1487 5
   * for await (const response of iterable) {
1488 5
   *   // process response
1489 5
   * }
1490 5
   */
1491 5
  listGameServerClustersAsync(
1492 5
    request?: protos.google.cloud.gaming.v1beta.IListGameServerClustersRequest,
1493 5
    options?: CallOptions
1494 5
  ): AsyncIterable<protos.google.cloud.gaming.v1beta.IGameServerCluster> {
1495 5
    request = request || {};
1496 5
    options = options || {};
1497 5
    options.otherArgs = options.otherArgs || {};
1498 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1499 5
    options.otherArgs.headers[
1500 5
      'x-goog-request-params'
1501 5
    ] = gax.routingHeader.fromParams({
1502 5
      parent: request.parent || '',
1503 5
    });
1504 5
    options = options || {};
1505 5
    const callSettings = new gax.CallSettings(options);
1506 5
    this.initialize();
1507 5
    return this.descriptors.page.listGameServerClusters.asyncIterate(
1508 5
      this.innerApiCalls['listGameServerClusters'] as GaxCall,
1509 5
      (request as unknown) as RequestType,
1510 5
      callSettings
1511 5
    ) as AsyncIterable<protos.google.cloud.gaming.v1beta.IGameServerCluster>;
1512 5
  }
1513 5
  // --------------------
1514 5
  // -- Path templates --
1515 5
  // --------------------
1516 5

1517 5
  /**
1518 5
   * Return a fully-qualified gameServerCluster resource name string.
1519 5
   *
1520 5
   * @param {string} project
1521 5
   * @param {string} location
1522 5
   * @param {string} realm
1523 5
   * @param {string} cluster
1524 5
   * @returns {string} Resource name string.
1525 5
   */
1526 5
  gameServerClusterPath(
1527 5
    project: string,
1528 5
    location: string,
1529 5
    realm: string,
1530 5
    cluster: string
1531 5
  ) {
1532 5
    return this.pathTemplates.gameServerClusterPathTemplate.render({
1533 5
      project: project,
1534 5
      location: location,
1535 5
      realm: realm,
1536 5
      cluster: cluster,
1537 5
    });
1538 5
  }
1539 5

1540 5
  /**
1541 5
   * Parse the project from GameServerCluster resource.
1542 5
   *
1543 5
   * @param {string} gameServerClusterName
1544 5
   *   A fully-qualified path representing GameServerCluster resource.
1545 5
   * @returns {string} A string representing the project.
1546 5
   */
1547 5
  matchProjectFromGameServerClusterName(gameServerClusterName: string) {
1548 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1549 5
      gameServerClusterName
1550 5
    ).project;
1551 5
  }
1552 5

1553 5
  /**
1554 5
   * Parse the location from GameServerCluster resource.
1555 5
   *
1556 5
   * @param {string} gameServerClusterName
1557 5
   *   A fully-qualified path representing GameServerCluster resource.
1558 5
   * @returns {string} A string representing the location.
1559 5
   */
1560 5
  matchLocationFromGameServerClusterName(gameServerClusterName: string) {
1561 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1562 5
      gameServerClusterName
1563 5
    ).location;
1564 5
  }
1565 5

1566 5
  /**
1567 5
   * Parse the realm from GameServerCluster resource.
1568 5
   *
1569 5
   * @param {string} gameServerClusterName
1570 5
   *   A fully-qualified path representing GameServerCluster resource.
1571 5
   * @returns {string} A string representing the realm.
1572 5
   */
1573 5
  matchRealmFromGameServerClusterName(gameServerClusterName: string) {
1574 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1575 5
      gameServerClusterName
1576 5
    ).realm;
1577 5
  }
1578 5

1579 5
  /**
1580 5
   * Parse the cluster from GameServerCluster resource.
1581 5
   *
1582 5
   * @param {string} gameServerClusterName
1583 5
   *   A fully-qualified path representing GameServerCluster resource.
1584 5
   * @returns {string} A string representing the cluster.
1585 5
   */
1586 5
  matchClusterFromGameServerClusterName(gameServerClusterName: string) {
1587 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1588 5
      gameServerClusterName
1589 5
    ).cluster;
1590 5
  }
1591 5

1592 5
  /**
1593 5
   * Return a fully-qualified gameServerConfig resource name string.
1594 5
   *
1595 5
   * @param {string} project
1596 5
   * @param {string} location
1597 5
   * @param {string} deployment
1598 5
   * @param {string} config
1599 5
   * @returns {string} Resource name string.
1600 5
   */
1601 5
  gameServerConfigPath(
1602 5
    project: string,
1603 5
    location: string,
1604 5
    deployment: string,
1605 5
    config: string
1606 5
  ) {
1607 5
    return this.pathTemplates.gameServerConfigPathTemplate.render({
1608 5
      project: project,
1609 5
      location: location,
1610 5
      deployment: deployment,
1611 5
      config: config,
1612 5
    });
1613 5
  }
1614 5

1615 5
  /**
1616 5
   * Parse the project from GameServerConfig resource.
1617 5
   *
1618 5
   * @param {string} gameServerConfigName
1619 5
   *   A fully-qualified path representing GameServerConfig resource.
1620 5
   * @returns {string} A string representing the project.
1621 5
   */
1622 5
  matchProjectFromGameServerConfigName(gameServerConfigName: string) {
1623 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1624 5
      gameServerConfigName
1625 5
    ).project;
1626 5
  }
1627 5

1628 5
  /**
1629 5
   * Parse the location from GameServerConfig resource.
1630 5
   *
1631 5
   * @param {string} gameServerConfigName
1632 5
   *   A fully-qualified path representing GameServerConfig resource.
1633 5
   * @returns {string} A string representing the location.
1634 5
   */
1635 5
  matchLocationFromGameServerConfigName(gameServerConfigName: string) {
1636 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1637 5
      gameServerConfigName
1638 5
    ).location;
1639 5
  }
1640 5

1641 5
  /**
1642 5
   * Parse the deployment from GameServerConfig resource.
1643 5
   *
1644 5
   * @param {string} gameServerConfigName
1645 5
   *   A fully-qualified path representing GameServerConfig resource.
1646 5
   * @returns {string} A string representing the deployment.
1647 5
   */
1648 5
  matchDeploymentFromGameServerConfigName(gameServerConfigName: string) {
1649 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1650 5
      gameServerConfigName
1651 5
    ).deployment;
1652 5
  }
1653 5

1654 5
  /**
1655 5
   * Parse the config from GameServerConfig resource.
1656 5
   *
1657 5
   * @param {string} gameServerConfigName
1658 5
   *   A fully-qualified path representing GameServerConfig resource.
1659 5
   * @returns {string} A string representing the config.
1660 5
   */
1661 5
  matchConfigFromGameServerConfigName(gameServerConfigName: string) {
1662 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1663 5
      gameServerConfigName
1664 5
    ).config;
1665 5
  }
1666 5

1667 5
  /**
1668 5
   * Return a fully-qualified gameServerDeployment resource name string.
1669 5
   *
1670 5
   * @param {string} project
1671 5
   * @param {string} location
1672 5
   * @param {string} deployment
1673 5
   * @returns {string} Resource name string.
1674 5
   */
1675 5
  gameServerDeploymentPath(
1676 5
    project: string,
1677 5
    location: string,
1678 5
    deployment: string
1679 5
  ) {
1680 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.render({
1681 5
      project: project,
1682 5
      location: location,
1683 5
      deployment: deployment,
1684 5
    });
1685 5
  }
1686 5

1687 5
  /**
1688 5
   * Parse the project from GameServerDeployment resource.
1689 5
   *
1690 5
   * @param {string} gameServerDeploymentName
1691 5
   *   A fully-qualified path representing GameServerDeployment resource.
1692 5
   * @returns {string} A string representing the project.
1693 5
   */
1694 5
  matchProjectFromGameServerDeploymentName(gameServerDeploymentName: string) {
1695 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1696 5
      gameServerDeploymentName
1697 5
    ).project;
1698 5
  }
1699 5

1700 5
  /**
1701 5
   * Parse the location from GameServerDeployment resource.
1702 5
   *
1703 5
   * @param {string} gameServerDeploymentName
1704 5
   *   A fully-qualified path representing GameServerDeployment resource.
1705 5
   * @returns {string} A string representing the location.
1706 5
   */
1707 5
  matchLocationFromGameServerDeploymentName(gameServerDeploymentName: string) {
1708 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1709 5
      gameServerDeploymentName
1710 5
    ).location;
1711 5
  }
1712 5

1713 5
  /**
1714 5
   * Parse the deployment from GameServerDeployment resource.
1715 5
   *
1716 5
   * @param {string} gameServerDeploymentName
1717 5
   *   A fully-qualified path representing GameServerDeployment resource.
1718 5
   * @returns {string} A string representing the deployment.
1719 5
   */
1720 5
  matchDeploymentFromGameServerDeploymentName(
1721 5
    gameServerDeploymentName: string
1722 5
  ) {
1723 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1724 5
      gameServerDeploymentName
1725 5
    ).deployment;
1726 5
  }
1727 5

1728 5
  /**
1729 5
   * Return a fully-qualified gameServerDeploymentRollout resource name string.
1730 5
   *
1731 5
   * @param {string} project
1732 5
   * @param {string} location
1733 5
   * @param {string} deployment
1734 5
   * @returns {string} Resource name string.
1735 5
   */
1736 5
  gameServerDeploymentRolloutPath(
1737 5
    project: string,
1738 5
    location: string,
1739 5
    deployment: string
1740 5
  ) {
1741 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.render({
1742 5
      project: project,
1743 5
      location: location,
1744 5
      deployment: deployment,
1745 5
    });
1746 5
  }
1747 5

1748 5
  /**
1749 5
   * Parse the project from GameServerDeploymentRollout resource.
1750 5
   *
1751 5
   * @param {string} gameServerDeploymentRolloutName
1752 5
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1753 5
   * @returns {string} A string representing the project.
1754 5
   */
1755 5
  matchProjectFromGameServerDeploymentRolloutName(
1756 5
    gameServerDeploymentRolloutName: string
1757 5
  ) {
1758 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1759 5
      gameServerDeploymentRolloutName
1760 5
    ).project;
1761 5
  }
1762 5

1763 5
  /**
1764 5
   * Parse the location from GameServerDeploymentRollout resource.
1765 5
   *
1766 5
   * @param {string} gameServerDeploymentRolloutName
1767 5
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1768 5
   * @returns {string} A string representing the location.
1769 5
   */
1770 5
  matchLocationFromGameServerDeploymentRolloutName(
1771 5
    gameServerDeploymentRolloutName: string
1772 5
  ) {
1773 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1774 5
      gameServerDeploymentRolloutName
1775 5
    ).location;
1776 5
  }
1777 5

1778 5
  /**
1779 5
   * Parse the deployment from GameServerDeploymentRollout resource.
1780 5
   *
1781 5
   * @param {string} gameServerDeploymentRolloutName
1782 5
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1783 5
   * @returns {string} A string representing the deployment.
1784 5
   */
1785 5
  matchDeploymentFromGameServerDeploymentRolloutName(
1786 5
    gameServerDeploymentRolloutName: string
1787 5
  ) {
1788 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1789 5
      gameServerDeploymentRolloutName
1790 5
    ).deployment;
1791 5
  }
1792 5

1793 5
  /**
1794 5
   * Return a fully-qualified realm resource name string.
1795 5
   *
1796 5
   * @param {string} project
1797 5
   * @param {string} location
1798 5
   * @param {string} realm
1799 5
   * @returns {string} Resource name string.
1800 5
   */
1801 5
  realmPath(project: string, location: string, realm: string) {
1802 5
    return this.pathTemplates.realmPathTemplate.render({
1803 5
      project: project,
1804 5
      location: location,
1805 5
      realm: realm,
1806 5
    });
1807 5
  }
1808 5

1809 5
  /**
1810 5
   * Parse the project from Realm resource.
1811 5
   *
1812 5
   * @param {string} realmName
1813 5
   *   A fully-qualified path representing Realm resource.
1814 5
   * @returns {string} A string representing the project.
1815 5
   */
1816 5
  matchProjectFromRealmName(realmName: string) {
1817 5
    return this.pathTemplates.realmPathTemplate.match(realmName).project;
1818 5
  }
1819 5

1820 5
  /**
1821 5
   * Parse the location from Realm resource.
1822 5
   *
1823 5
   * @param {string} realmName
1824 5
   *   A fully-qualified path representing Realm resource.
1825 5
   * @returns {string} A string representing the location.
1826 5
   */
1827 5
  matchLocationFromRealmName(realmName: string) {
1828 5
    return this.pathTemplates.realmPathTemplate.match(realmName).location;
1829 5
  }
1830 5

1831 5
  /**
1832 5
   * Parse the realm from Realm resource.
1833 5
   *
1834 5
   * @param {string} realmName
1835 5
   *   A fully-qualified path representing Realm resource.
1836 5
   * @returns {string} A string representing the realm.
1837 5
   */
1838 5
  matchRealmFromRealmName(realmName: string) {
1839 5
    return this.pathTemplates.realmPathTemplate.match(realmName).realm;
1840 5
  }
1841 5

1842 5
  /**
1843 5
   * Terminate the gRPC channel and close the client.
1844 5
   *
1845 5
   * The client will no longer be usable and all future behavior is undefined.
1846 5
   * @returns {Promise} A promise that resolves when the client is closed.
1847 5
   */
1848 5
  close(): Promise<void> {
1849 5
    this.initialize();
1850 5
    if (!this._terminated) {
1851 5
      return this.gameServerClustersServiceStub!.then(stub => {
1852 5
        this._terminated = true;
1853 5
        stub.close();
1854 5
      });
1855 5
    }
1856 5
    return Promise.resolve();
1857 0
  }
1858 5
}

Read our documentation on viewing source code .

Loading