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 './realms_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
 *  A realm is a grouping of game server clusters that are considered
40 5
 *  interchangeable.
41 5
 * @class
42 5
 * @memberof v1
43 5
 */
44 5
export class RealmsServiceClient {
45 5
  private _terminated = false;
46 5
  private _opts: ClientOptions;
47 5
  private _gaxModule: typeof gax | typeof gax.fallback;
48 5
  private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
49 5
  private _protos: {};
50 5
  private _defaults: {[method: string]: gax.CallSettings};
51 5
  auth: gax.GoogleAuth;
52 5
  descriptors: Descriptors = {
53 5
    page: {},
54 5
    stream: {},
55 5
    longrunning: {},
56 5
    batching: {},
57 5
  };
58 5
  innerApiCalls: {[name: string]: Function};
59 5
  pathTemplates: {[name: string]: gax.PathTemplate};
60 5
  operationsClient: gax.OperationsClient;
61 5
  realmsServiceStub?: Promise<{[name: string]: Function}>;
62 5

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

89 5
  constructor(opts?: ClientOptions) {
90 5
    // Ensure that options include the service address and port.
91 5
    const staticMembers = this.constructor as typeof RealmsServiceClient;
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 RealmsServiceClient 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.constructor as typeof RealmsServiceClient).scopes;
123 5
    this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
124 5

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

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

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

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

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

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

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

204 5
    this.operationsClient = this._gaxModule
205 5
      .lro({
206 5
        auth: this.auth,
207 5
        grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
208 5
      })
209 5
      .operationsClient(opts);
210 5
    const createRealmResponse = protoFilesRoot.lookup(
211 5
      '.google.cloud.gaming.v1.Realm'
212 5
    ) as gax.protobuf.Type;
213 5
    const createRealmMetadata = protoFilesRoot.lookup(
214 5
      '.google.cloud.gaming.v1.OperationMetadata'
215 5
    ) as gax.protobuf.Type;
216 5
    const deleteRealmResponse = protoFilesRoot.lookup(
217 5
      '.google.protobuf.Empty'
218 5
    ) as gax.protobuf.Type;
219 5
    const deleteRealmMetadata = protoFilesRoot.lookup(
220 5
      '.google.cloud.gaming.v1.OperationMetadata'
221 5
    ) as gax.protobuf.Type;
222 5
    const updateRealmResponse = protoFilesRoot.lookup(
223 5
      '.google.cloud.gaming.v1.Realm'
224 5
    ) as gax.protobuf.Type;
225 5
    const updateRealmMetadata = protoFilesRoot.lookup(
226 5
      '.google.cloud.gaming.v1.OperationMetadata'
227 5
    ) as gax.protobuf.Type;
228 5

229 5
    this.descriptors.longrunning = {
230 5
      createRealm: new this._gaxModule.LongrunningDescriptor(
231 5
        this.operationsClient,
232 5
        createRealmResponse.decode.bind(createRealmResponse),
233 5
        createRealmMetadata.decode.bind(createRealmMetadata)
234 5
      ),
235 5
      deleteRealm: new this._gaxModule.LongrunningDescriptor(
236 5
        this.operationsClient,
237 5
        deleteRealmResponse.decode.bind(deleteRealmResponse),
238 5
        deleteRealmMetadata.decode.bind(deleteRealmMetadata)
239 5
      ),
240 5
      updateRealm: new this._gaxModule.LongrunningDescriptor(
241 5
        this.operationsClient,
242 5
        updateRealmResponse.decode.bind(updateRealmResponse),
243 5
        updateRealmMetadata.decode.bind(updateRealmMetadata)
244 5
      ),
245 5
    };
246 5

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

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

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

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

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

314 5
      const apiCall = this._gaxModule.createApiCall(
315 5
        callPromise,
316 5
        this._defaults[methodName],
317 5
        this.descriptors.page[methodName] ||
318 5
          this.descriptors.stream[methodName] ||
319 5
          this.descriptors.longrunning[methodName]
320 5
      );
321 5

322 5
      this.innerApiCalls[methodName] = apiCall;
323 5
    }
324 5

325 5
    return this.realmsServiceStub;
326 5
  }
327 5

328 5
  /**
329 5
   * The DNS address for this API service.
330 5
   */
331 5
  static get servicePath() {
332 5
    return 'gameservices.googleapis.com';
333 5
  }
334 5

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

343 5
  /**
344 5
   * The port for this API service.
345 5
   */
346 5
  static get port() {
347 5
    return 443;
348 5
  }
349 5

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

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

375 5
  // -------------------
376 5
  // -- Service calls --
377 5
  // -------------------
378 5
  getRealm(
379 5
    request: protos.google.cloud.gaming.v1.IGetRealmRequest,
380 5
    options?: gax.CallOptions
381 5
  ): Promise<
382 5
    [
383 5
      protos.google.cloud.gaming.v1.IRealm,
384 5
      protos.google.cloud.gaming.v1.IGetRealmRequest | undefined,
385 5
      {} | undefined
386 5
    ]
387 5
  >;
388 5
  getRealm(
389 5
    request: protos.google.cloud.gaming.v1.IGetRealmRequest,
390 5
    options: gax.CallOptions,
391 5
    callback: Callback<
392 5
      protos.google.cloud.gaming.v1.IRealm,
393 5
      protos.google.cloud.gaming.v1.IGetRealmRequest | null | undefined,
394 5
      {} | null | undefined
395 5
    >
396 5
  ): void;
397 5
  getRealm(
398 5
    request: protos.google.cloud.gaming.v1.IGetRealmRequest,
399 5
    callback: Callback<
400 5
      protos.google.cloud.gaming.v1.IRealm,
401 5
      protos.google.cloud.gaming.v1.IGetRealmRequest | null | undefined,
402 5
      {} | null | undefined
403 5
    >
404 5
  ): void;
405 5
  /**
406 5
   * Gets details of a single realm.
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 realm to retrieve. Uses the form:
412 5
   *   `projects/{project}/locations/{location}/realms/{realm}`.
413 5
   * @param {object} [options]
414 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
415 5
   * @returns {Promise} - The promise which resolves to an array.
416 5
   *   The first element of the array is an object representing [Realm]{@link google.cloud.gaming.v1.Realm}.
417 5
   *   The promise has a method named "cancel" which cancels the ongoing API call.
418 5
   */
419 5
  getRealm(
420 5
    request: protos.google.cloud.gaming.v1.IGetRealmRequest,
421 5
    optionsOrCallback?:
422 5
      | gax.CallOptions
423 5
      | Callback<
424 5
          protos.google.cloud.gaming.v1.IRealm,
425 5
          protos.google.cloud.gaming.v1.IGetRealmRequest | null | undefined,
426 5
          {} | null | undefined
427 5
        >,
428 5
    callback?: Callback<
429 5
      protos.google.cloud.gaming.v1.IRealm,
430 5
      protos.google.cloud.gaming.v1.IGetRealmRequest | null | undefined,
431 5
      {} | null | undefined
432 5
    >
433 5
  ): Promise<
434 5
    [
435 5
      protos.google.cloud.gaming.v1.IRealm,
436 5
      protos.google.cloud.gaming.v1.IGetRealmRequest | undefined,
437 5
      {} | undefined
438 5
    ]
439 5
  > | void {
440 5
    request = request || {};
441 5
    let options: gax.CallOptions;
442 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
443 5
      callback = optionsOrCallback;
444 5
      options = {};
445 5
    } else {
446 5
      options = optionsOrCallback as gax.CallOptions;
447 5
    }
448 5
    options = options || {};
449 5
    options.otherArgs = options.otherArgs || {};
450 5
    options.otherArgs.headers = options.otherArgs.headers || {};
451 5
    options.otherArgs.headers[
452 5
      'x-goog-request-params'
453 5
    ] = gax.routingHeader.fromParams({
454 5
      name: request.name || '',
455 5
    });
456 5
    this.initialize();
457 5
    return this.innerApiCalls.getRealm(request, options, callback);
458 5
  }
459 5
  previewRealmUpdate(
460 5
    request: protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest,
461 5
    options?: gax.CallOptions
462 5
  ): Promise<
463 5
    [
464 5
      protos.google.cloud.gaming.v1.IPreviewRealmUpdateResponse,
465 5
      protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest | undefined,
466 5
      {} | undefined
467 5
    ]
468 5
  >;
469 5
  previewRealmUpdate(
470 5
    request: protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest,
471 5
    options: gax.CallOptions,
472 5
    callback: Callback<
473 5
      protos.google.cloud.gaming.v1.IPreviewRealmUpdateResponse,
474 5
      | protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest
475 5
      | null
476 5
      | undefined,
477 5
      {} | null | undefined
478 5
    >
479 5
  ): void;
480 5
  previewRealmUpdate(
481 5
    request: protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest,
482 5
    callback: Callback<
483 5
      protos.google.cloud.gaming.v1.IPreviewRealmUpdateResponse,
484 5
      | protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest
485 5
      | null
486 5
      | undefined,
487 5
      {} | null | undefined
488 5
    >
489 5
  ): void;
490 5
  /**
491 5
   * Previews patches to a single realm.
492 5
   *
493 5
   * @param {Object} request
494 5
   *   The request object that will be sent.
495 5
   * @param {google.cloud.gaming.v1.Realm} request.realm
496 5
   *   Required. The realm to be updated.
497 5
   *   Only fields specified in update_mask are updated.
498 5
   * @param {google.protobuf.FieldMask} request.updateMask
499 5
   *   Required. The update mask applies to the resource. For the `FieldMask`
500 5
   *   definition, see
501 5
   *
502 5
   *   https:
503 5
   *   //developers.google.com/protocol-buffers
504 5
   *   // /docs/reference/google.protobuf#fieldmask
505 5
   * @param {google.protobuf.Timestamp} [request.previewTime]
506 5
   *   Optional. The target timestamp to compute the preview.
507 5
   * @param {object} [options]
508 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
509 5
   * @returns {Promise} - The promise which resolves to an array.
510 5
   *   The first element of the array is an object representing [PreviewRealmUpdateResponse]{@link google.cloud.gaming.v1.PreviewRealmUpdateResponse}.
511 5
   *   The promise has a method named "cancel" which cancels the ongoing API call.
512 5
   */
513 5
  previewRealmUpdate(
514 5
    request: protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest,
515 5
    optionsOrCallback?:
516 5
      | gax.CallOptions
517 5
      | Callback<
518 5
          protos.google.cloud.gaming.v1.IPreviewRealmUpdateResponse,
519 5
          | protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest
520 5
          | null
521 5
          | undefined,
522 5
          {} | null | undefined
523 5
        >,
524 5
    callback?: Callback<
525 5
      protos.google.cloud.gaming.v1.IPreviewRealmUpdateResponse,
526 5
      | protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest
527 5
      | null
528 5
      | undefined,
529 5
      {} | null | undefined
530 5
    >
531 5
  ): Promise<
532 5
    [
533 5
      protos.google.cloud.gaming.v1.IPreviewRealmUpdateResponse,
534 5
      protos.google.cloud.gaming.v1.IPreviewRealmUpdateRequest | undefined,
535 5
      {} | undefined
536 5
    ]
537 5
  > | void {
538 5
    request = request || {};
539 5
    let options: gax.CallOptions;
540 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
541 5
      callback = optionsOrCallback;
542 5
      options = {};
543 5
    } else {
544 5
      options = optionsOrCallback as gax.CallOptions;
545 5
    }
546 5
    options = options || {};
547 5
    options.otherArgs = options.otherArgs || {};
548 5
    options.otherArgs.headers = options.otherArgs.headers || {};
549 5
    options.otherArgs.headers[
550 5
      'x-goog-request-params'
551 5
    ] = gax.routingHeader.fromParams({
552 5
      'realm.name': request.realm!.name || '',
553 5
    });
554 5
    this.initialize();
555 5
    return this.innerApiCalls.previewRealmUpdate(request, options, callback);
556 5
  }
557 5

558 5
  createRealm(
559 5
    request: protos.google.cloud.gaming.v1.ICreateRealmRequest,
560 5
    options?: gax.CallOptions
561 5
  ): Promise<
562 5
    [
563 5
      LROperation<
564 5
        protos.google.cloud.gaming.v1.IRealm,
565 5
        protos.google.cloud.gaming.v1.IOperationMetadata
566 5
      >,
567 5
      protos.google.longrunning.IOperation | undefined,
568 5
      {} | undefined
569 5
    ]
570 5
  >;
571 5
  createRealm(
572 5
    request: protos.google.cloud.gaming.v1.ICreateRealmRequest,
573 5
    options: gax.CallOptions,
574 5
    callback: Callback<
575 5
      LROperation<
576 5
        protos.google.cloud.gaming.v1.IRealm,
577 5
        protos.google.cloud.gaming.v1.IOperationMetadata
578 5
      >,
579 5
      protos.google.longrunning.IOperation | null | undefined,
580 5
      {} | null | undefined
581 5
    >
582 5
  ): void;
583 5
  createRealm(
584 5
    request: protos.google.cloud.gaming.v1.ICreateRealmRequest,
585 5
    callback: Callback<
586 5
      LROperation<
587 5
        protos.google.cloud.gaming.v1.IRealm,
588 5
        protos.google.cloud.gaming.v1.IOperationMetadata
589 5
      >,
590 5
      protos.google.longrunning.IOperation | null | undefined,
591 5
      {} | null | undefined
592 5
    >
593 5
  ): void;
594 5
  /**
595 5
   * Creates a new realm in a given project and location.
596 5
   *
597 5
   * @param {Object} request
598 5
   *   The request object that will be sent.
599 5
   * @param {string} request.parent
600 5
   *   Required. The parent resource name. Uses the form:
601 5
   *   `projects/{project}/locations/{location}`.
602 5
   * @param {string} request.realmId
603 5
   *   Required. The ID of the realm resource to be created.
604 5
   * @param {google.cloud.gaming.v1.Realm} request.realm
605 5
   *   Required. The realm resource to be created.
606 5
   * @param {object} [options]
607 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
608 5
   * @returns {Promise} - The promise which resolves to an array.
609 5
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
610 5
   *   The promise has a method named "cancel" which cancels the ongoing API call.
611 5
   */
612 5
  createRealm(
613 5
    request: protos.google.cloud.gaming.v1.ICreateRealmRequest,
614 5
    optionsOrCallback?:
615 5
      | gax.CallOptions
616 5
      | Callback<
617 5
          LROperation<
618 5
            protos.google.cloud.gaming.v1.IRealm,
619 5
            protos.google.cloud.gaming.v1.IOperationMetadata
620 5
          >,
621 5
          protos.google.longrunning.IOperation | null | undefined,
622 5
          {} | null | undefined
623 5
        >,
624 5
    callback?: Callback<
625 5
      LROperation<
626 5
        protos.google.cloud.gaming.v1.IRealm,
627 5
        protos.google.cloud.gaming.v1.IOperationMetadata
628 5
      >,
629 5
      protos.google.longrunning.IOperation | null | undefined,
630 5
      {} | null | undefined
631 5
    >
632 5
  ): Promise<
633 5
    [
634 5
      LROperation<
635 5
        protos.google.cloud.gaming.v1.IRealm,
636 5
        protos.google.cloud.gaming.v1.IOperationMetadata
637 5
      >,
638 5
      protos.google.longrunning.IOperation | undefined,
639 5
      {} | undefined
640 5
    ]
641 5
  > | void {
642 5
    request = request || {};
643 5
    let options: gax.CallOptions;
644 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
645 5
      callback = optionsOrCallback;
646 5
      options = {};
647 5
    } else {
648 5
      options = optionsOrCallback as gax.CallOptions;
649 5
    }
650 5
    options = options || {};
651 5
    options.otherArgs = options.otherArgs || {};
652 5
    options.otherArgs.headers = options.otherArgs.headers || {};
653 5
    options.otherArgs.headers[
654 5
      'x-goog-request-params'
655 5
    ] = gax.routingHeader.fromParams({
656 5
      parent: request.parent || '',
657 5
    });
658 5
    this.initialize();
659 5
    return this.innerApiCalls.createRealm(request, options, callback);
660 5
  }
661 5
  /**
662 5
   * Check the status of the long running operation returned by the createRealm() method.
663 5
   * @param {String} name
664 5
   *   The operation name that will be passed.
665 5
   * @returns {Promise} - The promise which resolves to an object.
666 5
   *   The decoded operation object has result and metadata field to get information from.
667 5
   *
668 5
   * @example:
669 5
   *   const decodedOperation = await checkCreateRealmProgress(name);
670 5
   *   console.log(decodedOperation.result);
671 5
   *   console.log(decodedOperation.done);
672 5
   *   console.log(decodedOperation.metadata);
673 5
   *
674 5
   */
675 5
  async checkCreateRealmProgress(
676 5
    name: string
677 5
  ): Promise<
678 5
    LROperation<
679 5
      protos.google.cloud.gaming.v1.Realm,
680 5
      protos.google.cloud.gaming.v1.OperationMetadata
681 5
    >
682 5
  > {
683 5
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
684 5
      {name}
685 5
    );
686 5
    const [operation] = await this.operationsClient.getOperation(request);
687 5
    const decodeOperation = new gax.Operation(
688 5
      operation,
689 5
      this.descriptors.longrunning.createRealm,
690 5
      gax.createDefaultBackoffSettings()
691 5
    );
692 5
    return decodeOperation as LROperation<
693 5
      protos.google.cloud.gaming.v1.Realm,
694 5
      protos.google.cloud.gaming.v1.OperationMetadata
695 5
    >;
696 5
  }
697 5
  deleteRealm(
698 5
    request: protos.google.cloud.gaming.v1.IDeleteRealmRequest,
699 5
    options?: gax.CallOptions
700 5
  ): Promise<
701 5
    [
702 5
      LROperation<
703 5
        protos.google.protobuf.IEmpty,
704 5
        protos.google.cloud.gaming.v1.IOperationMetadata
705 5
      >,
706 5
      protos.google.longrunning.IOperation | undefined,
707 5
      {} | undefined
708 5
    ]
709 5
  >;
710 5
  deleteRealm(
711 5
    request: protos.google.cloud.gaming.v1.IDeleteRealmRequest,
712 5
    options: gax.CallOptions,
713 5
    callback: Callback<
714 5
      LROperation<
715 5
        protos.google.protobuf.IEmpty,
716 5
        protos.google.cloud.gaming.v1.IOperationMetadata
717 5
      >,
718 5
      protos.google.longrunning.IOperation | null | undefined,
719 5
      {} | null | undefined
720 5
    >
721 5
  ): void;
722 5
  deleteRealm(
723 5
    request: protos.google.cloud.gaming.v1.IDeleteRealmRequest,
724 5
    callback: Callback<
725 5
      LROperation<
726 5
        protos.google.protobuf.IEmpty,
727 5
        protos.google.cloud.gaming.v1.IOperationMetadata
728 5
      >,
729 5
      protos.google.longrunning.IOperation | null | undefined,
730 5
      {} | null | undefined
731 5
    >
732 5
  ): void;
733 5
  /**
734 5
   * Deletes a single realm.
735 5
   *
736 5
   * @param {Object} request
737 5
   *   The request object that will be sent.
738 5
   * @param {string} request.name
739 5
   *   Required. The name of the realm to delete. Uses the form:
740 5
   *   `projects/{project}/locations/{location}/realms/{realm}`.
741 5
   * @param {object} [options]
742 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
743 5
   * @returns {Promise} - The promise which resolves to an array.
744 5
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
745 5
   *   The promise has a method named "cancel" which cancels the ongoing API call.
746 5
   */
747 5
  deleteRealm(
748 5
    request: protos.google.cloud.gaming.v1.IDeleteRealmRequest,
749 5
    optionsOrCallback?:
750 5
      | gax.CallOptions
751 5
      | Callback<
752 5
          LROperation<
753 5
            protos.google.protobuf.IEmpty,
754 5
            protos.google.cloud.gaming.v1.IOperationMetadata
755 5
          >,
756 5
          protos.google.longrunning.IOperation | null | undefined,
757 5
          {} | null | undefined
758 5
        >,
759 5
    callback?: Callback<
760 5
      LROperation<
761 5
        protos.google.protobuf.IEmpty,
762 5
        protos.google.cloud.gaming.v1.IOperationMetadata
763 5
      >,
764 5
      protos.google.longrunning.IOperation | null | undefined,
765 5
      {} | null | undefined
766 5
    >
767 5
  ): Promise<
768 5
    [
769 5
      LROperation<
770 5
        protos.google.protobuf.IEmpty,
771 5
        protos.google.cloud.gaming.v1.IOperationMetadata
772 5
      >,
773 5
      protos.google.longrunning.IOperation | undefined,
774 5
      {} | undefined
775 5
    ]
776 5
  > | void {
777 5
    request = request || {};
778 5
    let options: gax.CallOptions;
779 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
780 5
      callback = optionsOrCallback;
781 5
      options = {};
782 5
    } else {
783 5
      options = optionsOrCallback as gax.CallOptions;
784 5
    }
785 5
    options = options || {};
786 5
    options.otherArgs = options.otherArgs || {};
787 5
    options.otherArgs.headers = options.otherArgs.headers || {};
788 5
    options.otherArgs.headers[
789 5
      'x-goog-request-params'
790 5
    ] = gax.routingHeader.fromParams({
791 5
      name: request.name || '',
792 5
    });
793 5
    this.initialize();
794 5
    return this.innerApiCalls.deleteRealm(request, options, callback);
795 5
  }
796 5
  /**
797 5
   * Check the status of the long running operation returned by the deleteRealm() method.
798 5
   * @param {String} name
799 5
   *   The operation name that will be passed.
800 5
   * @returns {Promise} - The promise which resolves to an object.
801 5
   *   The decoded operation object has result and metadata field to get information from.
802 5
   *
803 5
   * @example:
804 5
   *   const decodedOperation = await checkDeleteRealmProgress(name);
805 5
   *   console.log(decodedOperation.result);
806 5
   *   console.log(decodedOperation.done);
807 5
   *   console.log(decodedOperation.metadata);
808 5
   *
809 5
   */
810 5
  async checkDeleteRealmProgress(
811 5
    name: string
812 5
  ): Promise<
813 5
    LROperation<
814 5
      protos.google.protobuf.Empty,
815 5
      protos.google.cloud.gaming.v1.OperationMetadata
816 5
    >
817 5
  > {
818 5
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
819 5
      {name}
820 5
    );
821 5
    const [operation] = await this.operationsClient.getOperation(request);
822 5
    const decodeOperation = new gax.Operation(
823 5
      operation,
824 5
      this.descriptors.longrunning.deleteRealm,
825 5
      gax.createDefaultBackoffSettings()
826 5
    );
827 5
    return decodeOperation as LROperation<
828 5
      protos.google.protobuf.Empty,
829 5
      protos.google.cloud.gaming.v1.OperationMetadata
830 5
    >;
831 5
  }
832 5
  updateRealm(
833 5
    request: protos.google.cloud.gaming.v1.IUpdateRealmRequest,
834 5
    options?: gax.CallOptions
835 5
  ): Promise<
836 5
    [
837 5
      LROperation<
838 5
        protos.google.cloud.gaming.v1.IRealm,
839 5
        protos.google.cloud.gaming.v1.IOperationMetadata
840 5
      >,
841 5
      protos.google.longrunning.IOperation | undefined,
842 5
      {} | undefined
843 5
    ]
844 5
  >;
845 5
  updateRealm(
846 5
    request: protos.google.cloud.gaming.v1.IUpdateRealmRequest,
847 5
    options: gax.CallOptions,
848 5
    callback: Callback<
849 5
      LROperation<
850 5
        protos.google.cloud.gaming.v1.IRealm,
851 5
        protos.google.cloud.gaming.v1.IOperationMetadata
852 5
      >,
853 5
      protos.google.longrunning.IOperation | null | undefined,
854 5
      {} | null | undefined
855 5
    >
856 5
  ): void;
857 5
  updateRealm(
858 5
    request: protos.google.cloud.gaming.v1.IUpdateRealmRequest,
859 5
    callback: Callback<
860 5
      LROperation<
861 5
        protos.google.cloud.gaming.v1.IRealm,
862 5
        protos.google.cloud.gaming.v1.IOperationMetadata
863 5
      >,
864 5
      protos.google.longrunning.IOperation | null | undefined,
865 5
      {} | null | undefined
866 5
    >
867 5
  ): void;
868 5
  /**
869 5
   * Patches a single realm.
870 5
   *
871 5
   * @param {Object} request
872 5
   *   The request object that will be sent.
873 5
   * @param {google.cloud.gaming.v1.Realm} request.realm
874 5
   *   Required. The realm to be updated.
875 5
   *   Only fields specified in update_mask are updated.
876 5
   * @param {google.protobuf.FieldMask} request.updateMask
877 5
   *   Required. The update mask applies to the resource. For the `FieldMask`
878 5
   *   definition, see
879 5
   *
880 5
   *   https:
881 5
   *   //developers.google.com/protocol-buffers
882 5
   *   // /docs/reference/google.protobuf#fieldmask
883 5
   * @param {object} [options]
884 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
885 5
   * @returns {Promise} - The promise which resolves to an array.
886 5
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
887 5
   *   The promise has a method named "cancel" which cancels the ongoing API call.
888 5
   */
889 5
  updateRealm(
890 5
    request: protos.google.cloud.gaming.v1.IUpdateRealmRequest,
891 5
    optionsOrCallback?:
892 5
      | gax.CallOptions
893 5
      | Callback<
894 5
          LROperation<
895 5
            protos.google.cloud.gaming.v1.IRealm,
896 5
            protos.google.cloud.gaming.v1.IOperationMetadata
897 5
          >,
898 5
          protos.google.longrunning.IOperation | null | undefined,
899 5
          {} | null | undefined
900 5
        >,
901 5
    callback?: Callback<
902 5
      LROperation<
903 5
        protos.google.cloud.gaming.v1.IRealm,
904 5
        protos.google.cloud.gaming.v1.IOperationMetadata
905 5
      >,
906 5
      protos.google.longrunning.IOperation | null | undefined,
907 5
      {} | null | undefined
908 5
    >
909 5
  ): Promise<
910 5
    [
911 5
      LROperation<
912 5
        protos.google.cloud.gaming.v1.IRealm,
913 5
        protos.google.cloud.gaming.v1.IOperationMetadata
914 5
      >,
915 5
      protos.google.longrunning.IOperation | undefined,
916 5
      {} | undefined
917 5
    ]
918 5
  > | void {
919 5
    request = request || {};
920 5
    let options: gax.CallOptions;
921 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
922 5
      callback = optionsOrCallback;
923 5
      options = {};
924 5
    } else {
925 5
      options = optionsOrCallback as gax.CallOptions;
926 5
    }
927 5
    options = options || {};
928 5
    options.otherArgs = options.otherArgs || {};
929 5
    options.otherArgs.headers = options.otherArgs.headers || {};
930 5
    options.otherArgs.headers[
931 5
      'x-goog-request-params'
932 5
    ] = gax.routingHeader.fromParams({
933 5
      'realm.name': request.realm!.name || '',
934 5
    });
935 5
    this.initialize();
936 5
    return this.innerApiCalls.updateRealm(request, options, callback);
937 5
  }
938 5
  /**
939 5
   * Check the status of the long running operation returned by the updateRealm() method.
940 5
   * @param {String} name
941 5
   *   The operation name that will be passed.
942 5
   * @returns {Promise} - The promise which resolves to an object.
943 5
   *   The decoded operation object has result and metadata field to get information from.
944 5
   *
945 5
   * @example:
946 5
   *   const decodedOperation = await checkUpdateRealmProgress(name);
947 5
   *   console.log(decodedOperation.result);
948 5
   *   console.log(decodedOperation.done);
949 5
   *   console.log(decodedOperation.metadata);
950 5
   *
951 5
   */
952 5
  async checkUpdateRealmProgress(
953 5
    name: string
954 5
  ): Promise<
955 5
    LROperation<
956 5
      protos.google.cloud.gaming.v1.Realm,
957 5
      protos.google.cloud.gaming.v1.OperationMetadata
958 5
    >
959 5
  > {
960 5
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
961 5
      {name}
962 5
    );
963 5
    const [operation] = await this.operationsClient.getOperation(request);
964 5
    const decodeOperation = new gax.Operation(
965 5
      operation,
966 5
      this.descriptors.longrunning.updateRealm,
967 5
      gax.createDefaultBackoffSettings()
968 5
    );
969 5
    return decodeOperation as LROperation<
970 5
      protos.google.cloud.gaming.v1.Realm,
971 5
      protos.google.cloud.gaming.v1.OperationMetadata
972 5
    >;
973 5
  }
974 5
  listRealms(
975 5
    request: protos.google.cloud.gaming.v1.IListRealmsRequest,
976 5
    options?: gax.CallOptions
977 5
  ): Promise<
978 5
    [
979 5
      protos.google.cloud.gaming.v1.IRealm[],
980 5
      protos.google.cloud.gaming.v1.IListRealmsRequest | null,
981 5
      protos.google.cloud.gaming.v1.IListRealmsResponse
982 5
    ]
983 5
  >;
984 5
  listRealms(
985 5
    request: protos.google.cloud.gaming.v1.IListRealmsRequest,
986 5
    options: gax.CallOptions,
987 5
    callback: PaginationCallback<
988 5
      protos.google.cloud.gaming.v1.IListRealmsRequest,
989 5
      protos.google.cloud.gaming.v1.IListRealmsResponse | null | undefined,
990 5
      protos.google.cloud.gaming.v1.IRealm
991 5
    >
992 5
  ): void;
993 5
  listRealms(
994 5
    request: protos.google.cloud.gaming.v1.IListRealmsRequest,
995 5
    callback: PaginationCallback<
996 5
      protos.google.cloud.gaming.v1.IListRealmsRequest,
997 5
      protos.google.cloud.gaming.v1.IListRealmsResponse | null | undefined,
998 5
      protos.google.cloud.gaming.v1.IRealm
999 5
    >
1000 5
  ): void;
1001 5
  /**
1002 5
   * Lists realms in a given project and location.
1003 5
   *
1004 5
   * @param {Object} request
1005 5
   *   The request object that will be sent.
1006 5
   * @param {string} request.parent
1007 5
   *   Required. The parent resource name. Uses the form:
1008 5
   *   `projects/{project}/locations/{location}`.
1009 5
   * @param {number} [request.pageSize]
1010 5
   *   Optional. The maximum number of items to return.  If unspecified, server
1011 5
   *   will pick an appropriate default. Server may return fewer items than
1012 5
   *   requested. A caller should only rely on response's
1013 5
   *   {@link google.cloud.gaming.v1.ListRealmsResponse.next_page_token|next_page_token} to
1014 5
   *   determine if there are more realms left to be queried.
1015 5
   * @param {string} [request.pageToken]
1016 5
   *   Optional. The next_page_token value returned from a previous List request,
1017 5
   *   if any.
1018 5
   * @param {string} [request.filter]
1019 5
   *   Optional. The filter to apply to list results.
1020 5
   * @param {string} [request.orderBy]
1021 5
   *   Optional. Specifies the ordering of results following syntax at
1022 5
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1023 5
   * @param {object} [options]
1024 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1025 5
   * @returns {Promise} - The promise which resolves to an array.
1026 5
   *   The first element of the array is Array of [Realm]{@link google.cloud.gaming.v1.Realm}.
1027 5
   *   The client library support auto-pagination by default: it will call the API as many
1028 5
   *   times as needed and will merge results from all the pages into this array.
1029 5
   *
1030 5
   *   When autoPaginate: false is specified through options, the array has three elements.
1031 5
   *   The first element is Array of [Realm]{@link google.cloud.gaming.v1.Realm} that corresponds to
1032 5
   *   the one page received from the API server.
1033 5
   *   If the second element is not null it contains the request object of type [ListRealmsRequest]{@link google.cloud.gaming.v1.ListRealmsRequest}
1034 5
   *   that can be used to obtain the next page of the results.
1035 5
   *   If it is null, the next page does not exist.
1036 5
   *   The third element contains the raw response received from the API server. Its type is
1037 5
   *   [ListRealmsResponse]{@link google.cloud.gaming.v1.ListRealmsResponse}.
1038 5
   *
1039 5
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1040 5
   */
1041 5
  listRealms(
1042 5
    request: protos.google.cloud.gaming.v1.IListRealmsRequest,
1043 5
    optionsOrCallback?:
1044 5
      | gax.CallOptions
1045 5
      | PaginationCallback<
1046 5
          protos.google.cloud.gaming.v1.IListRealmsRequest,
1047 5
          protos.google.cloud.gaming.v1.IListRealmsResponse | null | undefined,
1048 5
          protos.google.cloud.gaming.v1.IRealm
1049 5
        >,
1050 5
    callback?: PaginationCallback<
1051 5
      protos.google.cloud.gaming.v1.IListRealmsRequest,
1052 5
      protos.google.cloud.gaming.v1.IListRealmsResponse | null | undefined,
1053 5
      protos.google.cloud.gaming.v1.IRealm
1054 5
    >
1055 5
  ): Promise<
1056 5
    [
1057 5
      protos.google.cloud.gaming.v1.IRealm[],
1058 5
      protos.google.cloud.gaming.v1.IListRealmsRequest | null,
1059 5
      protos.google.cloud.gaming.v1.IListRealmsResponse
1060 5
    ]
1061 5
  > | void {
1062 5
    request = request || {};
1063 5
    let options: gax.CallOptions;
1064 5
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1065 5
      callback = optionsOrCallback;
1066 5
      options = {};
1067 5
    } else {
1068 5
      options = optionsOrCallback as gax.CallOptions;
1069 5
    }
1070 5
    options = options || {};
1071 5
    options.otherArgs = options.otherArgs || {};
1072 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1073 5
    options.otherArgs.headers[
1074 5
      'x-goog-request-params'
1075 5
    ] = gax.routingHeader.fromParams({
1076 5
      parent: request.parent || '',
1077 5
    });
1078 5
    this.initialize();
1079 5
    return this.innerApiCalls.listRealms(request, options, callback);
1080 5
  }
1081 5

1082 5
  /**
1083 5
   * Equivalent to {@link listRealms}, but returns a NodeJS Stream object.
1084 5
   *
1085 5
   * This fetches the paged responses for {@link listRealms} continuously
1086 5
   * and invokes the callback registered for 'data' event for each element in the
1087 5
   * responses.
1088 5
   *
1089 5
   * The returned object has 'end' method when no more elements are required.
1090 5
   *
1091 5
   * autoPaginate option will be ignored.
1092 5
   *
1093 5
   * @see {@link https://nodejs.org/api/stream.html}
1094 5
   *
1095 5
   * @param {Object} request
1096 5
   *   The request object that will be sent.
1097 5
   * @param {string} request.parent
1098 5
   *   Required. The parent resource name. Uses the form:
1099 5
   *   `projects/{project}/locations/{location}`.
1100 5
   * @param {number} [request.pageSize]
1101 5
   *   Optional. The maximum number of items to return.  If unspecified, server
1102 5
   *   will pick an appropriate default. Server may return fewer items than
1103 5
   *   requested. A caller should only rely on response's
1104 5
   *   {@link google.cloud.gaming.v1.ListRealmsResponse.next_page_token|next_page_token} to
1105 5
   *   determine if there are more realms left to be queried.
1106 5
   * @param {string} [request.pageToken]
1107 5
   *   Optional. The next_page_token value returned from a previous List request,
1108 5
   *   if any.
1109 5
   * @param {string} [request.filter]
1110 5
   *   Optional. The filter to apply to list results.
1111 5
   * @param {string} [request.orderBy]
1112 5
   *   Optional. Specifies the ordering of results following syntax at
1113 5
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1114 5
   * @param {object} [options]
1115 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1116 5
   * @returns {Stream}
1117 5
   *   An object stream which emits an object representing [Realm]{@link google.cloud.gaming.v1.Realm} on 'data' event.
1118 5
   */
1119 5
  listRealmsStream(
1120 5
    request?: protos.google.cloud.gaming.v1.IListRealmsRequest,
1121 5
    options?: gax.CallOptions
1122 5
  ): Transform {
1123 5
    request = request || {};
1124 5
    options = options || {};
1125 5
    options.otherArgs = options.otherArgs || {};
1126 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1127 5
    options.otherArgs.headers[
1128 5
      'x-goog-request-params'
1129 5
    ] = gax.routingHeader.fromParams({
1130 5
      parent: request.parent || '',
1131 5
    });
1132 5
    const callSettings = new gax.CallSettings(options);
1133 5
    this.initialize();
1134 5
    return this.descriptors.page.listRealms.createStream(
1135 5
      this.innerApiCalls.listRealms as gax.GaxCall,
1136 5
      request,
1137 5
      callSettings
1138 5
    );
1139 5
  }
1140 5

1141 5
  /**
1142 5
   * Equivalent to {@link listRealms}, but returns an iterable object.
1143 5
   *
1144 5
   * for-await-of syntax is used with the iterable to recursively get response element on-demand.
1145 5
   *
1146 5
   * @param {Object} request
1147 5
   *   The request object that will be sent.
1148 5
   * @param {string} request.parent
1149 5
   *   Required. The parent resource name. Uses the form:
1150 5
   *   `projects/{project}/locations/{location}`.
1151 5
   * @param {number} [request.pageSize]
1152 5
   *   Optional. The maximum number of items to return.  If unspecified, server
1153 5
   *   will pick an appropriate default. Server may return fewer items than
1154 5
   *   requested. A caller should only rely on response's
1155 5
   *   {@link google.cloud.gaming.v1.ListRealmsResponse.next_page_token|next_page_token} to
1156 5
   *   determine if there are more realms left to be queried.
1157 5
   * @param {string} [request.pageToken]
1158 5
   *   Optional. The next_page_token value returned from a previous List request,
1159 5
   *   if any.
1160 5
   * @param {string} [request.filter]
1161 5
   *   Optional. The filter to apply to list results.
1162 5
   * @param {string} [request.orderBy]
1163 5
   *   Optional. Specifies the ordering of results following syntax at
1164 5
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1165 5
   * @param {object} [options]
1166 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1167 5
   * @returns {Object}
1168 5
   *   An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.
1169 5
   */
1170 5
  listRealmsAsync(
1171 5
    request?: protos.google.cloud.gaming.v1.IListRealmsRequest,
1172 5
    options?: gax.CallOptions
1173 5
  ): AsyncIterable<protos.google.cloud.gaming.v1.IRealm> {
1174 5
    request = request || {};
1175 5
    options = options || {};
1176 5
    options.otherArgs = options.otherArgs || {};
1177 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1178 5
    options.otherArgs.headers[
1179 5
      'x-goog-request-params'
1180 5
    ] = gax.routingHeader.fromParams({
1181 5
      parent: request.parent || '',
1182 5
    });
1183 5
    options = options || {};
1184 5
    const callSettings = new gax.CallSettings(options);
1185 5
    this.initialize();
1186 5
    return this.descriptors.page.listRealms.asyncIterate(
1187 5
      this.innerApiCalls['listRealms'] as GaxCall,
1188 5
      (request as unknown) as RequestType,
1189 5
      callSettings
1190 5
    ) as AsyncIterable<protos.google.cloud.gaming.v1.IRealm>;
1191 5
  }
1192 5
  // --------------------
1193 5
  // -- Path templates --
1194 5
  // --------------------
1195 5

1196 5
  /**
1197 5
   * Return a fully-qualified gameServerCluster resource name string.
1198 5
   *
1199 5
   * @param {string} project
1200 5
   * @param {string} location
1201 5
   * @param {string} realm
1202 5
   * @param {string} cluster
1203 5
   * @returns {string} Resource name string.
1204 5
   */
1205 5
  gameServerClusterPath(
1206 5
    project: string,
1207 5
    location: string,
1208 5
    realm: string,
1209 5
    cluster: string
1210 5
  ) {
1211 5
    return this.pathTemplates.gameServerClusterPathTemplate.render({
1212 5
      project: project,
1213 5
      location: location,
1214 5
      realm: realm,
1215 5
      cluster: cluster,
1216 5
    });
1217 5
  }
1218 5

1219 5
  /**
1220 5
   * Parse the project from GameServerCluster resource.
1221 5
   *
1222 5
   * @param {string} gameServerClusterName
1223 5
   *   A fully-qualified path representing GameServerCluster resource.
1224 5
   * @returns {string} A string representing the project.
1225 5
   */
1226 5
  matchProjectFromGameServerClusterName(gameServerClusterName: string) {
1227 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1228 5
      gameServerClusterName
1229 5
    ).project;
1230 5
  }
1231 5

1232 5
  /**
1233 5
   * Parse the location from GameServerCluster resource.
1234 5
   *
1235 5
   * @param {string} gameServerClusterName
1236 5
   *   A fully-qualified path representing GameServerCluster resource.
1237 5
   * @returns {string} A string representing the location.
1238 5
   */
1239 5
  matchLocationFromGameServerClusterName(gameServerClusterName: string) {
1240 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1241 5
      gameServerClusterName
1242 5
    ).location;
1243 5
  }
1244 5

1245 5
  /**
1246 5
   * Parse the realm from GameServerCluster resource.
1247 5
   *
1248 5
   * @param {string} gameServerClusterName
1249 5
   *   A fully-qualified path representing GameServerCluster resource.
1250 5
   * @returns {string} A string representing the realm.
1251 5
   */
1252 5
  matchRealmFromGameServerClusterName(gameServerClusterName: string) {
1253 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1254 5
      gameServerClusterName
1255 5
    ).realm;
1256 5
  }
1257 5

1258 5
  /**
1259 5
   * Parse the cluster from GameServerCluster resource.
1260 5
   *
1261 5
   * @param {string} gameServerClusterName
1262 5
   *   A fully-qualified path representing GameServerCluster resource.
1263 5
   * @returns {string} A string representing the cluster.
1264 5
   */
1265 5
  matchClusterFromGameServerClusterName(gameServerClusterName: string) {
1266 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1267 5
      gameServerClusterName
1268 5
    ).cluster;
1269 5
  }
1270 5

1271 5
  /**
1272 5
   * Return a fully-qualified gameServerConfig resource name string.
1273 5
   *
1274 5
   * @param {string} project
1275 5
   * @param {string} location
1276 5
   * @param {string} deployment
1277 5
   * @param {string} config
1278 5
   * @returns {string} Resource name string.
1279 5
   */
1280 5
  gameServerConfigPath(
1281 5
    project: string,
1282 5
    location: string,
1283 5
    deployment: string,
1284 5
    config: string
1285 5
  ) {
1286 5
    return this.pathTemplates.gameServerConfigPathTemplate.render({
1287 5
      project: project,
1288 5
      location: location,
1289 5
      deployment: deployment,
1290 5
      config: config,
1291 5
    });
1292 5
  }
1293 5

1294 5
  /**
1295 5
   * Parse the project from GameServerConfig resource.
1296 5
   *
1297 5
   * @param {string} gameServerConfigName
1298 5
   *   A fully-qualified path representing GameServerConfig resource.
1299 5
   * @returns {string} A string representing the project.
1300 5
   */
1301 5
  matchProjectFromGameServerConfigName(gameServerConfigName: string) {
1302 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1303 5
      gameServerConfigName
1304 5
    ).project;
1305 5
  }
1306 5

1307 5
  /**
1308 5
   * Parse the location from GameServerConfig resource.
1309 5
   *
1310 5
   * @param {string} gameServerConfigName
1311 5
   *   A fully-qualified path representing GameServerConfig resource.
1312 5
   * @returns {string} A string representing the location.
1313 5
   */
1314 5
  matchLocationFromGameServerConfigName(gameServerConfigName: string) {
1315 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1316 5
      gameServerConfigName
1317 5
    ).location;
1318 5
  }
1319 5

1320 5
  /**
1321 5
   * Parse the deployment from GameServerConfig resource.
1322 5
   *
1323 5
   * @param {string} gameServerConfigName
1324 5
   *   A fully-qualified path representing GameServerConfig resource.
1325 5
   * @returns {string} A string representing the deployment.
1326 5
   */
1327 5
  matchDeploymentFromGameServerConfigName(gameServerConfigName: string) {
1328 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1329 5
      gameServerConfigName
1330 5
    ).deployment;
1331 5
  }
1332 5

1333 5
  /**
1334 5
   * Parse the config from GameServerConfig resource.
1335 5
   *
1336 5
   * @param {string} gameServerConfigName
1337 5
   *   A fully-qualified path representing GameServerConfig resource.
1338 5
   * @returns {string} A string representing the config.
1339 5
   */
1340 5
  matchConfigFromGameServerConfigName(gameServerConfigName: string) {
1341 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1342 5
      gameServerConfigName
1343 5
    ).config;
1344 5
  }
1345 5

1346 5
  /**
1347 5
   * Return a fully-qualified gameServerDeployment resource name string.
1348 5
   *
1349 5
   * @param {string} project
1350 5
   * @param {string} location
1351 5
   * @param {string} deployment
1352 5
   * @returns {string} Resource name string.
1353 5
   */
1354 5
  gameServerDeploymentPath(
1355 5
    project: string,
1356 5
    location: string,
1357 5
    deployment: string
1358 5
  ) {
1359 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.render({
1360 5
      project: project,
1361 5
      location: location,
1362 5
      deployment: deployment,
1363 5
    });
1364 5
  }
1365 5

1366 5
  /**
1367 5
   * Parse the project from GameServerDeployment resource.
1368 5
   *
1369 5
   * @param {string} gameServerDeploymentName
1370 5
   *   A fully-qualified path representing GameServerDeployment resource.
1371 5
   * @returns {string} A string representing the project.
1372 5
   */
1373 5
  matchProjectFromGameServerDeploymentName(gameServerDeploymentName: string) {
1374 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1375 5
      gameServerDeploymentName
1376 5
    ).project;
1377 5
  }
1378 5

1379 5
  /**
1380 5
   * Parse the location from GameServerDeployment resource.
1381 5
   *
1382 5
   * @param {string} gameServerDeploymentName
1383 5
   *   A fully-qualified path representing GameServerDeployment resource.
1384 5
   * @returns {string} A string representing the location.
1385 5
   */
1386 5
  matchLocationFromGameServerDeploymentName(gameServerDeploymentName: string) {
1387 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1388 5
      gameServerDeploymentName
1389 5
    ).location;
1390 5
  }
1391 5

1392 5
  /**
1393 5
   * Parse the deployment from GameServerDeployment resource.
1394 5
   *
1395 5
   * @param {string} gameServerDeploymentName
1396 5
   *   A fully-qualified path representing GameServerDeployment resource.
1397 5
   * @returns {string} A string representing the deployment.
1398 5
   */
1399 5
  matchDeploymentFromGameServerDeploymentName(
1400 5
    gameServerDeploymentName: string
1401 5
  ) {
1402 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1403 5
      gameServerDeploymentName
1404 5
    ).deployment;
1405 5
  }
1406 5

1407 5
  /**
1408 5
   * Return a fully-qualified gameServerDeploymentRollout resource name string.
1409 5
   *
1410 5
   * @param {string} project
1411 5
   * @param {string} location
1412 5
   * @param {string} deployment
1413 5
   * @returns {string} Resource name string.
1414 5
   */
1415 5
  gameServerDeploymentRolloutPath(
1416 5
    project: string,
1417 5
    location: string,
1418 5
    deployment: string
1419 5
  ) {
1420 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.render({
1421 5
      project: project,
1422 5
      location: location,
1423 5
      deployment: deployment,
1424 5
    });
1425 5
  }
1426 5

1427 5
  /**
1428 5
   * Parse the project from GameServerDeploymentRollout resource.
1429 5
   *
1430 5
   * @param {string} gameServerDeploymentRolloutName
1431 5
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1432 5
   * @returns {string} A string representing the project.
1433 5
   */
1434 5
  matchProjectFromGameServerDeploymentRolloutName(
1435 5
    gameServerDeploymentRolloutName: string
1436 5
  ) {
1437 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1438 5
      gameServerDeploymentRolloutName
1439 5
    ).project;
1440 5
  }
1441 5

1442 5
  /**
1443 5
   * Parse the location from GameServerDeploymentRollout resource.
1444 5
   *
1445 5
   * @param {string} gameServerDeploymentRolloutName
1446 5
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1447 5
   * @returns {string} A string representing the location.
1448 5
   */
1449 5
  matchLocationFromGameServerDeploymentRolloutName(
1450 5
    gameServerDeploymentRolloutName: string
1451 5
  ) {
1452 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1453 5
      gameServerDeploymentRolloutName
1454 5
    ).location;
1455 5
  }
1456 5

1457 5
  /**
1458 5
   * Parse the deployment from GameServerDeploymentRollout resource.
1459 5
   *
1460 5
   * @param {string} gameServerDeploymentRolloutName
1461 5
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1462 5
   * @returns {string} A string representing the deployment.
1463 5
   */
1464 5
  matchDeploymentFromGameServerDeploymentRolloutName(
1465 5
    gameServerDeploymentRolloutName: string
1466 5
  ) {
1467 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1468 5
      gameServerDeploymentRolloutName
1469 5
    ).deployment;
1470 5
  }
1471 5

1472 5
  /**
1473 5
   * Return a fully-qualified realm resource name string.
1474 5
   *
1475 5
   * @param {string} project
1476 5
   * @param {string} location
1477 5
   * @param {string} realm
1478 5
   * @returns {string} Resource name string.
1479 5
   */
1480 5
  realmPath(project: string, location: string, realm: string) {
1481 5
    return this.pathTemplates.realmPathTemplate.render({
1482 5
      project: project,
1483 5
      location: location,
1484 5
      realm: realm,
1485 5
    });
1486 5
  }
1487 5

1488 5
  /**
1489 5
   * Parse the project from Realm resource.
1490 5
   *
1491 5
   * @param {string} realmName
1492 5
   *   A fully-qualified path representing Realm resource.
1493 5
   * @returns {string} A string representing the project.
1494 5
   */
1495 5
  matchProjectFromRealmName(realmName: string) {
1496 5
    return this.pathTemplates.realmPathTemplate.match(realmName).project;
1497 5
  }
1498 5

1499 5
  /**
1500 5
   * Parse the location from Realm resource.
1501 5
   *
1502 5
   * @param {string} realmName
1503 5
   *   A fully-qualified path representing Realm resource.
1504 5
   * @returns {string} A string representing the location.
1505 5
   */
1506 5
  matchLocationFromRealmName(realmName: string) {
1507 5
    return this.pathTemplates.realmPathTemplate.match(realmName).location;
1508 5
  }
1509 5

1510 5
  /**
1511 5
   * Parse the realm from Realm resource.
1512 5
   *
1513 5
   * @param {string} realmName
1514 5
   *   A fully-qualified path representing Realm resource.
1515 5
   * @returns {string} A string representing the realm.
1516 5
   */
1517 5
  matchRealmFromRealmName(realmName: string) {
1518 5
    return this.pathTemplates.realmPathTemplate.match(realmName).realm;
1519 5
  }
1520 5

1521 5
  /**
1522 5
   * Terminate the GRPC channel and close the client.
1523 5
   *
1524 5
   * The client will no longer be usable and all future behavior is undefined.
1525 5
   */
1526 5
  close(): Promise<void> {
1527 5
    this.initialize();
1528 5
    if (!this._terminated) {
1529 5
      return this.realmsServiceStub!.then(stub => {
1530 5
        this._terminated = true;
1531 5
        stub.close();
1532 5
      });
1533 5
    }
1534 5
    return Promise.resolve();
1535 0
  }
1536 5
}

Read our documentation on viewing source code .

Loading