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

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

31 4
import {Transform} from 'stream';
32 4
import {RequestType} from 'google-gax/build/src/apitypes';
33 4
import * as protos from '../../protos/protos';
34 4
import * as gapicConfig from './game_server_configs_service_client_config.json';
35 4
import {operationsProtos} from 'google-gax';
36 4
const version = require('../../../package.json').version;
37 4

38 4
/**
39 4
 *  The game server config configures the game servers in an Agones fleet.
40 4
 * @class
41 4
 * @memberof v1beta
42 4
 */
43 4
export class GameServerConfigsServiceClient {
44 4
  private _terminated = false;
45 4
  private _opts: ClientOptions;
46 4
  private _gaxModule: typeof gax | typeof gax.fallback;
47 4
  private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
48 4
  private _protos: {};
49 4
  private _defaults: {[method: string]: gax.CallSettings};
50 4
  auth: gax.GoogleAuth;
51 4
  descriptors: Descriptors = {
52 4
    page: {},
53 4
    stream: {},
54 4
    longrunning: {},
55 4
    batching: {},
56 4
  };
57 4
  innerApiCalls: {[name: string]: Function};
58 4
  pathTemplates: {[name: string]: gax.PathTemplate};
59 4
  operationsClient: gax.OperationsClient;
60 4
  gameServerConfigsServiceStub?: Promise<{[name: string]: Function}>;
61 4

62 4
  /**
63 4
   * Construct an instance of GameServerConfigsServiceClient.
64 4
   *
65 4
   * @param {object} [options] - The configuration object. See the subsequent
66 4
   *   parameters for more details.
67 4
   * @param {object} [options.credentials] - Credentials object.
68 4
   * @param {string} [options.credentials.client_email]
69 4
   * @param {string} [options.credentials.private_key]
70 4
   * @param {string} [options.email] - Account email address. Required when
71 4
   *     using a .pem or .p12 keyFilename.
72 4
   * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
73 4
   *     .p12 key downloaded from the Google Developers Console. If you provide
74 4
   *     a path to a JSON file, the projectId option below is not necessary.
75 4
   *     NOTE: .pem and .p12 require you to specify options.email as well.
76 4
   * @param {number} [options.port] - The port on which to connect to
77 4
   *     the remote host.
78 4
   * @param {string} [options.projectId] - The project ID from the Google
79 4
   *     Developer's Console, e.g. 'grape-spaceship-123'. We will also check
80 4
   *     the environment variable GCLOUD_PROJECT for your project ID. If your
81 4
   *     app is running in an environment which supports
82 4
   *     {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
83 4
   *     your project ID will be detected automatically.
84 4
   * @param {string} [options.apiEndpoint] - The domain name of the
85 4
   *     API remote host.
86 4
   */
87 4

88 4
  constructor(opts?: ClientOptions) {
89 4
    // Ensure that options include the service address and port.
90 4
    const staticMembers = this
91 4
      .constructor as typeof GameServerConfigsServiceClient;
92 4
    const servicePath =
93 4
      opts && opts.servicePath
94 4
        ? opts.servicePath
95 4
        : opts && opts.apiEndpoint
96 4
        ? opts.apiEndpoint
97 4
        : staticMembers.servicePath;
98 4
    const port = opts && opts.port ? opts.port : staticMembers.port;
99 4

100 4
    if (!opts) {
101 4
      opts = {servicePath, port};
102 4
    }
103 4
    opts.servicePath = opts.servicePath || servicePath;
104 4
    opts.port = opts.port || port;
105 4

106 4
    // users can override the config from client side, like retry codes name.
107 4
    // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546
108 4
    // The way to override client config for Showcase API:
109 4
    //
110 4
    // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}}
111 4
    // const showcaseClient = new showcaseClient({ projectId, customConfig });
112 4
    opts.clientConfig = opts.clientConfig || {};
113 4

114 4
    // If we're running in browser, it's OK to omit `fallback` since
115 4
    // google-gax has `browser` field in its `package.json`.
116 4
    // For Electron (which does not respect `browser` field),
117 4
    // pass `{fallback: true}` to the GameServerConfigsServiceClient constructor.
118 4
    this._gaxModule = opts.fallback ? gax.fallback : gax;
119 4

120 4
    // Create a `gaxGrpc` object, with any grpc-specific options
121 4
    // sent to the client.
122 4
    opts.scopes = (this
123 4
      .constructor as typeof GameServerConfigsServiceClient).scopes;
124 4
    this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
125 4

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

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

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

149 4
    const nodejsProtoPath = path.join(
150 4
      __dirname,
151 4
      '..',
152 4
      '..',
153 4
      'protos',
154 4
      'protos.json'
155 4
    );
156 4
    this._protos = this._gaxGrpc.loadProto(
157 4
      opts.fallback
158 4
        ? // eslint-disable-next-line @typescript-eslint/no-var-requires
159 4
          require('../../protos/protos.json')
160 4
        : nodejsProtoPath
161 4
    );
162 4

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

184 4
    // Some of the methods on this service return "paged" results,
185 4
    // (e.g. 50 results at a time, with tokens to get subsequent
186 4
    // pages). Denote the keys used for pagination and results.
187 4
    this.descriptors.page = {
188 4
      listGameServerConfigs: new this._gaxModule.PageDescriptor(
189 4
        'pageToken',
190 4
        'nextPageToken',
191 4
        'gameServerConfigs'
192 4
      ),
193 4
    };
194 4

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

205 4
    this.operationsClient = this._gaxModule
206 4
      .lro({
207 4
        auth: this.auth,
208 4
        grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
209 4
      })
210 4
      .operationsClient(opts);
211 4
    const createGameServerConfigResponse = protoFilesRoot.lookup(
212 4
      '.google.cloud.gaming.v1beta.GameServerConfig'
213 4
    ) as gax.protobuf.Type;
214 4
    const createGameServerConfigMetadata = protoFilesRoot.lookup(
215 4
      '.google.cloud.gaming.v1beta.OperationMetadata'
216 4
    ) as gax.protobuf.Type;
217 4
    const deleteGameServerConfigResponse = protoFilesRoot.lookup(
218 4
      '.google.protobuf.Empty'
219 4
    ) as gax.protobuf.Type;
220 4
    const deleteGameServerConfigMetadata = protoFilesRoot.lookup(
221 4
      '.google.cloud.gaming.v1beta.OperationMetadata'
222 4
    ) as gax.protobuf.Type;
223 4

224 4
    this.descriptors.longrunning = {
225 4
      createGameServerConfig: new this._gaxModule.LongrunningDescriptor(
226 4
        this.operationsClient,
227 4
        createGameServerConfigResponse.decode.bind(
228 4
          createGameServerConfigResponse
229 4
        ),
230 4
        createGameServerConfigMetadata.decode.bind(
231 4
          createGameServerConfigMetadata
232 4
        )
233 4
      ),
234 4
      deleteGameServerConfig: new this._gaxModule.LongrunningDescriptor(
235 4
        this.operationsClient,
236 4
        deleteGameServerConfigResponse.decode.bind(
237 4
          deleteGameServerConfigResponse
238 4
        ),
239 4
        deleteGameServerConfigMetadata.decode.bind(
240 4
          deleteGameServerConfigMetadata
241 4
        )
242 4
      ),
243 4
    };
244 4

245 4
    // Put together the default options sent with requests.
246 4
    this._defaults = this._gaxGrpc.constructSettings(
247 4
      'google.cloud.gaming.v1beta.GameServerConfigsService',
248 4
      gapicConfig as gax.ClientConfig,
249 4
      opts.clientConfig || {},
250 4
      {'x-goog-api-client': clientHeader.join(' ')}
251 4
    );
252 4

253 4
    // Set up a dictionary of "inner API calls"; the core implementation
254 4
    // of calling the API is handled in `google-gax`, with this code
255 4
    // merely providing the destination and request information.
256 4
    this.innerApiCalls = {};
257 4
  }
258 4

259 4
  /**
260 4
   * Initialize the client.
261 4
   * Performs asynchronous operations (such as authentication) and prepares the client.
262 4
   * This function will be called automatically when any class method is called for the
263 4
   * first time, but if you need to initialize it before calling an actual method,
264 4
   * feel free to call initialize() directly.
265 4
   *
266 4
   * You can await on this method if you want to make sure the client is initialized.
267 4
   *
268 4
   * @returns {Promise} A promise that resolves to an authenticated service stub.
269 4
   */
270 4
  initialize() {
271 4
    // If the client stub promise is already initialized, return immediately.
272 4
    if (this.gameServerConfigsServiceStub) {
273 4
      return this.gameServerConfigsServiceStub;
274 4
    }
275 4

276 4
    // Put together the "service stub" for
277 4
    // google.cloud.gaming.v1beta.GameServerConfigsService.
278 4
    this.gameServerConfigsServiceStub = this._gaxGrpc.createStub(
279 4
      this._opts.fallback
280 4
        ? (this._protos as protobuf.Root).lookupService(
281 0
            'google.cloud.gaming.v1beta.GameServerConfigsService'
282 4
          )
283 4
        : // eslint-disable-next-line @typescript-eslint/no-explicit-any
284 4
          (this._protos as any).google.cloud.gaming.v1beta
285 4
            .GameServerConfigsService,
286 4
      this._opts
287 4
    ) as Promise<{[method: string]: Function}>;
288 4

289 4
    // Iterate over each of the methods that the service provides
290 4
    // and create an API call method for each.
291 4
    const gameServerConfigsServiceStubMethods = [
292 4
      'listGameServerConfigs',
293 4
      'getGameServerConfig',
294 4
      'createGameServerConfig',
295 4
      'deleteGameServerConfig',
296 4
    ];
297 4
    for (const methodName of gameServerConfigsServiceStubMethods) {
298 4
      const callPromise = this.gameServerConfigsServiceStub.then(
299 4
        stub => (...args: Array<{}>) => {
300 0
          if (this._terminated) {
301 0
            return Promise.reject('The client has already been closed.');
302 0
          }
303 0
          const func = stub[methodName];
304 0
          return func.apply(stub, args);
305 4
        },
306 4
        (err: Error | null | undefined) => () => {
307 0
          throw err;
308 0
        }
309 4
      );
310 4

311 4
      const apiCall = this._gaxModule.createApiCall(
312 4
        callPromise,
313 4
        this._defaults[methodName],
314 4
        this.descriptors.page[methodName] ||
315 4
          this.descriptors.stream[methodName] ||
316 4
          this.descriptors.longrunning[methodName]
317 4
      );
318 4

319 4
      this.innerApiCalls[methodName] = apiCall;
320 4
    }
321 4

322 4
    return this.gameServerConfigsServiceStub;
323 4
  }
324 4

325 4
  /**
326 4
   * The DNS address for this API service.
327 4
   */
328 4
  static get servicePath() {
329 4
    return 'gameservices.googleapis.com';
330 4
  }
331 4

332 4
  /**
333 4
   * The DNS address for this API service - same as servicePath(),
334 4
   * exists for compatibility reasons.
335 4
   */
336 4
  static get apiEndpoint() {
337 4
    return 'gameservices.googleapis.com';
338 4
  }
339 4

340 4
  /**
341 4
   * The port for this API service.
342 4
   */
343 4
  static get port() {
344 4
    return 443;
345 4
  }
346 4

347 4
  /**
348 4
   * The scopes needed to make gRPC calls for every method defined
349 4
   * in this service.
350 4
   */
351 4
  static get scopes() {
352 4
    return ['https://www.googleapis.com/auth/cloud-platform'];
353 4
  }
354 4

355 4
  getProjectId(): Promise<string>;
356 4
  getProjectId(callback: Callback<string, undefined, undefined>): void;
357 4
  /**
358 4
   * Return the project ID used by this class.
359 4
   * @param {function(Error, string)} callback - the callback to
360 4
   *   be called with the current project Id.
361 4
   */
362 4
  getProjectId(
363 4
    callback?: Callback<string, undefined, undefined>
364 4
  ): Promise<string> | void {
365 4
    if (callback) {
366 4
      this.auth.getProjectId(callback);
367 4
      return;
368 4
    }
369 4
    return this.auth.getProjectId();
370 4
  }
371 4

372 4
  // -------------------
373 4
  // -- Service calls --
374 4
  // -------------------
375 4
  getGameServerConfig(
376 4
    request: protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest,
377 4
    options?: gax.CallOptions
378 4
  ): Promise<
379 4
    [
380 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig,
381 4
      protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest | undefined,
382 4
      {} | undefined
383 4
    ]
384 4
  >;
385 4
  getGameServerConfig(
386 4
    request: protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest,
387 4
    options: gax.CallOptions,
388 4
    callback: Callback<
389 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig,
390 4
      | protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest
391 4
      | null
392 4
      | undefined,
393 4
      {} | null | undefined
394 4
    >
395 4
  ): void;
396 4
  getGameServerConfig(
397 4
    request: protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest,
398 4
    callback: Callback<
399 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig,
400 4
      | protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest
401 4
      | null
402 4
      | undefined,
403 4
      {} | null | undefined
404 4
    >
405 4
  ): void;
406 4
  /**
407 4
   * Gets details of a single game server config.
408 4
   *
409 4
   * @param {Object} request
410 4
   *   The request object that will be sent.
411 4
   * @param {string} request.name
412 4
   *   Required. The name of the game server config to retrieve. Uses the form:
413 4
   *
414 4
   *   `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`.
415 4
   * @param {object} [options]
416 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
417 4
   * @returns {Promise} - The promise which resolves to an array.
418 4
   *   The first element of the array is an object representing [GameServerConfig]{@link google.cloud.gaming.v1beta.GameServerConfig}.
419 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
420 4
   */
421 4
  getGameServerConfig(
422 4
    request: protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest,
423 4
    optionsOrCallback?:
424 4
      | gax.CallOptions
425 4
      | Callback<
426 4
          protos.google.cloud.gaming.v1beta.IGameServerConfig,
427 4
          | protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest
428 4
          | null
429 4
          | undefined,
430 4
          {} | null | undefined
431 4
        >,
432 4
    callback?: Callback<
433 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig,
434 4
      | protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest
435 4
      | null
436 4
      | undefined,
437 4
      {} | null | undefined
438 4
    >
439 4
  ): Promise<
440 4
    [
441 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig,
442 4
      protos.google.cloud.gaming.v1beta.IGetGameServerConfigRequest | undefined,
443 4
      {} | undefined
444 4
    ]
445 4
  > | void {
446 4
    request = request || {};
447 4
    let options: gax.CallOptions;
448 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
449 4
      callback = optionsOrCallback;
450 4
      options = {};
451 4
    } else {
452 4
      options = optionsOrCallback as gax.CallOptions;
453 4
    }
454 4
    options = options || {};
455 4
    options.otherArgs = options.otherArgs || {};
456 4
    options.otherArgs.headers = options.otherArgs.headers || {};
457 4
    options.otherArgs.headers[
458 4
      'x-goog-request-params'
459 4
    ] = gax.routingHeader.fromParams({
460 4
      name: request.name || '',
461 4
    });
462 4
    this.initialize();
463 4
    return this.innerApiCalls.getGameServerConfig(request, options, callback);
464 4
  }
465 4

466 4
  createGameServerConfig(
467 4
    request: protos.google.cloud.gaming.v1beta.ICreateGameServerConfigRequest,
468 4
    options?: gax.CallOptions
469 4
  ): Promise<
470 4
    [
471 4
      LROperation<
472 4
        protos.google.cloud.gaming.v1beta.IGameServerConfig,
473 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
474 4
      >,
475 4
      protos.google.longrunning.IOperation | undefined,
476 4
      {} | undefined
477 4
    ]
478 4
  >;
479 4
  createGameServerConfig(
480 4
    request: protos.google.cloud.gaming.v1beta.ICreateGameServerConfigRequest,
481 4
    options: gax.CallOptions,
482 4
    callback: Callback<
483 4
      LROperation<
484 4
        protos.google.cloud.gaming.v1beta.IGameServerConfig,
485 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
486 4
      >,
487 4
      protos.google.longrunning.IOperation | null | undefined,
488 4
      {} | null | undefined
489 4
    >
490 4
  ): void;
491 4
  createGameServerConfig(
492 4
    request: protos.google.cloud.gaming.v1beta.ICreateGameServerConfigRequest,
493 4
    callback: Callback<
494 4
      LROperation<
495 4
        protos.google.cloud.gaming.v1beta.IGameServerConfig,
496 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
497 4
      >,
498 4
      protos.google.longrunning.IOperation | null | undefined,
499 4
      {} | null | undefined
500 4
    >
501 4
  ): void;
502 4
  /**
503 4
   * Creates a new game server config in a given project, location, and game
504 4
   * server deployment. Game server configs are immutable, and are not applied
505 4
   * until referenced in the game server deployment rollout resource.
506 4
   *
507 4
   * @param {Object} request
508 4
   *   The request object that will be sent.
509 4
   * @param {string} request.parent
510 4
   *   Required. The parent resource name. Uses the form:
511 4
   *
512 4
   *   `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/`.
513 4
   * @param {string} request.configId
514 4
   *   Required. The ID of the game server config resource to be created.
515 4
   * @param {google.cloud.gaming.v1beta.GameServerConfig} request.gameServerConfig
516 4
   *   Required. The game server config resource to be created.
517 4
   * @param {object} [options]
518 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
519 4
   * @returns {Promise} - The promise which resolves to an array.
520 4
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
521 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
522 4
   */
523 4
  createGameServerConfig(
524 4
    request: protos.google.cloud.gaming.v1beta.ICreateGameServerConfigRequest,
525 4
    optionsOrCallback?:
526 4
      | gax.CallOptions
527 4
      | Callback<
528 4
          LROperation<
529 4
            protos.google.cloud.gaming.v1beta.IGameServerConfig,
530 4
            protos.google.cloud.gaming.v1beta.IOperationMetadata
531 4
          >,
532 4
          protos.google.longrunning.IOperation | null | undefined,
533 4
          {} | null | undefined
534 4
        >,
535 4
    callback?: Callback<
536 4
      LROperation<
537 4
        protos.google.cloud.gaming.v1beta.IGameServerConfig,
538 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
539 4
      >,
540 4
      protos.google.longrunning.IOperation | null | undefined,
541 4
      {} | null | undefined
542 4
    >
543 4
  ): Promise<
544 4
    [
545 4
      LROperation<
546 4
        protos.google.cloud.gaming.v1beta.IGameServerConfig,
547 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
548 4
      >,
549 4
      protos.google.longrunning.IOperation | undefined,
550 4
      {} | undefined
551 4
    ]
552 4
  > | void {
553 4
    request = request || {};
554 4
    let options: gax.CallOptions;
555 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
556 4
      callback = optionsOrCallback;
557 4
      options = {};
558 4
    } else {
559 4
      options = optionsOrCallback as gax.CallOptions;
560 4
    }
561 4
    options = options || {};
562 4
    options.otherArgs = options.otherArgs || {};
563 4
    options.otherArgs.headers = options.otherArgs.headers || {};
564 4
    options.otherArgs.headers[
565 4
      'x-goog-request-params'
566 4
    ] = gax.routingHeader.fromParams({
567 4
      parent: request.parent || '',
568 4
    });
569 4
    this.initialize();
570 4
    return this.innerApiCalls.createGameServerConfig(
571 4
      request,
572 4
      options,
573 4
      callback
574 4
    );
575 4
  }
576 4
  /**
577 4
   * Check the status of the long running operation returned by the createGameServerConfig() method.
578 4
   * @param {String} name
579 4
   *   The operation name that will be passed.
580 4
   * @returns {Promise} - The promise which resolves to an object.
581 4
   *   The decoded operation object has result and metadata field to get information from.
582 4
   *
583 4
   * @example:
584 4
   *   const decodedOperation = await checkCreateGameServerConfigProgress(name);
585 4
   *   console.log(decodedOperation.result);
586 4
   *   console.log(decodedOperation.done);
587 4
   *   console.log(decodedOperation.metadata);
588 4
   *
589 4
   */
590 4
  async checkCreateGameServerConfigProgress(
591 4
    name: string
592 4
  ): Promise<
593 4
    LROperation<
594 4
      protos.google.cloud.gaming.v1beta.GameServerConfig,
595 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
596 4
    >
597 4
  > {
598 4
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
599 4
      {name}
600 4
    );
601 4
    const [operation] = await this.operationsClient.getOperation(request);
602 4
    const decodeOperation = new gax.Operation(
603 4
      operation,
604 4
      this.descriptors.longrunning.createGameServerConfig,
605 4
      gax.createDefaultBackoffSettings()
606 4
    );
607 4
    return decodeOperation as LROperation<
608 4
      protos.google.cloud.gaming.v1beta.GameServerConfig,
609 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
610 4
    >;
611 1
  }
612 4
  deleteGameServerConfig(
613 4
    request: protos.google.cloud.gaming.v1beta.IDeleteGameServerConfigRequest,
614 4
    options?: gax.CallOptions
615 4
  ): Promise<
616 4
    [
617 4
      LROperation<
618 4
        protos.google.protobuf.IEmpty,
619 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
620 4
      >,
621 4
      protos.google.longrunning.IOperation | undefined,
622 4
      {} | undefined
623 4
    ]
624 4
  >;
625 4
  deleteGameServerConfig(
626 4
    request: protos.google.cloud.gaming.v1beta.IDeleteGameServerConfigRequest,
627 4
    options: gax.CallOptions,
628 4
    callback: Callback<
629 4
      LROperation<
630 4
        protos.google.protobuf.IEmpty,
631 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
632 4
      >,
633 4
      protos.google.longrunning.IOperation | null | undefined,
634 4
      {} | null | undefined
635 4
    >
636 4
  ): void;
637 4
  deleteGameServerConfig(
638 4
    request: protos.google.cloud.gaming.v1beta.IDeleteGameServerConfigRequest,
639 4
    callback: Callback<
640 4
      LROperation<
641 4
        protos.google.protobuf.IEmpty,
642 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
643 4
      >,
644 4
      protos.google.longrunning.IOperation | null | undefined,
645 4
      {} | null | undefined
646 4
    >
647 4
  ): void;
648 4
  /**
649 4
   * Deletes a single game server config. The deletion will fail if the game
650 4
   * server config is referenced in a game server deployment rollout.
651 4
   *
652 4
   * @param {Object} request
653 4
   *   The request object that will be sent.
654 4
   * @param {string} request.name
655 4
   *   Required. The name of the game server config to delete. Uses the form:
656 4
   *
657 4
   *   `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`.
658 4
   * @param {object} [options]
659 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
660 4
   * @returns {Promise} - The promise which resolves to an array.
661 4
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
662 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
663 4
   */
664 4
  deleteGameServerConfig(
665 4
    request: protos.google.cloud.gaming.v1beta.IDeleteGameServerConfigRequest,
666 4
    optionsOrCallback?:
667 4
      | gax.CallOptions
668 4
      | Callback<
669 4
          LROperation<
670 4
            protos.google.protobuf.IEmpty,
671 4
            protos.google.cloud.gaming.v1beta.IOperationMetadata
672 4
          >,
673 4
          protos.google.longrunning.IOperation | null | undefined,
674 4
          {} | null | undefined
675 4
        >,
676 4
    callback?: Callback<
677 4
      LROperation<
678 4
        protos.google.protobuf.IEmpty,
679 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
680 4
      >,
681 4
      protos.google.longrunning.IOperation | null | undefined,
682 4
      {} | null | undefined
683 4
    >
684 4
  ): Promise<
685 4
    [
686 4
      LROperation<
687 4
        protos.google.protobuf.IEmpty,
688 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
689 4
      >,
690 4
      protos.google.longrunning.IOperation | undefined,
691 4
      {} | undefined
692 4
    ]
693 4
  > | void {
694 4
    request = request || {};
695 4
    let options: gax.CallOptions;
696 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
697 4
      callback = optionsOrCallback;
698 4
      options = {};
699 4
    } else {
700 4
      options = optionsOrCallback as gax.CallOptions;
701 4
    }
702 4
    options = options || {};
703 4
    options.otherArgs = options.otherArgs || {};
704 4
    options.otherArgs.headers = options.otherArgs.headers || {};
705 4
    options.otherArgs.headers[
706 4
      'x-goog-request-params'
707 4
    ] = gax.routingHeader.fromParams({
708 4
      name: request.name || '',
709 4
    });
710 4
    this.initialize();
711 4
    return this.innerApiCalls.deleteGameServerConfig(
712 4
      request,
713 4
      options,
714 4
      callback
715 4
    );
716 4
  }
717 4
  /**
718 4
   * Check the status of the long running operation returned by the deleteGameServerConfig() method.
719 4
   * @param {String} name
720 4
   *   The operation name that will be passed.
721 4
   * @returns {Promise} - The promise which resolves to an object.
722 4
   *   The decoded operation object has result and metadata field to get information from.
723 4
   *
724 4
   * @example:
725 4
   *   const decodedOperation = await checkDeleteGameServerConfigProgress(name);
726 4
   *   console.log(decodedOperation.result);
727 4
   *   console.log(decodedOperation.done);
728 4
   *   console.log(decodedOperation.metadata);
729 4
   *
730 4
   */
731 4
  async checkDeleteGameServerConfigProgress(
732 4
    name: string
733 4
  ): Promise<
734 4
    LROperation<
735 4
      protos.google.protobuf.Empty,
736 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
737 4
    >
738 4
  > {
739 4
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
740 4
      {name}
741 4
    );
742 4
    const [operation] = await this.operationsClient.getOperation(request);
743 4
    const decodeOperation = new gax.Operation(
744 4
      operation,
745 4
      this.descriptors.longrunning.deleteGameServerConfig,
746 4
      gax.createDefaultBackoffSettings()
747 4
    );
748 4
    return decodeOperation as LROperation<
749 4
      protos.google.protobuf.Empty,
750 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
751 4
    >;
752 1
  }
753 4
  listGameServerConfigs(
754 4
    request: protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
755 4
    options?: gax.CallOptions
756 4
  ): Promise<
757 4
    [
758 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig[],
759 4
      protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest | null,
760 4
      protos.google.cloud.gaming.v1beta.IListGameServerConfigsResponse
761 4
    ]
762 4
  >;
763 4
  listGameServerConfigs(
764 4
    request: protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
765 4
    options: gax.CallOptions,
766 4
    callback: PaginationCallback<
767 4
      protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
768 4
      | protos.google.cloud.gaming.v1beta.IListGameServerConfigsResponse
769 4
      | null
770 4
      | undefined,
771 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig
772 4
    >
773 4
  ): void;
774 4
  listGameServerConfigs(
775 4
    request: protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
776 4
    callback: PaginationCallback<
777 4
      protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
778 4
      | protos.google.cloud.gaming.v1beta.IListGameServerConfigsResponse
779 4
      | null
780 4
      | undefined,
781 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig
782 4
    >
783 4
  ): void;
784 4
  /**
785 4
   * Lists game server configs in a given project, location, and game server
786 4
   * deployment.
787 4
   *
788 4
   * @param {Object} request
789 4
   *   The request object that will be sent.
790 4
   * @param {string} request.parent
791 4
   *   Required. The parent resource name. Uses the form:
792 4
   *
793 4
   *   `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/*`.
794 4
   * @param {number} [request.pageSize]
795 4
   *   Optional. The maximum number of items to return.  If unspecified, server
796 4
   *   will pick an appropriate default. Server may return fewer items than
797 4
   *   requested. A caller should only rely on response's
798 4
   *   {@link google.cloud.gaming.v1beta.ListGameServerConfigsResponse.next_page_token|next_page_token} to
799 4
   *   determine if there are more GameServerConfigs left to be queried.
800 4
   * @param {string} [request.pageToken]
801 4
   *   Optional. The next_page_token value returned from a previous list request, if any.
802 4
   * @param {string} [request.filter]
803 4
   *   Optional. The filter to apply to list results.
804 4
   * @param {string} [request.orderBy]
805 4
   *   Optional. Specifies the ordering of results following syntax at
806 4
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
807 4
   * @param {object} [options]
808 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
809 4
   * @returns {Promise} - The promise which resolves to an array.
810 4
   *   The first element of the array is Array of [GameServerConfig]{@link google.cloud.gaming.v1beta.GameServerConfig}.
811 4
   *   The client library support auto-pagination by default: it will call the API as many
812 4
   *   times as needed and will merge results from all the pages into this array.
813 4
   *
814 4
   *   When autoPaginate: false is specified through options, the array has three elements.
815 4
   *   The first element is Array of [GameServerConfig]{@link google.cloud.gaming.v1beta.GameServerConfig} that corresponds to
816 4
   *   the one page received from the API server.
817 4
   *   If the second element is not null it contains the request object of type [ListGameServerConfigsRequest]{@link google.cloud.gaming.v1beta.ListGameServerConfigsRequest}
818 4
   *   that can be used to obtain the next page of the results.
819 4
   *   If it is null, the next page does not exist.
820 4
   *   The third element contains the raw response received from the API server. Its type is
821 4
   *   [ListGameServerConfigsResponse]{@link google.cloud.gaming.v1beta.ListGameServerConfigsResponse}.
822 4
   *
823 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
824 4
   */
825 4
  listGameServerConfigs(
826 4
    request: protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
827 4
    optionsOrCallback?:
828 4
      | gax.CallOptions
829 4
      | PaginationCallback<
830 4
          protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
831 4
          | protos.google.cloud.gaming.v1beta.IListGameServerConfigsResponse
832 4
          | null
833 4
          | undefined,
834 4
          protos.google.cloud.gaming.v1beta.IGameServerConfig
835 4
        >,
836 4
    callback?: PaginationCallback<
837 4
      protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
838 4
      | protos.google.cloud.gaming.v1beta.IListGameServerConfigsResponse
839 4
      | null
840 4
      | undefined,
841 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig
842 4
    >
843 4
  ): Promise<
844 4
    [
845 4
      protos.google.cloud.gaming.v1beta.IGameServerConfig[],
846 4
      protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest | null,
847 4
      protos.google.cloud.gaming.v1beta.IListGameServerConfigsResponse
848 4
    ]
849 4
  > | void {
850 4
    request = request || {};
851 4
    let options: gax.CallOptions;
852 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
853 4
      callback = optionsOrCallback;
854 4
      options = {};
855 4
    } else {
856 4
      options = optionsOrCallback as gax.CallOptions;
857 4
    }
858 4
    options = options || {};
859 4
    options.otherArgs = options.otherArgs || {};
860 4
    options.otherArgs.headers = options.otherArgs.headers || {};
861 4
    options.otherArgs.headers[
862 4
      'x-goog-request-params'
863 4
    ] = gax.routingHeader.fromParams({
864 4
      parent: request.parent || '',
865 4
    });
866 4
    this.initialize();
867 4
    return this.innerApiCalls.listGameServerConfigs(request, options, callback);
868 4
  }
869 4

870 4
  /**
871 4
   * Equivalent to {@link listGameServerConfigs}, but returns a NodeJS Stream object.
872 4
   *
873 4
   * This fetches the paged responses for {@link listGameServerConfigs} continuously
874 4
   * and invokes the callback registered for 'data' event for each element in the
875 4
   * responses.
876 4
   *
877 4
   * The returned object has 'end' method when no more elements are required.
878 4
   *
879 4
   * autoPaginate option will be ignored.
880 4
   *
881 4
   * @see {@link https://nodejs.org/api/stream.html}
882 4
   *
883 4
   * @param {Object} request
884 4
   *   The request object that will be sent.
885 4
   * @param {string} request.parent
886 4
   *   Required. The parent resource name. Uses the form:
887 4
   *
888 4
   *   `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/*`.
889 4
   * @param {number} [request.pageSize]
890 4
   *   Optional. The maximum number of items to return.  If unspecified, server
891 4
   *   will pick an appropriate default. Server may return fewer items than
892 4
   *   requested. A caller should only rely on response's
893 4
   *   {@link google.cloud.gaming.v1beta.ListGameServerConfigsResponse.next_page_token|next_page_token} to
894 4
   *   determine if there are more GameServerConfigs left to be queried.
895 4
   * @param {string} [request.pageToken]
896 4
   *   Optional. The next_page_token value returned from a previous list request, if any.
897 4
   * @param {string} [request.filter]
898 4
   *   Optional. The filter to apply to list results.
899 4
   * @param {string} [request.orderBy]
900 4
   *   Optional. Specifies the ordering of results following syntax at
901 4
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
902 4
   * @param {object} [options]
903 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
904 4
   * @returns {Stream}
905 4
   *   An object stream which emits an object representing [GameServerConfig]{@link google.cloud.gaming.v1beta.GameServerConfig} on 'data' event.
906 4
   */
907 4
  listGameServerConfigsStream(
908 4
    request?: protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
909 4
    options?: gax.CallOptions
910 4
  ): Transform {
911 4
    request = request || {};
912 4
    options = options || {};
913 4
    options.otherArgs = options.otherArgs || {};
914 4
    options.otherArgs.headers = options.otherArgs.headers || {};
915 4
    options.otherArgs.headers[
916 4
      'x-goog-request-params'
917 4
    ] = gax.routingHeader.fromParams({
918 4
      parent: request.parent || '',
919 4
    });
920 4
    const callSettings = new gax.CallSettings(options);
921 4
    this.initialize();
922 4
    return this.descriptors.page.listGameServerConfigs.createStream(
923 4
      this.innerApiCalls.listGameServerConfigs as gax.GaxCall,
924 4
      request,
925 4
      callSettings
926 4
    );
927 4
  }
928 4

929 4
  /**
930 4
   * Equivalent to {@link listGameServerConfigs}, but returns an iterable object.
931 4
   *
932 4
   * for-await-of syntax is used with the iterable to recursively get response element on-demand.
933 4
   *
934 4
   * @param {Object} request
935 4
   *   The request object that will be sent.
936 4
   * @param {string} request.parent
937 4
   *   Required. The parent resource name. Uses the form:
938 4
   *
939 4
   *   `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/*`.
940 4
   * @param {number} [request.pageSize]
941 4
   *   Optional. The maximum number of items to return.  If unspecified, server
942 4
   *   will pick an appropriate default. Server may return fewer items than
943 4
   *   requested. A caller should only rely on response's
944 4
   *   {@link google.cloud.gaming.v1beta.ListGameServerConfigsResponse.next_page_token|next_page_token} to
945 4
   *   determine if there are more GameServerConfigs left to be queried.
946 4
   * @param {string} [request.pageToken]
947 4
   *   Optional. The next_page_token value returned from a previous list request, if any.
948 4
   * @param {string} [request.filter]
949 4
   *   Optional. The filter to apply to list results.
950 4
   * @param {string} [request.orderBy]
951 4
   *   Optional. Specifies the ordering of results following syntax at
952 4
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
953 4
   * @param {object} [options]
954 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
955 4
   * @returns {Object}
956 4
   *   An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.
957 4
   */
958 4
  listGameServerConfigsAsync(
959 4
    request?: protos.google.cloud.gaming.v1beta.IListGameServerConfigsRequest,
960 4
    options?: gax.CallOptions
961 4
  ): AsyncIterable<protos.google.cloud.gaming.v1beta.IGameServerConfig> {
962 4
    request = request || {};
963 4
    options = options || {};
964 4
    options.otherArgs = options.otherArgs || {};
965 4
    options.otherArgs.headers = options.otherArgs.headers || {};
966 4
    options.otherArgs.headers[
967 4
      'x-goog-request-params'
968 4
    ] = gax.routingHeader.fromParams({
969 4
      parent: request.parent || '',
970 4
    });
971 4
    options = options || {};
972 4
    const callSettings = new gax.CallSettings(options);
973 4
    this.initialize();
974 4
    return this.descriptors.page.listGameServerConfigs.asyncIterate(
975 4
      this.innerApiCalls['listGameServerConfigs'] as GaxCall,
976 4
      (request as unknown) as RequestType,
977 4
      callSettings
978 4
    ) as AsyncIterable<protos.google.cloud.gaming.v1beta.IGameServerConfig>;
979 4
  }
980 4
  // --------------------
981 4
  // -- Path templates --
982 4
  // --------------------
983 4

984 4
  /**
985 4
   * Return a fully-qualified gameServerCluster resource name string.
986 4
   *
987 4
   * @param {string} project
988 4
   * @param {string} location
989 4
   * @param {string} realm
990 4
   * @param {string} cluster
991 4
   * @returns {string} Resource name string.
992 4
   */
993 4
  gameServerClusterPath(
994 4
    project: string,
995 4
    location: string,
996 4
    realm: string,
997 4
    cluster: string
998 4
  ) {
999 4
    return this.pathTemplates.gameServerClusterPathTemplate.render({
1000 4
      project: project,
1001 4
      location: location,
1002 4
      realm: realm,
1003 4
      cluster: cluster,
1004 4
    });
1005 4
  }
1006 4

1007 4
  /**
1008 4
   * Parse the project from GameServerCluster resource.
1009 4
   *
1010 4
   * @param {string} gameServerClusterName
1011 4
   *   A fully-qualified path representing GameServerCluster resource.
1012 4
   * @returns {string} A string representing the project.
1013 4
   */
1014 4
  matchProjectFromGameServerClusterName(gameServerClusterName: string) {
1015 4
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1016 4
      gameServerClusterName
1017 4
    ).project;
1018 4
  }
1019 4

1020 4
  /**
1021 4
   * Parse the location from GameServerCluster resource.
1022 4
   *
1023 4
   * @param {string} gameServerClusterName
1024 4
   *   A fully-qualified path representing GameServerCluster resource.
1025 4
   * @returns {string} A string representing the location.
1026 4
   */
1027 4
  matchLocationFromGameServerClusterName(gameServerClusterName: string) {
1028 4
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1029 4
      gameServerClusterName
1030 4
    ).location;
1031 4
  }
1032 4

1033 4
  /**
1034 4
   * Parse the realm from GameServerCluster resource.
1035 4
   *
1036 4
   * @param {string} gameServerClusterName
1037 4
   *   A fully-qualified path representing GameServerCluster resource.
1038 4
   * @returns {string} A string representing the realm.
1039 4
   */
1040 4
  matchRealmFromGameServerClusterName(gameServerClusterName: string) {
1041 4
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1042 4
      gameServerClusterName
1043 4
    ).realm;
1044 4
  }
1045 4

1046 4
  /**
1047 4
   * Parse the cluster from GameServerCluster resource.
1048 4
   *
1049 4
   * @param {string} gameServerClusterName
1050 4
   *   A fully-qualified path representing GameServerCluster resource.
1051 4
   * @returns {string} A string representing the cluster.
1052 4
   */
1053 4
  matchClusterFromGameServerClusterName(gameServerClusterName: string) {
1054 4
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1055 4
      gameServerClusterName
1056 4
    ).cluster;
1057 4
  }
1058 4

1059 4
  /**
1060 4
   * Return a fully-qualified gameServerConfig resource name string.
1061 4
   *
1062 4
   * @param {string} project
1063 4
   * @param {string} location
1064 4
   * @param {string} deployment
1065 4
   * @param {string} config
1066 4
   * @returns {string} Resource name string.
1067 4
   */
1068 4
  gameServerConfigPath(
1069 4
    project: string,
1070 4
    location: string,
1071 4
    deployment: string,
1072 4
    config: string
1073 4
  ) {
1074 4
    return this.pathTemplates.gameServerConfigPathTemplate.render({
1075 4
      project: project,
1076 4
      location: location,
1077 4
      deployment: deployment,
1078 4
      config: config,
1079 4
    });
1080 4
  }
1081 4

1082 4
  /**
1083 4
   * Parse the project from GameServerConfig resource.
1084 4
   *
1085 4
   * @param {string} gameServerConfigName
1086 4
   *   A fully-qualified path representing GameServerConfig resource.
1087 4
   * @returns {string} A string representing the project.
1088 4
   */
1089 4
  matchProjectFromGameServerConfigName(gameServerConfigName: string) {
1090 4
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1091 4
      gameServerConfigName
1092 4
    ).project;
1093 4
  }
1094 4

1095 4
  /**
1096 4
   * Parse the location from GameServerConfig resource.
1097 4
   *
1098 4
   * @param {string} gameServerConfigName
1099 4
   *   A fully-qualified path representing GameServerConfig resource.
1100 4
   * @returns {string} A string representing the location.
1101 4
   */
1102 4
  matchLocationFromGameServerConfigName(gameServerConfigName: string) {
1103 4
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1104 4
      gameServerConfigName
1105 4
    ).location;
1106 4
  }
1107 4

1108 4
  /**
1109 4
   * Parse the deployment from GameServerConfig resource.
1110 4
   *
1111 4
   * @param {string} gameServerConfigName
1112 4
   *   A fully-qualified path representing GameServerConfig resource.
1113 4
   * @returns {string} A string representing the deployment.
1114 4
   */
1115 4
  matchDeploymentFromGameServerConfigName(gameServerConfigName: string) {
1116 4
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1117 4
      gameServerConfigName
1118 4
    ).deployment;
1119 4
  }
1120 4

1121 4
  /**
1122 4
   * Parse the config from GameServerConfig resource.
1123 4
   *
1124 4
   * @param {string} gameServerConfigName
1125 4
   *   A fully-qualified path representing GameServerConfig resource.
1126 4
   * @returns {string} A string representing the config.
1127 4
   */
1128 4
  matchConfigFromGameServerConfigName(gameServerConfigName: string) {
1129 4
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1130 4
      gameServerConfigName
1131 4
    ).config;
1132 4
  }
1133 4

1134 4
  /**
1135 4
   * Return a fully-qualified gameServerDeployment resource name string.
1136 4
   *
1137 4
   * @param {string} project
1138 4
   * @param {string} location
1139 4
   * @param {string} deployment
1140 4
   * @returns {string} Resource name string.
1141 4
   */
1142 4
  gameServerDeploymentPath(
1143 4
    project: string,
1144 4
    location: string,
1145 4
    deployment: string
1146 4
  ) {
1147 4
    return this.pathTemplates.gameServerDeploymentPathTemplate.render({
1148 4
      project: project,
1149 4
      location: location,
1150 4
      deployment: deployment,
1151 4
    });
1152 4
  }
1153 4

1154 4
  /**
1155 4
   * Parse the project from GameServerDeployment resource.
1156 4
   *
1157 4
   * @param {string} gameServerDeploymentName
1158 4
   *   A fully-qualified path representing GameServerDeployment resource.
1159 4
   * @returns {string} A string representing the project.
1160 4
   */
1161 4
  matchProjectFromGameServerDeploymentName(gameServerDeploymentName: string) {
1162 4
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1163 4
      gameServerDeploymentName
1164 4
    ).project;
1165 4
  }
1166 4

1167 4
  /**
1168 4
   * Parse the location from GameServerDeployment resource.
1169 4
   *
1170 4
   * @param {string} gameServerDeploymentName
1171 4
   *   A fully-qualified path representing GameServerDeployment resource.
1172 4
   * @returns {string} A string representing the location.
1173 4
   */
1174 4
  matchLocationFromGameServerDeploymentName(gameServerDeploymentName: string) {
1175 4
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1176 4
      gameServerDeploymentName
1177 4
    ).location;
1178 4
  }
1179 4

1180 4
  /**
1181 4
   * Parse the deployment from GameServerDeployment resource.
1182 4
   *
1183 4
   * @param {string} gameServerDeploymentName
1184 4
   *   A fully-qualified path representing GameServerDeployment resource.
1185 4
   * @returns {string} A string representing the deployment.
1186 4
   */
1187 4
  matchDeploymentFromGameServerDeploymentName(
1188 4
    gameServerDeploymentName: string
1189 4
  ) {
1190 4
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1191 4
      gameServerDeploymentName
1192 4
    ).deployment;
1193 4
  }
1194 4

1195 4
  /**
1196 4
   * Return a fully-qualified gameServerDeploymentRollout resource name string.
1197 4
   *
1198 4
   * @param {string} project
1199 4
   * @param {string} location
1200 4
   * @param {string} deployment
1201 4
   * @returns {string} Resource name string.
1202 4
   */
1203 4
  gameServerDeploymentRolloutPath(
1204 4
    project: string,
1205 4
    location: string,
1206 4
    deployment: string
1207 4
  ) {
1208 4
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.render({
1209 4
      project: project,
1210 4
      location: location,
1211 4
      deployment: deployment,
1212 4
    });
1213 4
  }
1214 4

1215 4
  /**
1216 4
   * Parse the project from GameServerDeploymentRollout resource.
1217 4
   *
1218 4
   * @param {string} gameServerDeploymentRolloutName
1219 4
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1220 4
   * @returns {string} A string representing the project.
1221 4
   */
1222 4
  matchProjectFromGameServerDeploymentRolloutName(
1223 4
    gameServerDeploymentRolloutName: string
1224 4
  ) {
1225 4
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1226 4
      gameServerDeploymentRolloutName
1227 4
    ).project;
1228 4
  }
1229 4

1230 4
  /**
1231 4
   * Parse the location from GameServerDeploymentRollout resource.
1232 4
   *
1233 4
   * @param {string} gameServerDeploymentRolloutName
1234 4
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1235 4
   * @returns {string} A string representing the location.
1236 4
   */
1237 4
  matchLocationFromGameServerDeploymentRolloutName(
1238 4
    gameServerDeploymentRolloutName: string
1239 4
  ) {
1240 4
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1241 4
      gameServerDeploymentRolloutName
1242 4
    ).location;
1243 4
  }
1244 4

1245 4
  /**
1246 4
   * Parse the deployment from GameServerDeploymentRollout resource.
1247 4
   *
1248 4
   * @param {string} gameServerDeploymentRolloutName
1249 4
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1250 4
   * @returns {string} A string representing the deployment.
1251 4
   */
1252 4
  matchDeploymentFromGameServerDeploymentRolloutName(
1253 4
    gameServerDeploymentRolloutName: string
1254 4
  ) {
1255 4
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1256 4
      gameServerDeploymentRolloutName
1257 4
    ).deployment;
1258 4
  }
1259 4

1260 4
  /**
1261 4
   * Return a fully-qualified realm resource name string.
1262 4
   *
1263 4
   * @param {string} project
1264 4
   * @param {string} location
1265 4
   * @param {string} realm
1266 4
   * @returns {string} Resource name string.
1267 4
   */
1268 4
  realmPath(project: string, location: string, realm: string) {
1269 4
    return this.pathTemplates.realmPathTemplate.render({
1270 4
      project: project,
1271 4
      location: location,
1272 4
      realm: realm,
1273 4
    });
1274 4
  }
1275 4

1276 4
  /**
1277 4
   * Parse the project from Realm resource.
1278 4
   *
1279 4
   * @param {string} realmName
1280 4
   *   A fully-qualified path representing Realm resource.
1281 4
   * @returns {string} A string representing the project.
1282 4
   */
1283 4
  matchProjectFromRealmName(realmName: string) {
1284 4
    return this.pathTemplates.realmPathTemplate.match(realmName).project;
1285 4
  }
1286 4

1287 4
  /**
1288 4
   * Parse the location from Realm resource.
1289 4
   *
1290 4
   * @param {string} realmName
1291 4
   *   A fully-qualified path representing Realm resource.
1292 4
   * @returns {string} A string representing the location.
1293 4
   */
1294 4
  matchLocationFromRealmName(realmName: string) {
1295 4
    return this.pathTemplates.realmPathTemplate.match(realmName).location;
1296 4
  }
1297 4

1298 4
  /**
1299 4
   * Parse the realm from Realm resource.
1300 4
   *
1301 4
   * @param {string} realmName
1302 4
   *   A fully-qualified path representing Realm resource.
1303 4
   * @returns {string} A string representing the realm.
1304 4
   */
1305 4
  matchRealmFromRealmName(realmName: string) {
1306 4
    return this.pathTemplates.realmPathTemplate.match(realmName).realm;
1307 4
  }
1308 4

1309 4
  /**
1310 4
   * Terminate the GRPC channel and close the client.
1311 4
   *
1312 4
   * The client will no longer be usable and all future behavior is undefined.
1313 4
   */
1314 4
  close(): Promise<void> {
1315 4
    this.initialize();
1316 4
    if (!this._terminated) {
1317 4
      return this.gameServerConfigsServiceStub!.then(stub => {
1318 4
        this._terminated = true;
1319 4
        stub.close();
1320 4
      });
1321 4
    }
1322 0
    return Promise.resolve();
1323 0
  }
1324 4
}

Read our documentation on viewing source code .

Loading