dis+/node_modules/@google-cloud/pubsub/build/src/v1/subscriber_client.js
/**
     * Creates a snapshot from the requested subscription. Snapshots are used in
     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
     * which allow you to manage message acknowledgments in bulk. That is, you can
     * set the acknowledgment state of messages in an existing subscription to the
     * state captured by a snapshot.
     * If the snapshot already exists, returns `ALREADY_EXISTS`.
     * If the requested subscription doesn't exist, returns `NOT_FOUND`.
     * If the backlog in the subscription is too old -- and the resulting snapshot
     * would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.
     * See also the `Snapshot.expire_time` field. If the name is not provided in
     * the request, the server will assign a random
     * name for this snapshot on the same project as the subscription, conforming
     * to the [resource name format]
     * (https://cloud.google.com/pubsub/docs/admin#resource_names). The
     * generated name is populated in the returned Snapshot object. Note that for
     * REST API requests, you must specify a name in the request.
     *
     * @param {Object} request
     *   The request object that will be sent.
     * @param {string} request.name
     *   Required. User-provided name for this snapshot. If the name is not provided
     *   in the request, the server will assign a random name for this snapshot on
     *   the same project as the subscription. Note that for REST API requests, you
     *   must specify a name.  See the <a
     *   href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
     *   name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
     * @param {string} request.subscription
     *   Required. The subscription whose backlog the snapshot retains.
     *   Specifically, the created snapshot is guaranteed to retain:
     *    (a) The existing backlog on the subscription. More precisely, this is
     *        defined as the messages in the subscription's backlog that are
     *        unacknowledged upon the successful completion of the
     *        `CreateSnapshot` request; as well as:
     *    (b) Any messages published to the subscription's topic following the
     *        successful completion of the CreateSnapshot request.
     *   Format is `projects/{project}/subscriptions/{sub}`.
     * @param {number[]} request.labels
     *   See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
     *   managing labels</a>.
     * @param {object} [options]
     *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
     * @returns {Promise} - The promise which resolves to an array.
     *   The first element of the array is an object representing [Snapshot]{@link google.pubsub.v1.Snapshot}.
     *   Please see the
     *   [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
     *   for more details and examples.
     * @example
     * const [response] = await client.createSnapshot(request);
     */
Creates a snapshot from the requested subscription. Snapshots are used in
[Seek] operations,
which allow you to manage message acknowledgments in bulk. That is, you can
set the acknowledgment state of messages in an existing subscription to the
state captured by a snapshot.
If the snapshot already exists, returns `ALREADY_EXISTS`.
If the requested subscription doesn't exist, returns `NOT_FOUND`.
If the backlog in the subscription is too old -- and the resulting snapshot
would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.
See also the `Snapshot.expire_time` field. If the name is not provided in
the request, the server will assign a random
name for this snapshot on the same project as the subscription, conforming
to the [resource name format]
. The
generated name is populated in the returned Snapshot object. Note that for
REST API requests, you must specify a name in the request.

@param {Object} request
The request object that will be sent.
Creates a snapshot from the requested subscription . Snapshots are used in [ Seek ] operations which allow you to manage message acknowledgments in bulk . That is you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot . If the snapshot already exists returns ` ALREADY_EXISTS ` . If the requested subscription doesn ' t exist returns ` NOT_FOUND ` . If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then ` FAILED_PRECONDITION ` is returned . See also the ` Snapshot . expire_time ` field . If the name is not provided in the request the server will assign a random name for this snapshot on the same project as the subscription conforming to the [ resource name format ] . The generated name is populated in the returned Snapshot object . Note that for REST API requests you must specify a name in the request . @param { Object } request The request object that will be sent .
createSnapshot(request, optionsOrCallback, callback) {
        request = request || {};
        let options;
        if (typeof optionsOrCallback === 'function' && callback === undefined) {
            callback = optionsOrCallback;
            options = {};
        }
        else {
            options = optionsOrCallback;
        }
        options = options || {};
        options.otherArgs = options.otherArgs || {};
        options.otherArgs.headers = options.otherArgs.headers || {};
        options.otherArgs.headers['x-goog-request-params'] =
            gax.routingHeader.fromParams({
                name: request.name || '',
            });
        this.initialize();
        return this.innerApiCalls.createSnapshot(request, options, callback);
    }
createSnapshot ( request , optionsOrCallback , callback ) { request = request || { } ; let options ; if ( typeof optionsOrCallback === 'function' && callback === undefined ) { callback = optionsOrCallback ; options = { } ; } else { options = optionsOrCallback ; } options = options || { } ; options . otherArgs = options . otherArgs || { } ; options . otherArgs . headers = options . otherArgs . headers || { } ; options . otherArgs . headers [ 'x-goog-request-params' ] = gax . routingHeader . fromParams ( { name : request . name || '' , } ) ; this . initialize ( ) ; return this . innerApiCalls . createSnapshot ( request , options , callback ) ; }
Creates a snapshot from the requested subscription.
Creates a snapshot from the requested subscription .