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
import * as gax from 'google-gax';
20 5
import {
21 5
  Callback,
22 5
  CallOptions,
23 5
  Descriptors,
24 5
  ClientOptions,
25 5
  LROperation,
26 5
  PaginationCallback,
27 5
  GaxCall,
28 5
} from 'google-gax';
29 5
import * as path from 'path';
30 5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

318 5
      this.innerApiCalls[methodName] = apiCall;
319 5
    }
320 5

321 5
    return this.gameServerConfigsServiceStub;
322 5
  }
323 5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Read our documentation on viewing source code .

Loading