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

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

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

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

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

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

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

123 5
    // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
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
    // Set the default scopes in auth client if needed.
133 5
    if (servicePath === staticMembers.servicePath) {
134 5
      this.auth.defaultScopes = staticMembers.scopes;
135 5
    }
136 5

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

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

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

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

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

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

235 5
    this.descriptors.longrunning = {
236 5
      createRealm: new this._gaxModule.LongrunningDescriptor(
237 5
        this.operationsClient,
238 5
        createRealmResponse.decode.bind(createRealmResponse),
239 5
        createRealmMetadata.decode.bind(createRealmMetadata)
240 5
      ),
241 5
      deleteRealm: new this._gaxModule.LongrunningDescriptor(
242 5
        this.operationsClient,
243 5
        deleteRealmResponse.decode.bind(deleteRealmResponse),
244 5
        deleteRealmMetadata.decode.bind(deleteRealmMetadata)
245 5
      ),
246 5
      updateRealm: new this._gaxModule.LongrunningDescriptor(
247 5
        this.operationsClient,
248 5
        updateRealmResponse.decode.bind(updateRealmResponse),
249 5
        updateRealmMetadata.decode.bind(updateRealmMetadata)
250 5
      ),
251 5
    };
252 5

253 5
    // Put together the default options sent with requests.
254 5
    this._defaults = this._gaxGrpc.constructSettings(
255 5
      'google.cloud.gaming.v1beta.RealmsService',
256 5
      gapicConfig as gax.ClientConfig,
257 5
      opts.clientConfig || {},
258 5
      {'x-goog-api-client': clientHeader.join(' ')}
259 5
    );
260 5

261 5
    // Set up a dictionary of "inner API calls"; the core implementation
262 5
    // of calling the API is handled in `google-gax`, with this code
263 5
    // merely providing the destination and request information.
264 5
    this.innerApiCalls = {};
265 5
  }
266 5

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

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

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

320 5
      const descriptor =
321 5
        this.descriptors.page[methodName] ||
322 5
        this.descriptors.longrunning[methodName] ||
323 5
        undefined;
324 5
      const apiCall = this._gaxModule.createApiCall(
325 5
        callPromise,
326 5
        this._defaults[methodName],
327 5
        descriptor
328 5
      );
329 5

330 5
      this.innerApiCalls[methodName] = apiCall;
331 5
    }
332 5

333 5
    return this.realmsServiceStub;
334 5
  }
335 5

336 5
  /**
337 5
   * The DNS address for this API service.
338 5
   * @returns {string} The DNS address for this service.
339 5
   */
340 5
  static get servicePath() {
341 5
    return 'gameservices.googleapis.com';
342 5
  }
343 5

344 5
  /**
345 5
   * The DNS address for this API service - same as servicePath(),
346 5
   * exists for compatibility reasons.
347 5
   * @returns {string} The DNS address for this service.
348 5
   */
349 5
  static get apiEndpoint() {
350 5
    return 'gameservices.googleapis.com';
351 5
  }
352 5

353 5
  /**
354 5
   * The port for this API service.
355 5
   * @returns {number} The default port for this service.
356 5
   */
357 5
  static get port() {
358 5
    return 443;
359 5
  }
360 5

361 5
  /**
362 5
   * The scopes needed to make gRPC calls for every method defined
363 5
   * in this service.
364 5
   * @returns {string[]} List of default scopes.
365 5
   */
366 5
  static get scopes() {
367 5
    return ['https://www.googleapis.com/auth/cloud-platform'];
368 5
  }
369 5

370 5
  getProjectId(): Promise<string>;
371 5
  getProjectId(callback: Callback<string, undefined, undefined>): void;
372 5
  /**
373 5
   * Return the project ID used by this class.
374 5
   * @returns {Promise} A promise that resolves to string containing the project ID.
375 5
   */
376 5
  getProjectId(
377 5
    callback?: Callback<string, undefined, undefined>
378 5
  ): Promise<string> | void {
379 5
    if (callback) {
380 5
      this.auth.getProjectId(callback);
381 5
      return;
382 5
    }
383 5
    return this.auth.getProjectId();
384 5
  }
385 5

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

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

1122 5
  /**
1123 5
   * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
1124 5
   * @param {Object} request
1125 5
   *   The request object that will be sent.
1126 5
   * @param {string} request.parent
1127 5
   *   Required. The parent resource name. Uses the form:
1128 5
   *   `projects/{project}/locations/{location}`.
1129 5
   * @param {number} [request.pageSize]
1130 5
   *   Optional. The maximum number of items to return.  If unspecified, server
1131 5
   *   will pick an appropriate default. Server may return fewer items than
1132 5
   *   requested. A caller should only rely on response's
1133 5
   *   {@link google.cloud.gaming.v1beta.ListRealmsResponse.next_page_token|next_page_token} to
1134 5
   *   determine if there are more realms left to be queried.
1135 5
   * @param {string} [request.pageToken]
1136 5
   *   Optional. The next_page_token value returned from a previous List request,
1137 5
   *   if any.
1138 5
   * @param {string} [request.filter]
1139 5
   *   Optional. The filter to apply to list results.
1140 5
   * @param {string} [request.orderBy]
1141 5
   *   Optional. Specifies the ordering of results following syntax at
1142 5
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1143 5
   * @param {object} [options]
1144 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1145 5
   * @returns {Stream}
1146 5
   *   An object stream which emits an object representing [Realm]{@link google.cloud.gaming.v1beta.Realm} on 'data' event.
1147 5
   *   The client library will perform auto-pagination by default: it will call the API as many
1148 5
   *   times as needed. Note that it can affect your quota.
1149 5
   *   We recommend using `listRealmsAsync()`
1150 5
   *   method described below for async iteration which you can stop as needed.
1151 5
   *   Please see the
1152 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1153 5
   *   for more details and examples.
1154 5
   */
1155 5
  listRealmsStream(
1156 5
    request?: protos.google.cloud.gaming.v1beta.IListRealmsRequest,
1157 5
    options?: CallOptions
1158 5
  ): Transform {
1159 5
    request = request || {};
1160 5
    options = options || {};
1161 5
    options.otherArgs = options.otherArgs || {};
1162 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1163 5
    options.otherArgs.headers[
1164 5
      'x-goog-request-params'
1165 5
    ] = gax.routingHeader.fromParams({
1166 5
      parent: request.parent || '',
1167 5
    });
1168 5
    const callSettings = new gax.CallSettings(options);
1169 5
    this.initialize();
1170 5
    return this.descriptors.page.listRealms.createStream(
1171 5
      this.innerApiCalls.listRealms as gax.GaxCall,
1172 5
      request,
1173 5
      callSettings
1174 5
    );
1175 5
  }
1176 5

1177 5
  /**
1178 5
   * Equivalent to `listRealms`, but returns an iterable object.
1179 5
   *
1180 5
   * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1181 5
   * @param {Object} request
1182 5
   *   The request object that will be sent.
1183 5
   * @param {string} request.parent
1184 5
   *   Required. The parent resource name. Uses the form:
1185 5
   *   `projects/{project}/locations/{location}`.
1186 5
   * @param {number} [request.pageSize]
1187 5
   *   Optional. The maximum number of items to return.  If unspecified, server
1188 5
   *   will pick an appropriate default. Server may return fewer items than
1189 5
   *   requested. A caller should only rely on response's
1190 5
   *   {@link google.cloud.gaming.v1beta.ListRealmsResponse.next_page_token|next_page_token} to
1191 5
   *   determine if there are more realms left to be queried.
1192 5
   * @param {string} [request.pageToken]
1193 5
   *   Optional. The next_page_token value returned from a previous List request,
1194 5
   *   if any.
1195 5
   * @param {string} [request.filter]
1196 5
   *   Optional. The filter to apply to list results.
1197 5
   * @param {string} [request.orderBy]
1198 5
   *   Optional. Specifies the ordering of results following syntax at
1199 5
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1200 5
   * @param {object} [options]
1201 5
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1202 5
   * @returns {Object}
1203 5
   *   An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
1204 5
   *   When you iterate the returned iterable, each element will be an object representing
1205 5
   *   [Realm]{@link google.cloud.gaming.v1beta.Realm}. The API will be called under the hood as needed, once per the page,
1206 5
   *   so you can stop the iteration when you don't need more results.
1207 5
   *   Please see the
1208 5
   *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1209 5
   *   for more details and examples.
1210 5
   * @example
1211 5
   * const iterable = client.listRealmsAsync(request);
1212 5
   * for await (const response of iterable) {
1213 5
   *   // process response
1214 5
   * }
1215 5
   */
1216 5
  listRealmsAsync(
1217 5
    request?: protos.google.cloud.gaming.v1beta.IListRealmsRequest,
1218 5
    options?: CallOptions
1219 5
  ): AsyncIterable<protos.google.cloud.gaming.v1beta.IRealm> {
1220 5
    request = request || {};
1221 5
    options = options || {};
1222 5
    options.otherArgs = options.otherArgs || {};
1223 5
    options.otherArgs.headers = options.otherArgs.headers || {};
1224 5
    options.otherArgs.headers[
1225 5
      'x-goog-request-params'
1226 5
    ] = gax.routingHeader.fromParams({
1227 5
      parent: request.parent || '',
1228 5
    });
1229 5
    options = options || {};
1230 5
    const callSettings = new gax.CallSettings(options);
1231 5
    this.initialize();
1232 5
    return this.descriptors.page.listRealms.asyncIterate(
1233 5
      this.innerApiCalls['listRealms'] as GaxCall,
1234 5
      (request as unknown) as RequestType,
1235 5
      callSettings
1236 5
    ) as AsyncIterable<protos.google.cloud.gaming.v1beta.IRealm>;
1237 5
  }
1238 5
  // --------------------
1239 5
  // -- Path templates --
1240 5
  // --------------------
1241 5

1242 5
  /**
1243 5
   * Return a fully-qualified gameServerCluster resource name string.
1244 5
   *
1245 5
   * @param {string} project
1246 5
   * @param {string} location
1247 5
   * @param {string} realm
1248 5
   * @param {string} cluster
1249 5
   * @returns {string} Resource name string.
1250 5
   */
1251 5
  gameServerClusterPath(
1252 5
    project: string,
1253 5
    location: string,
1254 5
    realm: string,
1255 5
    cluster: string
1256 5
  ) {
1257 5
    return this.pathTemplates.gameServerClusterPathTemplate.render({
1258 5
      project: project,
1259 5
      location: location,
1260 5
      realm: realm,
1261 5
      cluster: cluster,
1262 5
    });
1263 5
  }
1264 5

1265 5
  /**
1266 5
   * Parse the project from GameServerCluster resource.
1267 5
   *
1268 5
   * @param {string} gameServerClusterName
1269 5
   *   A fully-qualified path representing GameServerCluster resource.
1270 5
   * @returns {string} A string representing the project.
1271 5
   */
1272 5
  matchProjectFromGameServerClusterName(gameServerClusterName: string) {
1273 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1274 5
      gameServerClusterName
1275 5
    ).project;
1276 5
  }
1277 5

1278 5
  /**
1279 5
   * Parse the location from GameServerCluster resource.
1280 5
   *
1281 5
   * @param {string} gameServerClusterName
1282 5
   *   A fully-qualified path representing GameServerCluster resource.
1283 5
   * @returns {string} A string representing the location.
1284 5
   */
1285 5
  matchLocationFromGameServerClusterName(gameServerClusterName: string) {
1286 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1287 5
      gameServerClusterName
1288 5
    ).location;
1289 5
  }
1290 5

1291 5
  /**
1292 5
   * Parse the realm from GameServerCluster resource.
1293 5
   *
1294 5
   * @param {string} gameServerClusterName
1295 5
   *   A fully-qualified path representing GameServerCluster resource.
1296 5
   * @returns {string} A string representing the realm.
1297 5
   */
1298 5
  matchRealmFromGameServerClusterName(gameServerClusterName: string) {
1299 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1300 5
      gameServerClusterName
1301 5
    ).realm;
1302 5
  }
1303 5

1304 5
  /**
1305 5
   * Parse the cluster from GameServerCluster resource.
1306 5
   *
1307 5
   * @param {string} gameServerClusterName
1308 5
   *   A fully-qualified path representing GameServerCluster resource.
1309 5
   * @returns {string} A string representing the cluster.
1310 5
   */
1311 5
  matchClusterFromGameServerClusterName(gameServerClusterName: string) {
1312 5
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1313 5
      gameServerClusterName
1314 5
    ).cluster;
1315 5
  }
1316 5

1317 5
  /**
1318 5
   * Return a fully-qualified gameServerConfig resource name string.
1319 5
   *
1320 5
   * @param {string} project
1321 5
   * @param {string} location
1322 5
   * @param {string} deployment
1323 5
   * @param {string} config
1324 5
   * @returns {string} Resource name string.
1325 5
   */
1326 5
  gameServerConfigPath(
1327 5
    project: string,
1328 5
    location: string,
1329 5
    deployment: string,
1330 5
    config: string
1331 5
  ) {
1332 5
    return this.pathTemplates.gameServerConfigPathTemplate.render({
1333 5
      project: project,
1334 5
      location: location,
1335 5
      deployment: deployment,
1336 5
      config: config,
1337 5
    });
1338 5
  }
1339 5

1340 5
  /**
1341 5
   * Parse the project from GameServerConfig resource.
1342 5
   *
1343 5
   * @param {string} gameServerConfigName
1344 5
   *   A fully-qualified path representing GameServerConfig resource.
1345 5
   * @returns {string} A string representing the project.
1346 5
   */
1347 5
  matchProjectFromGameServerConfigName(gameServerConfigName: string) {
1348 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1349 5
      gameServerConfigName
1350 5
    ).project;
1351 5
  }
1352 5

1353 5
  /**
1354 5
   * Parse the location from GameServerConfig resource.
1355 5
   *
1356 5
   * @param {string} gameServerConfigName
1357 5
   *   A fully-qualified path representing GameServerConfig resource.
1358 5
   * @returns {string} A string representing the location.
1359 5
   */
1360 5
  matchLocationFromGameServerConfigName(gameServerConfigName: string) {
1361 5
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1362 5
      gameServerConfigName
1363 5
    ).location;
1364 5
  }
1365 5

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

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

1392 5
  /**
1393 5
   * Return a fully-qualified gameServerDeployment resource name string.
1394 5
   *
1395 5
   * @param {string} project
1396 5
   * @param {string} location
1397 5
   * @param {string} deployment
1398 5
   * @returns {string} Resource name string.
1399 5
   */
1400 5
  gameServerDeploymentPath(
1401 5
    project: string,
1402 5
    location: string,
1403 5
    deployment: string
1404 5
  ) {
1405 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.render({
1406 5
      project: project,
1407 5
      location: location,
1408 5
      deployment: deployment,
1409 5
    });
1410 5
  }
1411 5

1412 5
  /**
1413 5
   * Parse the project from GameServerDeployment resource.
1414 5
   *
1415 5
   * @param {string} gameServerDeploymentName
1416 5
   *   A fully-qualified path representing GameServerDeployment resource.
1417 5
   * @returns {string} A string representing the project.
1418 5
   */
1419 5
  matchProjectFromGameServerDeploymentName(gameServerDeploymentName: string) {
1420 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1421 5
      gameServerDeploymentName
1422 5
    ).project;
1423 5
  }
1424 5

1425 5
  /**
1426 5
   * Parse the location from GameServerDeployment resource.
1427 5
   *
1428 5
   * @param {string} gameServerDeploymentName
1429 5
   *   A fully-qualified path representing GameServerDeployment resource.
1430 5
   * @returns {string} A string representing the location.
1431 5
   */
1432 5
  matchLocationFromGameServerDeploymentName(gameServerDeploymentName: string) {
1433 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1434 5
      gameServerDeploymentName
1435 5
    ).location;
1436 5
  }
1437 5

1438 5
  /**
1439 5
   * Parse the deployment from GameServerDeployment resource.
1440 5
   *
1441 5
   * @param {string} gameServerDeploymentName
1442 5
   *   A fully-qualified path representing GameServerDeployment resource.
1443 5
   * @returns {string} A string representing the deployment.
1444 5
   */
1445 5
  matchDeploymentFromGameServerDeploymentName(
1446 5
    gameServerDeploymentName: string
1447 5
  ) {
1448 5
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1449 5
      gameServerDeploymentName
1450 5
    ).deployment;
1451 5
  }
1452 5

1453 5
  /**
1454 5
   * Return a fully-qualified gameServerDeploymentRollout resource name string.
1455 5
   *
1456 5
   * @param {string} project
1457 5
   * @param {string} location
1458 5
   * @param {string} deployment
1459 5
   * @returns {string} Resource name string.
1460 5
   */
1461 5
  gameServerDeploymentRolloutPath(
1462 5
    project: string,
1463 5
    location: string,
1464 5
    deployment: string
1465 5
  ) {
1466 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.render({
1467 5
      project: project,
1468 5
      location: location,
1469 5
      deployment: deployment,
1470 5
    });
1471 5
  }
1472 5

1473 5
  /**
1474 5
   * Parse the project from GameServerDeploymentRollout resource.
1475 5
   *
1476 5
   * @param {string} gameServerDeploymentRolloutName
1477 5
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1478 5
   * @returns {string} A string representing the project.
1479 5
   */
1480 5
  matchProjectFromGameServerDeploymentRolloutName(
1481 5
    gameServerDeploymentRolloutName: string
1482 5
  ) {
1483 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1484 5
      gameServerDeploymentRolloutName
1485 5
    ).project;
1486 5
  }
1487 5

1488 5
  /**
1489 5
   * Parse the location from GameServerDeploymentRollout resource.
1490 5
   *
1491 5
   * @param {string} gameServerDeploymentRolloutName
1492 5
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1493 5
   * @returns {string} A string representing the location.
1494 5
   */
1495 5
  matchLocationFromGameServerDeploymentRolloutName(
1496 5
    gameServerDeploymentRolloutName: string
1497 5
  ) {
1498 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1499 5
      gameServerDeploymentRolloutName
1500 5
    ).location;
1501 5
  }
1502 5

1503 5
  /**
1504 5
   * Parse the deployment from GameServerDeploymentRollout resource.
1505 5
   *
1506 5
   * @param {string} gameServerDeploymentRolloutName
1507 5
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1508 5
   * @returns {string} A string representing the deployment.
1509 5
   */
1510 5
  matchDeploymentFromGameServerDeploymentRolloutName(
1511 5
    gameServerDeploymentRolloutName: string
1512 5
  ) {
1513 5
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1514 5
      gameServerDeploymentRolloutName
1515 5
    ).deployment;
1516 5
  }
1517 5

1518 5
  /**
1519 5
   * Return a fully-qualified realm resource name string.
1520 5
   *
1521 5
   * @param {string} project
1522 5
   * @param {string} location
1523 5
   * @param {string} realm
1524 5
   * @returns {string} Resource name string.
1525 5
   */
1526 5
  realmPath(project: string, location: string, realm: string) {
1527 5
    return this.pathTemplates.realmPathTemplate.render({
1528 5
      project: project,
1529 5
      location: location,
1530 5
      realm: realm,
1531 5
    });
1532 5
  }
1533 5

1534 5
  /**
1535 5
   * Parse the project from Realm resource.
1536 5
   *
1537 5
   * @param {string} realmName
1538 5
   *   A fully-qualified path representing Realm resource.
1539 5
   * @returns {string} A string representing the project.
1540 5
   */
1541 5
  matchProjectFromRealmName(realmName: string) {
1542 5
    return this.pathTemplates.realmPathTemplate.match(realmName).project;
1543 5
  }
1544 5

1545 5
  /**
1546 5
   * Parse the location from Realm resource.
1547 5
   *
1548 5
   * @param {string} realmName
1549 5
   *   A fully-qualified path representing Realm resource.
1550 5
   * @returns {string} A string representing the location.
1551 5
   */
1552 5
  matchLocationFromRealmName(realmName: string) {
1553 5
    return this.pathTemplates.realmPathTemplate.match(realmName).location;
1554 5
  }
1555 5

1556 5
  /**
1557 5
   * Parse the realm from Realm resource.
1558 5
   *
1559 5
   * @param {string} realmName
1560 5
   *   A fully-qualified path representing Realm resource.
1561 5
   * @returns {string} A string representing the realm.
1562 5
   */
1563 5
  matchRealmFromRealmName(realmName: string) {
1564 5
    return this.pathTemplates.realmPathTemplate.match(realmName).realm;
1565 5
  }
1566 5

1567 5
  /**
1568 5
   * Terminate the gRPC channel and close the client.
1569 5
   *
1570 5
   * The client will no longer be usable and all future behavior is undefined.
1571 5
   * @returns {Promise} A promise that resolves when the client is closed.
1572 5
   */
1573 5
  close(): Promise<void> {
1574 5
    this.initialize();
1575 5
    if (!this._terminated) {
1576 5
      return this.realmsServiceStub!.then(stub => {
1577 5
        this._terminated = true;
1578 5
        stub.close();
1579 5
      });
1580 5
    }
1581 5
    return Promise.resolve();
1582 0
  }
1583 5
}

Read our documentation on viewing source code .

Loading