Socket
Socket
Sign inDemoInstall

@google-cloud/logging

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/logging - npm Package Compare versions

Comparing version 7.3.0 to 8.0.0-beta.0

build/protos/google/cloud/common_resources.proto

13

build/src/common.js

@@ -61,3 +61,3 @@ "use strict";

*/
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
convert(obj) {

@@ -74,3 +74,3 @@ const convertedObject = {

}
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
convertedObject.fields[prop] = this.encodeValue_(value);

@@ -96,3 +96,3 @@ }

*/
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
encodeValue_(value) {

@@ -184,7 +184,8 @@ let convertedValue;

*/
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function structToObj(struct) {
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const convertedObject = {};
for (const prop in struct.fields) {
// eslint-disable-next-line no-prototype-builtins
if (struct.fields.hasOwnProperty(prop)) {

@@ -204,3 +205,3 @@ const value = struct.fields[prop];

*/
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function decodeValue(value) {

@@ -207,0 +208,0 @@ switch (value.kind) {

@@ -18,3 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable-next-line variable-name
// eslint-disable-next-line @typescript-eslint/no-var-requires
const EventId = require('eventid');

@@ -21,0 +21,0 @@ const extend = require("extend");

@@ -112,20 +112,2 @@ /*!

/**
* @namespace google
*/
/**
* @namespace google.api
*/
/**
* @namespace google.logging
*/
/**
* @namespace google.logging.type
*/
/**
* @namespace google.logging.v2
*/
/**
* @namespace google.protobuf
*/
/**
* @typedef {object} ClientConfig

@@ -499,1 +481,2 @@ * @property {string} [projectId] The project ID from the Google Developer's

export { protos };
export { v2 };

@@ -25,2 +25,3 @@ "use strict";

const gax = require("google-gax");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pumpify = require('pumpify');

@@ -33,4 +34,6 @@ const streamEvents = require("stream-events");

exports.detectServiceContext = metadata_1.detectServiceContext;
const PKG = require('../../package.json');
const version = require('../../package.json').version;
// eslint-disable-next-line @typescript-eslint/no-var-requires
const v2 = require('./v2');
exports.v2 = v2;
const entry_1 = require("./entry");

@@ -44,20 +47,2 @@ exports.Entry = entry_1.Entry;

/**
* @namespace google
*/
/**
* @namespace google.api
*/
/**
* @namespace google.logging
*/
/**
* @namespace google.logging.type
*/
/**
* @namespace google.logging.v2
*/
/**
* @namespace google.protobuf
*/
/**
* @typedef {object} ClientConfig

@@ -138,3 +123,3 @@ * @property {string} [projectId] The project ID from the Google Developer's

libName: 'gccl',
libVersion: PKG.version,
libVersion: version,
scopes,

@@ -491,3 +476,3 @@ }, options);

};
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (!global.GCLOUD_SANDBOX_ENV) {

@@ -510,3 +495,3 @@ requestStream.once('reading', () => {

}
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
userStream.setPipeline(requestStream, toEntryStream);

@@ -678,3 +663,3 @@ });

});
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
userStream.setPipeline(requestStream, toLogStream);

@@ -793,2 +778,3 @@ });

getSinksStream(options) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;

@@ -825,3 +811,3 @@ options = options || {};

};
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (!global.GCLOUD_SANDBOX_ENV) {

@@ -844,3 +830,3 @@ requestStream.once('reading', () => {

}
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
userStream.setPipeline(requestStream, toSinkStream);

@@ -896,4 +882,5 @@ });

*/
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
request(config, callback) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;

@@ -935,3 +922,3 @@ const isStreamMode = !callback;

function makeRequestCallback() {
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (global.GCLOUD_SANDBOX_ENV) {

@@ -949,3 +936,3 @@ return;

function makeRequestStream() {
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (global.GCLOUD_SANDBOX_ENV) {

@@ -981,3 +968,3 @@ return through.obj();

const bucket = config.destination;
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await bucket.acl.owners.addGroup('cloud-logs@google.com');

@@ -998,3 +985,3 @@ config.destination = 'storage.googleapis.com/' + bucket.name;

const [metadata] = await dataset.getMetadata();
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const access = [].slice.call(arrify(metadata.access));

@@ -1035,2 +1022,3 @@ access.push({

}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async setProjectId(reqOpts) {

@@ -1037,0 +1025,0 @@ if (this.projectId === '{{projectId}}') {

@@ -24,2 +24,3 @@ "use strict";

const metadata_1 = require("./metadata");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const snakeCaseKeys = require('snakecase-keys');

@@ -632,2 +633,3 @@ var Severity;

const options = opts ? opts : {};
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;

@@ -634,0 +636,0 @@ if (options.resource) {

{
"interfaces": {
"google.logging.v2.ConfigServiceV2": {
"retry_codes": {
"idempotent": [
"DEADLINE_EXCEEDED",
"INTERNAL",
"UNAVAILABLE"
],
"non_idempotent": [],
"idempotent2": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
]
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 20000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 20000,
"total_timeout_millis": 600000
},
"write_sink": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 20000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 20000,
"total_timeout_millis": 600000
"interfaces": {
"google.logging.v2.ConfigServiceV2": {
"retry_codes": {
"non_idempotent": [],
"idempotent": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
]
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1,
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 600000
}
},
"methods": {
"ListBuckets": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"GetBucket": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateBucket": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"ListSinks": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"GetSink": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"CreateSink": {
"timeout_millis": 120000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateSink": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"DeleteSink": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"ListExclusions": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"GetExclusion": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"CreateExclusion": {
"timeout_millis": 120000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateExclusion": {
"timeout_millis": 120000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"DeleteExclusion": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"GetCmekSettings": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateCmekSettings": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
}
}
}
},
"methods": {
"ListSinks": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"GetSink": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"CreateSink": {
"timeout_millis": 120000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateSink": {
"timeout_millis": 120000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"DeleteSink": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"ListExclusions": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"GetExclusion": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"CreateExclusion": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateExclusion": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"DeleteExclusion": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"GetCmekSettings": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent2",
"retry_params_name": "default"
},
"UpdateCmekSettings": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
}
}
}
}
}

@@ -0,1 +1,2 @@

"use strict";
// Copyright 2020 Google LLC

@@ -14,11 +15,13 @@ //

// limitations under the License.
'use strict';
const ConfigServiceV2Client = require('./config_service_v2_client');
const LoggingServiceV2Client = require('./logging_service_v2_client');
const MetricsServiceV2Client = require('./metrics_service_v2_client');
module.exports.ConfigServiceV2Client = ConfigServiceV2Client;
module.exports.LoggingServiceV2Client = LoggingServiceV2Client;
module.exports.MetricsServiceV2Client = MetricsServiceV2Client;
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **
Object.defineProperty(exports, "__esModule", { value: true });
var config_service_v2_client_1 = require("./config_service_v2_client");
exports.ConfigServiceV2Client = config_service_v2_client_1.ConfigServiceV2Client;
var logging_service_v2_client_1 = require("./logging_service_v2_client");
exports.LoggingServiceV2Client = logging_service_v2_client_1.LoggingServiceV2Client;
var metrics_service_v2_client_1 = require("./metrics_service_v2_client");
exports.MetricsServiceV2Client = metrics_service_v2_client_1.MetricsServiceV2Client;
//# sourceMappingURL=index.js.map
{
"interfaces": {
"google.logging.v2.LoggingServiceV2": {
"retry_codes": {
"idempotent": [
"DEADLINE_EXCEEDED",
"INTERNAL",
"UNAVAILABLE"
],
"non_idempotent": []
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 20000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 20000,
"total_timeout_millis": 600000
},
"list": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 20000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 20000,
"total_timeout_millis": 600000
"interfaces": {
"google.logging.v2.LoggingServiceV2": {
"retry_codes": {
"non_idempotent": [],
"idempotent": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
]
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1,
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 600000
}
},
"methods": {
"DeleteLog": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"WriteLogEntries": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
"bundling": {
"element_count_threshold": 1000,
"request_byte_threshold": 1048576,
"delay_threshold_millis": 50,
"element_count_limit": 1000000
}
},
"ListLogEntries": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"ListMonitoredResourceDescriptors": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"ListLogs": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
}
}
}
},
"methods": {
"DeleteLog": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"WriteLogEntries": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
"bundling": {
"element_count_threshold": 1000,
"request_byte_threshold": 1048576,
"delay_threshold_millis": 50
}
},
"ListLogEntries": {
"timeout_millis": 10000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"ListMonitoredResourceDescriptors": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"ListLogs": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
}
}
}
}
}
{
"interfaces": {
"google.logging.v2.MetricsServiceV2": {
"retry_codes": {
"idempotent": [
"DEADLINE_EXCEEDED",
"INTERNAL",
"UNAVAILABLE"
],
"non_idempotent": []
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 20000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 20000,
"total_timeout_millis": 600000
"interfaces": {
"google.logging.v2.MetricsServiceV2": {
"retry_codes": {
"non_idempotent": [],
"idempotent": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
]
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1,
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 600000
}
},
"methods": {
"ListLogMetrics": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"GetLogMetric": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"CreateLogMetric": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateLogMetric": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"DeleteLogMetric": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
}
}
}
},
"methods": {
"ListLogMetrics": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"GetLogMetric": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"CreateLogMetric": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateLogMetric": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"DeleteLogMetric": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
}
}
}
}
}

@@ -0,1 +1,2 @@

"use strict";
// Copyright 2020 Google LLC

@@ -14,14 +15,13 @@ //

// limitations under the License.
'use strict';
const gapicConfig = require('./metrics_service_v2_client_config.json');
const gax = require('google-gax');
const path = require('path');
const VERSION = require('../../../package.json').version;
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **
Object.defineProperty(exports, "__esModule", { value: true });
const gax = require("google-gax");
const path = require("path");
const gapicConfig = require("./metrics_service_v2_client_config.json");
const version = require('../../../package.json').version;
/**
* Service for configuring logs-based metrics.
*
* Service for configuring logs-based metrics.
* @class

@@ -31,758 +31,1243 @@ * @memberof v2

class MetricsServiceV2Client {
/**
* Construct an instance of MetricsServiceV2Client.
*
* @param {object} [options] - The configuration object. See the subsequent
* parameters for more details.
* @param {object} [options.credentials] - Credentials object.
* @param {string} [options.credentials.client_email]
* @param {string} [options.credentials.private_key]
* @param {string} [options.email] - Account email address. Required when
* using a .pem or .p12 keyFilename.
* @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
* .p12 key downloaded from the Google Developers Console. If you provide
* a path to a JSON file, the projectId option below is not necessary.
* NOTE: .pem and .p12 require you to specify options.email as well.
* @param {number} [options.port] - The port on which to connect to
* the remote host.
* @param {string} [options.projectId] - The project ID from the Google
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
* the environment variable GCLOUD_PROJECT for your project ID. If your
* app is running in an environment which supports
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
* your project ID will be detected automatically.
* @param {function} [options.promise] - Custom promise module to use instead
* of native Promises.
* @param {string} [options.apiEndpoint] - The domain name of the
* API remote host.
*/
constructor(opts) {
opts = opts || {};
this._descriptors = {};
if (global.isBrowser) {
// If we're in browser, we use gRPC fallback.
opts.fallback = true;
/**
* Construct an instance of MetricsServiceV2Client.
*
* @param {object} [options] - The configuration object. See the subsequent
* parameters for more details.
* @param {object} [options.credentials] - Credentials object.
* @param {string} [options.credentials.client_email]
* @param {string} [options.credentials.private_key]
* @param {string} [options.email] - Account email address. Required when
* using a .pem or .p12 keyFilename.
* @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
* .p12 key downloaded from the Google Developers Console. If you provide
* a path to a JSON file, the projectId option below is not necessary.
* NOTE: .pem and .p12 require you to specify options.email as well.
* @param {number} [options.port] - The port on which to connect to
* the remote host.
* @param {string} [options.projectId] - The project ID from the Google
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
* the environment variable GCLOUD_PROJECT for your project ID. If your
* app is running in an environment which supports
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
* your project ID will be detected automatically.
* @param {string} [options.apiEndpoint] - The domain name of the
* API remote host.
*/
constructor(opts) {
this._terminated = false;
this.descriptors = {
page: {},
stream: {},
longrunning: {},
batching: {},
};
// Ensure that options include the service address and port.
const staticMembers = this.constructor;
const servicePath = opts && opts.servicePath
? opts.servicePath
: opts && opts.apiEndpoint
? opts.apiEndpoint
: staticMembers.servicePath;
const port = opts && opts.port ? opts.port : staticMembers.port;
if (!opts) {
opts = { servicePath, port };
}
opts.servicePath = opts.servicePath || servicePath;
opts.port = opts.port || port;
opts.clientConfig = opts.clientConfig || {};
const isBrowser = typeof window !== 'undefined';
if (isBrowser) {
opts.fallback = true;
}
// If we are in browser, we are already using fallback because of the
// "browser" field in package.json.
// But if we were explicitly requested to use fallback, let's do it now.
this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax;
// Create a `gaxGrpc` object, with any grpc-specific options
// sent to the client.
opts.scopes = this.constructor.scopes;
this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
// Save options to use in initialize() method.
this._opts = opts;
// Save the auth object to the client, for use by other methods.
this.auth = this._gaxGrpc.auth;
// Determine the client header string.
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
if (typeof process !== 'undefined' && 'versions' in process) {
clientHeader.push(`gl-node/${process.versions.node}`);
}
else {
clientHeader.push(`gl-web/${this._gaxModule.version}`);
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
}
// Load the applicable protos.
// For Node.js, pass the path to JSON proto file.
// For browsers, pass the JSON content.
const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json');
this._protos = this._gaxGrpc.loadProto(opts.fallback
? // eslint-disable-next-line @typescript-eslint/no-var-requires
require('../../protos/protos.json')
: nodejsProtoPath);
// This API contains "path templates"; forward-slash-separated
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this.pathTemplates = {
billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/cmekSettings'),
billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/exclusions/{exclusion}'),
billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}'),
billingAccountLogPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/logs/{log}'),
billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/sinks/{sink}'),
folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/cmekSettings'),
folderExclusionPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/exclusions/{exclusion}'),
folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}'),
folderLogPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/logs/{log}'),
folderSinkPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/sinks/{sink}'),
logMetricPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/metrics/{metric}'),
organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/cmekSettings'),
organizationExclusionPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/exclusions/{exclusion}'),
organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}'),
organizationLogPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/logs/{log}'),
organizationSinkPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/sinks/{sink}'),
projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'),
projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/cmekSettings'),
projectExclusionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/exclusions/{exclusion}'),
projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}'),
projectLogPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/logs/{log}'),
projectSinkPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/sinks/{sink}'),
};
// Some of the methods on this service return "paged" results,
// (e.g. 50 results at a time, with tokens to get subsequent
// pages). Denote the keys used for pagination and results.
this.descriptors.page = {
listLogMetrics: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metrics'),
};
// Put together the default options sent with requests.
this._defaults = this._gaxGrpc.constructSettings('google.logging.v2.MetricsServiceV2', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
// Set up a dictionary of "inner API calls"; the core implementation
// of calling the API is handled in `google-gax`, with this code
// merely providing the destination and request information.
this.innerApiCalls = {};
}
// If we are in browser, we are already using fallback because of the
// "browser" field in package.json.
// But if we were explicitly requested to use fallback, let's do it now.
const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax;
const servicePath =
opts.servicePath || opts.apiEndpoint || this.constructor.servicePath;
// Ensure that options include the service address and port.
opts = Object.assign(
{
clientConfig: {},
port: this.constructor.port,
servicePath,
},
opts
);
// Create a `gaxGrpc` object, with any grpc-specific options
// sent to the client.
opts.scopes = this.constructor.scopes;
const gaxGrpc = new gaxModule.GrpcClient(opts);
// Save the auth object to the client, for use by other methods.
this.auth = gaxGrpc.auth;
// Determine the client header string.
const clientHeader = [];
if (typeof process !== 'undefined' && 'versions' in process) {
clientHeader.push(`gl-node/${process.versions.node}`);
/**
* Initialize the client.
* Performs asynchronous operations (such as authentication) and prepares the client.
* This function will be called automatically when any class method is called for the
* first time, but if you need to initialize it before calling an actual method,
* feel free to call initialize() directly.
*
* You can await on this method if you want to make sure the client is initialized.
*
* @returns {Promise} A promise that resolves to an authenticated service stub.
*/
initialize() {
// If the client stub promise is already initialized, return immediately.
if (this.metricsServiceV2Stub) {
return this.metricsServiceV2Stub;
}
// Put together the "service stub" for
// google.logging.v2.MetricsServiceV2.
this.metricsServiceV2Stub = this._gaxGrpc.createStub(this._opts.fallback
? this._protos.lookupService('google.logging.v2.MetricsServiceV2')
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
this._protos.google.logging.v2.MetricsServiceV2, this._opts);
// Iterate over each of the methods that the service provides
// and create an API call method for each.
const metricsServiceV2StubMethods = [
'listLogMetrics',
'getLogMetric',
'createLogMetric',
'updateLogMetric',
'deleteLogMetric',
];
for (const methodName of metricsServiceV2StubMethods) {
const callPromise = this.metricsServiceV2Stub.then(stub => (...args) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
const func = stub[methodName];
return func.apply(stub, args);
}, (err) => () => {
throw err;
});
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], this.descriptors.page[methodName] ||
this.descriptors.stream[methodName] ||
this.descriptors.longrunning[methodName]);
this.innerApiCalls[methodName] = apiCall;
}
return this.metricsServiceV2Stub;
}
clientHeader.push(`gax/${gaxModule.version}`);
if (opts.fallback) {
clientHeader.push(`gl-web/${gaxModule.version}`);
} else {
clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`);
/**
* The DNS address for this API service.
*/
static get servicePath() {
return 'logging.googleapis.com';
}
clientHeader.push(`gapic/${VERSION}`);
if (opts.libName && opts.libVersion) {
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
*/
static get apiEndpoint() {
return 'logging.googleapis.com';
}
// Load the applicable protos.
// For Node.js, pass the path to JSON proto file.
// For browsers, pass the JSON content.
const nodejsProtoPath = path.join(
__dirname,
'..',
'..',
'protos',
'protos.json'
);
const protos = gaxGrpc.loadProto(
opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath
);
// This API contains "path templates"; forward-slash-separated
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this._pathTemplates = {
billingPathTemplate: new gaxModule.PathTemplate(
'billingAccounts/{billing_account}'
),
folderPathTemplate: new gaxModule.PathTemplate('folders/{folder}'),
metricPathTemplate: new gaxModule.PathTemplate(
'projects/{project}/metrics/{metric}'
),
organizationPathTemplate: new gaxModule.PathTemplate(
'organizations/{organization}'
),
projectPathTemplate: new gaxModule.PathTemplate('projects/{project}'),
};
// Some of the methods on this service return "paged" results,
// (e.g. 50 results at a time, with tokens to get subsequent
// pages). Denote the keys used for pagination and results.
this._descriptors.page = {
listLogMetrics: new gaxModule.PageDescriptor(
'pageToken',
'nextPageToken',
'metrics'
),
};
// Put together the default options sent with requests.
const defaults = gaxGrpc.constructSettings(
'google.logging.v2.MetricsServiceV2',
gapicConfig,
opts.clientConfig,
{'x-goog-api-client': clientHeader.join(' ')}
);
// Set up a dictionary of "inner API calls"; the core implementation
// of calling the API is handled in `google-gax`, with this code
// merely providing the destination and request information.
this._innerApiCalls = {};
// Put together the "service stub" for
// google.logging.v2.MetricsServiceV2.
const metricsServiceV2Stub = gaxGrpc.createStub(
opts.fallback
? protos.lookupService('google.logging.v2.MetricsServiceV2')
: protos.google.logging.v2.MetricsServiceV2,
opts
);
// Iterate over each of the methods that the service provides
// and create an API call method for each.
const metricsServiceV2StubMethods = [
'listLogMetrics',
'getLogMetric',
'createLogMetric',
'updateLogMetric',
'deleteLogMetric',
];
for (const methodName of metricsServiceV2StubMethods) {
const innerCallPromise = metricsServiceV2Stub.then(
stub => (...args) => {
return stub[methodName].apply(stub, args);
},
err => () => {
throw err;
/**
* The port for this API service.
*/
static get port() {
return 443;
}
/**
* The scopes needed to make gRPC calls for every method defined
* in this service.
*/
static get scopes() {
return [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
'https://www.googleapis.com/auth/logging.write',
];
}
/**
* Return the project ID used by this class.
* @param {function(Error, string)} callback - the callback to
* be called with the current project Id.
*/
getProjectId(callback) {
if (callback) {
this.auth.getProjectId(callback);
return;
}
);
this._innerApiCalls[methodName] = gaxModule.createApiCall(
innerCallPromise,
defaults[methodName],
this._descriptors.page[methodName]
);
return this.auth.getProjectId();
}
}
/**
* The DNS address for this API service.
*/
static get servicePath() {
return 'logging.googleapis.com';
}
/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
*/
static get apiEndpoint() {
return 'logging.googleapis.com';
}
/**
* The port for this API service.
*/
static get port() {
return 443;
}
/**
* The scopes needed to make gRPC calls for every method defined
* in this service.
*/
static get scopes() {
return [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/logging.admin',
'https://www.googleapis.com/auth/logging.read',
'https://www.googleapis.com/auth/logging.write',
];
}
/**
* Return the project ID used by this class.
* @param {function(Error, string)} callback - the callback to
* be called with the current project Id.
*/
getProjectId(callback) {
return this.auth.getProjectId(callback);
}
// -------------------
// -- Service calls --
// -------------------
/**
* Lists logs-based metrics.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the project containing the metrics:
*
* "projects/[PROJECT_ID]"
* @param {number} [request.pageSize]
* The maximum number of resources contained in the underlying API
* response. If page streaming is performed per-resource, this
* parameter does not affect the return value. If page streaming is
* performed per-page, this determines the maximum number of
* resources in a page.
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Array, ?Object, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
* The second parameter to the callback is Array of [LogMetric]{@link google.logging.v2.LogMetric}.
*
* When autoPaginate: false is specified through options, it contains the result
* in a single response. If the response indicates the next page exists, the third
* parameter is set to be used for the next request object. The fourth parameter keeps
* the raw response object of an object representing [ListLogMetricsResponse]{@link google.logging.v2.ListLogMetricsResponse}.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is Array of [LogMetric]{@link google.logging.v2.LogMetric}.
*
* When autoPaginate: false is specified through options, the array has three elements.
* The first element is Array of [LogMetric]{@link google.logging.v2.LogMetric} in a single response.
* The second element is the next request object if the response
* indicates the next page exists, or null. The third element is
* an object representing [ListLogMetricsResponse]{@link google.logging.v2.ListLogMetricsResponse}.
*
* The promise has a method named "cancel" which cancels the ongoing API call.
*
* @example
*
* const logging = require('@google-cloud/logging');
*
* const client = new logging.v2.MetricsServiceV2Client({
* // optional auth parameters.
* });
*
* // Iterate over all elements.
* const formattedParent = client.projectPath('[PROJECT]');
*
* client.listLogMetrics({parent: formattedParent})
* .then(responses => {
* const resources = responses[0];
* for (const resource of resources) {
* // doThingsWith(resource)
* }
* })
* .catch(err => {
* console.error(err);
* });
*
* // Or obtain the paged response.
* const formattedParent = client.projectPath('[PROJECT]');
*
*
* const options = {autoPaginate: false};
* const callback = responses => {
* // The actual resources in a response.
* const resources = responses[0];
* // The next request if the response shows that there are more responses.
* const nextRequest = responses[1];
* // The actual response object, if necessary.
* // const rawResponse = responses[2];
* for (const resource of resources) {
* // doThingsWith(resource);
* }
* if (nextRequest) {
* // Fetch the next page.
* return client.listLogMetrics(nextRequest, options).then(callback);
* }
* }
* client.listLogMetrics({parent: formattedParent}, options)
* .then(callback)
* .catch(err => {
* console.error(err);
* });
*/
listLogMetrics(request, options, callback) {
if (options instanceof Function && callback === undefined) {
callback = options;
options = {};
/**
* Gets a logs-based metric.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.metricName
* Required. The resource name of the desired metric:
*
* "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* @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 [LogMetric]{@link google.logging.v2.LogMetric}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
getLogMetric(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({
metric_name: request.metricName || '',
});
this.initialize();
return this.innerApiCalls.getLogMetric(request, options, callback);
}
request = request || {};
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
parent: request.parent,
});
return this._innerApiCalls.listLogMetrics(request, options, callback);
}
/**
* Equivalent to {@link listLogMetrics}, but returns a NodeJS Stream object.
*
* This fetches the paged responses for {@link listLogMetrics} continuously
* and invokes the callback registered for 'data' event for each element in the
* responses.
*
* The returned object has 'end' method when no more elements are required.
*
* autoPaginate option will be ignored.
*
* @see {@link https://nodejs.org/api/stream.html}
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the project containing the metrics:
*
* "projects/[PROJECT_ID]"
* @param {number} [request.pageSize]
* The maximum number of resources contained in the underlying API
* response. If page streaming is performed per-resource, this
* parameter does not affect the return value. If page streaming is
* performed per-page, this determines the maximum number of
* resources in a page.
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @returns {Stream}
* An object stream which emits an object representing [LogMetric]{@link google.logging.v2.LogMetric} on 'data' event.
*
* @example
*
* const logging = require('@google-cloud/logging');
*
* const client = new logging.v2.MetricsServiceV2Client({
* // optional auth parameters.
* });
*
* const formattedParent = client.projectPath('[PROJECT]');
* client.listLogMetricsStream({parent: formattedParent})
* .on('data', element => {
* // doThingsWith(element)
* }).on('error', err => {
* console.log(err);
* });
*/
listLogMetricsStream(request, options) {
options = options || {};
return this._descriptors.page.listLogMetrics.createStream(
this._innerApiCalls.listLogMetrics,
request,
options
);
}
/**
* Gets a logs-based metric.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.metricName
* Required. The resource name of the desired metric:
*
* "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
* The second parameter to the callback is an object representing [LogMetric]{@link google.logging.v2.LogMetric}.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [LogMetric]{@link google.logging.v2.LogMetric}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*
* @example
*
* const logging = require('@google-cloud/logging');
*
* const client = new logging.v2.MetricsServiceV2Client({
* // optional auth parameters.
* });
*
* const formattedMetricName = client.metricPath('[PROJECT]', '[METRIC]');
* client.getLogMetric({metricName: formattedMetricName})
* .then(responses => {
* const response = responses[0];
* // doThingsWith(response)
* })
* .catch(err => {
* console.error(err);
* });
*/
getLogMetric(request, options, callback) {
if (options instanceof Function && callback === undefined) {
callback = options;
options = {};
/**
* Creates a logs-based metric.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The resource name of the project in which to create the metric:
*
* "projects/[PROJECT_ID]"
*
* The new metric must be provided in the request.
* @param {google.logging.v2.LogMetric} request.metric
* Required. The new logs-based metric, which must not have an identifier that
* already exists.
* @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 [LogMetric]{@link google.logging.v2.LogMetric}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
createLogMetric(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({
parent: request.parent || '',
});
this.initialize();
return this.innerApiCalls.createLogMetric(request, options, callback);
}
request = request || {};
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
metric_name: request.metricName,
});
return this._innerApiCalls.getLogMetric(request, options, callback);
}
/**
* Creates a logs-based metric.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The resource name of the project in which to create the metric:
*
* "projects/[PROJECT_ID]"
*
* The new metric must be provided in the request.
* @param {Object} request.metric
* Required. The new logs-based metric, which must not have an identifier that
* already exists.
*
* This object should have the same structure as [LogMetric]{@link google.logging.v2.LogMetric}
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
* The second parameter to the callback is an object representing [LogMetric]{@link google.logging.v2.LogMetric}.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [LogMetric]{@link google.logging.v2.LogMetric}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*
* @example
*
* const logging = require('@google-cloud/logging');
*
* const client = new logging.v2.MetricsServiceV2Client({
* // optional auth parameters.
* });
*
* const formattedParent = client.projectPath('[PROJECT]');
* const metric = {};
* const request = {
* parent: formattedParent,
* metric: metric,
* };
* client.createLogMetric(request)
* .then(responses => {
* const response = responses[0];
* // doThingsWith(response)
* })
* .catch(err => {
* console.error(err);
* });
*/
createLogMetric(request, options, callback) {
if (options instanceof Function && callback === undefined) {
callback = options;
options = {};
/**
* Creates or updates a logs-based metric.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.metricName
* Required. The resource name of the metric to update:
*
* "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
*
* The updated metric must be provided in the request and it's
* `name` field must be the same as `[METRIC_ID]` If the metric
* does not exist in `[PROJECT_ID]`, then a new metric is created.
* @param {google.logging.v2.LogMetric} request.metric
* Required. The updated metric.
* @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 [LogMetric]{@link google.logging.v2.LogMetric}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
updateLogMetric(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({
metric_name: request.metricName || '',
});
this.initialize();
return this.innerApiCalls.updateLogMetric(request, options, callback);
}
request = request || {};
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
parent: request.parent,
});
return this._innerApiCalls.createLogMetric(request, options, callback);
}
/**
* Creates or updates a logs-based metric.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.metricName
* Required. The resource name of the metric to update:
*
* "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
*
* The updated metric must be provided in the request and it's
* `name` field must be the same as `[METRIC_ID]` If the metric
* does not exist in `[PROJECT_ID]`, then a new metric is created.
* @param {Object} request.metric
* Required. The updated metric.
*
* This object should have the same structure as [LogMetric]{@link google.logging.v2.LogMetric}
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]
* The function which will be called with the result of the API call.
*
* The second parameter to the callback is an object representing [LogMetric]{@link google.logging.v2.LogMetric}.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [LogMetric]{@link google.logging.v2.LogMetric}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*
* @example
*
* const logging = require('@google-cloud/logging');
*
* const client = new logging.v2.MetricsServiceV2Client({
* // optional auth parameters.
* });
*
* const formattedMetricName = client.metricPath('[PROJECT]', '[METRIC]');
* const metric = {};
* const request = {
* metricName: formattedMetricName,
* metric: metric,
* };
* client.updateLogMetric(request)
* .then(responses => {
* const response = responses[0];
* // doThingsWith(response)
* })
* .catch(err => {
* console.error(err);
* });
*/
updateLogMetric(request, options, callback) {
if (options instanceof Function && callback === undefined) {
callback = options;
options = {};
/**
* Deletes a logs-based metric.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.metricName
* Required. The resource name of the metric to delete:
*
* "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* @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 [Empty]{@link google.protobuf.Empty}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
deleteLogMetric(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({
metric_name: request.metricName || '',
});
this.initialize();
return this.innerApiCalls.deleteLogMetric(request, options, callback);
}
request = request || {};
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
metric_name: request.metricName,
});
return this._innerApiCalls.updateLogMetric(request, options, callback);
}
/**
* Deletes a logs-based metric.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.metricName
* Required. The resource name of the metric to delete:
*
* "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* @param {Object} [options]
* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error)} [callback]
* The function which will be called with the result of the API call.
* @returns {Promise} - The promise which resolves when API call finishes.
* The promise has a method named "cancel" which cancels the ongoing API call.
*
* @example
*
* const logging = require('@google-cloud/logging');
*
* const client = new logging.v2.MetricsServiceV2Client({
* // optional auth parameters.
* });
*
* const formattedMetricName = client.metricPath('[PROJECT]', '[METRIC]');
* client.deleteLogMetric({metricName: formattedMetricName}).catch(err => {
* console.error(err);
* });
*/
deleteLogMetric(request, options, callback) {
if (options instanceof Function && callback === undefined) {
callback = options;
options = {};
/**
* Lists logs-based metrics.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the project containing the metrics:
*
* "projects/[PROJECT_ID]"
* @param {string} [request.pageToken]
* Optional. If present, then retrieve the next batch of results from the
* preceding call to this method. `pageToken` must be the value of
* `nextPageToken` from the previous response. The values of other method
* parameters should be identical to those in the previous call.
* @param {number} [request.pageSize]
* Optional. The maximum number of results to return from this request.
* Non-positive values are ignored. The presence of `nextPageToken` in the
* response indicates that more results might be available.
* @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 Array of [LogMetric]{@link google.logging.v2.LogMetric}.
* The client library support auto-pagination by default: it will call the API as many
* times as needed and will merge results from all the pages into this array.
*
* When autoPaginate: false is specified through options, the array has three elements.
* The first element is Array of [LogMetric]{@link google.logging.v2.LogMetric} that corresponds to
* the one page received from the API server.
* If the second element is not null it contains the request object of type [ListLogMetricsRequest]{@link google.logging.v2.ListLogMetricsRequest}
* that can be used to obtain the next page of the results.
* If it is null, the next page does not exist.
* The third element contains the raw response received from the API server. Its type is
* [ListLogMetricsResponse]{@link google.logging.v2.ListLogMetricsResponse}.
*
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
listLogMetrics(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({
parent: request.parent || '',
});
this.initialize();
return this.innerApiCalls.listLogMetrics(request, options, callback);
}
request = request || {};
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
metric_name: request.metricName,
});
return this._innerApiCalls.deleteLogMetric(request, options, callback);
}
// --------------------
// -- Path templates --
// --------------------
/**
* Return a fully-qualified billing resource name string.
*
* @param {String} billingAccount
* @returns {String}
*/
billingPath(billingAccount) {
return this._pathTemplates.billingPathTemplate.render({
billing_account: billingAccount,
});
}
/**
* Return a fully-qualified folder resource name string.
*
* @param {String} folder
* @returns {String}
*/
folderPath(folder) {
return this._pathTemplates.folderPathTemplate.render({
folder: folder,
});
}
/**
* Return a fully-qualified metric resource name string.
*
* @param {String} project
* @param {String} metric
* @returns {String}
*/
metricPath(project, metric) {
return this._pathTemplates.metricPathTemplate.render({
project: project,
metric: metric,
});
}
/**
* Return a fully-qualified organization resource name string.
*
* @param {String} organization
* @returns {String}
*/
organizationPath(organization) {
return this._pathTemplates.organizationPathTemplate.render({
organization: organization,
});
}
/**
* Return a fully-qualified project resource name string.
*
* @param {String} project
* @returns {String}
*/
projectPath(project) {
return this._pathTemplates.projectPathTemplate.render({
project: project,
});
}
/**
* Parse the billingName from a billing resource.
*
* @param {String} billingName
* A fully-qualified path representing a billing resources.
* @returns {String} - A string representing the billing_account.
*/
matchBillingAccountFromBillingName(billingName) {
return this._pathTemplates.billingPathTemplate.match(billingName)
.billing_account;
}
/**
* Parse the folderName from a folder resource.
*
* @param {String} folderName
* A fully-qualified path representing a folder resources.
* @returns {String} - A string representing the folder.
*/
matchFolderFromFolderName(folderName) {
return this._pathTemplates.folderPathTemplate.match(folderName).folder;
}
/**
* Parse the metricName from a metric resource.
*
* @param {String} metricName
* A fully-qualified path representing a metric resources.
* @returns {String} - A string representing the project.
*/
matchProjectFromMetricName(metricName) {
return this._pathTemplates.metricPathTemplate.match(metricName).project;
}
/**
* Parse the metricName from a metric resource.
*
* @param {String} metricName
* A fully-qualified path representing a metric resources.
* @returns {String} - A string representing the metric.
*/
matchMetricFromMetricName(metricName) {
return this._pathTemplates.metricPathTemplate.match(metricName).metric;
}
/**
* Parse the organizationName from a organization resource.
*
* @param {String} organizationName
* A fully-qualified path representing a organization resources.
* @returns {String} - A string representing the organization.
*/
matchOrganizationFromOrganizationName(organizationName) {
return this._pathTemplates.organizationPathTemplate.match(organizationName)
.organization;
}
/**
* Parse the projectName from a project resource.
*
* @param {String} projectName
* A fully-qualified path representing a project resources.
* @returns {String} - A string representing the project.
*/
matchProjectFromProjectName(projectName) {
return this._pathTemplates.projectPathTemplate.match(projectName).project;
}
/**
* Equivalent to {@link listLogMetrics}, but returns a NodeJS Stream object.
*
* This fetches the paged responses for {@link listLogMetrics} continuously
* and invokes the callback registered for 'data' event for each element in the
* responses.
*
* The returned object has 'end' method when no more elements are required.
*
* autoPaginate option will be ignored.
*
* @see {@link https://nodejs.org/api/stream.html}
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the project containing the metrics:
*
* "projects/[PROJECT_ID]"
* @param {string} [request.pageToken]
* Optional. If present, then retrieve the next batch of results from the
* preceding call to this method. `pageToken` must be the value of
* `nextPageToken` from the previous response. The values of other method
* parameters should be identical to those in the previous call.
* @param {number} [request.pageSize]
* Optional. The maximum number of results to return from this request.
* Non-positive values are ignored. The presence of `nextPageToken` in the
* response indicates that more results might be available.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Stream}
* An object stream which emits an object representing [LogMetric]{@link google.logging.v2.LogMetric} on 'data' event.
*/
listLogMetricsStream(request, options) {
request = request || {};
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
const callSettings = new gax.CallSettings(options);
this.initialize();
return this.descriptors.page.listLogMetrics.createStream(this.innerApiCalls.listLogMetrics, request, callSettings);
}
/**
* Equivalent to {@link listLogMetrics}, but returns an iterable object.
*
* for-await-of syntax is used with the iterable to recursively get response element on-demand.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the project containing the metrics:
*
* "projects/[PROJECT_ID]"
* @param {string} [request.pageToken]
* Optional. If present, then retrieve the next batch of results from the
* preceding call to this method. `pageToken` must be the value of
* `nextPageToken` from the previous response. The values of other method
* parameters should be identical to those in the previous call.
* @param {number} [request.pageSize]
* Optional. The maximum number of results to return from this request.
* Non-positive values are ignored. The presence of `nextPageToken` in the
* response indicates that more results might be available.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Object}
* An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.
*/
listLogMetricsAsync(request, options) {
request = request || {};
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
options = options || {};
const callSettings = new gax.CallSettings(options);
this.initialize();
return this.descriptors.page.listLogMetrics.asyncIterate(this.innerApiCalls['listLogMetrics'], request, callSettings);
}
// --------------------
// -- Path templates --
// --------------------
/**
* Return a fully-qualified billingAccountCmekSettings resource name string.
*
* @param {string} billing_account
* @returns {string} Resource name string.
*/
billingAccountCmekSettingsPath(billingAccount) {
return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({
billing_account: billingAccount,
});
}
/**
* Parse the billing_account from BillingAccountCmekSettings resource.
*
* @param {string} billingAccountCmekSettingsName
* A fully-qualified path representing billing_account_cmekSettings resource.
* @returns {string} A string representing the billing_account.
*/
matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName) {
return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account;
}
/**
* Return a fully-qualified billingAccountExclusion resource name string.
*
* @param {string} billing_account
* @param {string} exclusion
* @returns {string} Resource name string.
*/
billingAccountExclusionPath(billingAccount, exclusion) {
return this.pathTemplates.billingAccountExclusionPathTemplate.render({
billing_account: billingAccount,
exclusion: exclusion,
});
}
/**
* Parse the billing_account from BillingAccountExclusion resource.
*
* @param {string} billingAccountExclusionName
* A fully-qualified path representing billing_account_exclusion resource.
* @returns {string} A string representing the billing_account.
*/
matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName) {
return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account;
}
/**
* Parse the exclusion from BillingAccountExclusion resource.
*
* @param {string} billingAccountExclusionName
* A fully-qualified path representing billing_account_exclusion resource.
* @returns {string} A string representing the exclusion.
*/
matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName) {
return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion;
}
/**
* Return a fully-qualified billingAccountLocationBucket resource name string.
*
* @param {string} billing_account
* @param {string} location
* @param {string} bucket
* @returns {string} Resource name string.
*/
billingAccountLocationBucketPath(billingAccount, location, bucket) {
return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({
billing_account: billingAccount,
location: location,
bucket: bucket,
});
}
/**
* Parse the billing_account from BillingAccountLocationBucket resource.
*
* @param {string} billingAccountLocationBucketName
* A fully-qualified path representing billing_account_location_bucket resource.
* @returns {string} A string representing the billing_account.
*/
matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName) {
return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account;
}
/**
* Parse the location from BillingAccountLocationBucket resource.
*
* @param {string} billingAccountLocationBucketName
* A fully-qualified path representing billing_account_location_bucket resource.
* @returns {string} A string representing the location.
*/
matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName) {
return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location;
}
/**
* Parse the bucket from BillingAccountLocationBucket resource.
*
* @param {string} billingAccountLocationBucketName
* A fully-qualified path representing billing_account_location_bucket resource.
* @returns {string} A string representing the bucket.
*/
matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName) {
return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket;
}
/**
* Return a fully-qualified billingAccountLog resource name string.
*
* @param {string} billing_account
* @param {string} log
* @returns {string} Resource name string.
*/
billingAccountLogPath(billingAccount, log) {
return this.pathTemplates.billingAccountLogPathTemplate.render({
billing_account: billingAccount,
log: log,
});
}
/**
* Parse the billing_account from BillingAccountLog resource.
*
* @param {string} billingAccountLogName
* A fully-qualified path representing billing_account_log resource.
* @returns {string} A string representing the billing_account.
*/
matchBillingAccountFromBillingAccountLogName(billingAccountLogName) {
return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account;
}
/**
* Parse the log from BillingAccountLog resource.
*
* @param {string} billingAccountLogName
* A fully-qualified path representing billing_account_log resource.
* @returns {string} A string representing the log.
*/
matchLogFromBillingAccountLogName(billingAccountLogName) {
return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log;
}
/**
* Return a fully-qualified billingAccountSink resource name string.
*
* @param {string} billing_account
* @param {string} sink
* @returns {string} Resource name string.
*/
billingAccountSinkPath(billingAccount, sink) {
return this.pathTemplates.billingAccountSinkPathTemplate.render({
billing_account: billingAccount,
sink: sink,
});
}
/**
* Parse the billing_account from BillingAccountSink resource.
*
* @param {string} billingAccountSinkName
* A fully-qualified path representing billing_account_sink resource.
* @returns {string} A string representing the billing_account.
*/
matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName) {
return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account;
}
/**
* Parse the sink from BillingAccountSink resource.
*
* @param {string} billingAccountSinkName
* A fully-qualified path representing billing_account_sink resource.
* @returns {string} A string representing the sink.
*/
matchSinkFromBillingAccountSinkName(billingAccountSinkName) {
return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink;
}
/**
* Return a fully-qualified folderCmekSettings resource name string.
*
* @param {string} folder
* @returns {string} Resource name string.
*/
folderCmekSettingsPath(folder) {
return this.pathTemplates.folderCmekSettingsPathTemplate.render({
folder: folder,
});
}
/**
* Parse the folder from FolderCmekSettings resource.
*
* @param {string} folderCmekSettingsName
* A fully-qualified path representing folder_cmekSettings resource.
* @returns {string} A string representing the folder.
*/
matchFolderFromFolderCmekSettingsName(folderCmekSettingsName) {
return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder;
}
/**
* Return a fully-qualified folderExclusion resource name string.
*
* @param {string} folder
* @param {string} exclusion
* @returns {string} Resource name string.
*/
folderExclusionPath(folder, exclusion) {
return this.pathTemplates.folderExclusionPathTemplate.render({
folder: folder,
exclusion: exclusion,
});
}
/**
* Parse the folder from FolderExclusion resource.
*
* @param {string} folderExclusionName
* A fully-qualified path representing folder_exclusion resource.
* @returns {string} A string representing the folder.
*/
matchFolderFromFolderExclusionName(folderExclusionName) {
return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder;
}
/**
* Parse the exclusion from FolderExclusion resource.
*
* @param {string} folderExclusionName
* A fully-qualified path representing folder_exclusion resource.
* @returns {string} A string representing the exclusion.
*/
matchExclusionFromFolderExclusionName(folderExclusionName) {
return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion;
}
/**
* Return a fully-qualified folderLocationBucket resource name string.
*
* @param {string} folder
* @param {string} location
* @param {string} bucket
* @returns {string} Resource name string.
*/
folderLocationBucketPath(folder, location, bucket) {
return this.pathTemplates.folderLocationBucketPathTemplate.render({
folder: folder,
location: location,
bucket: bucket,
});
}
/**
* Parse the folder from FolderLocationBucket resource.
*
* @param {string} folderLocationBucketName
* A fully-qualified path representing folder_location_bucket resource.
* @returns {string} A string representing the folder.
*/
matchFolderFromFolderLocationBucketName(folderLocationBucketName) {
return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder;
}
/**
* Parse the location from FolderLocationBucket resource.
*
* @param {string} folderLocationBucketName
* A fully-qualified path representing folder_location_bucket resource.
* @returns {string} A string representing the location.
*/
matchLocationFromFolderLocationBucketName(folderLocationBucketName) {
return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location;
}
/**
* Parse the bucket from FolderLocationBucket resource.
*
* @param {string} folderLocationBucketName
* A fully-qualified path representing folder_location_bucket resource.
* @returns {string} A string representing the bucket.
*/
matchBucketFromFolderLocationBucketName(folderLocationBucketName) {
return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket;
}
/**
* Return a fully-qualified folderLog resource name string.
*
* @param {string} folder
* @param {string} log
* @returns {string} Resource name string.
*/
folderLogPath(folder, log) {
return this.pathTemplates.folderLogPathTemplate.render({
folder: folder,
log: log,
});
}
/**
* Parse the folder from FolderLog resource.
*
* @param {string} folderLogName
* A fully-qualified path representing folder_log resource.
* @returns {string} A string representing the folder.
*/
matchFolderFromFolderLogName(folderLogName) {
return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder;
}
/**
* Parse the log from FolderLog resource.
*
* @param {string} folderLogName
* A fully-qualified path representing folder_log resource.
* @returns {string} A string representing the log.
*/
matchLogFromFolderLogName(folderLogName) {
return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log;
}
/**
* Return a fully-qualified folderSink resource name string.
*
* @param {string} folder
* @param {string} sink
* @returns {string} Resource name string.
*/
folderSinkPath(folder, sink) {
return this.pathTemplates.folderSinkPathTemplate.render({
folder: folder,
sink: sink,
});
}
/**
* Parse the folder from FolderSink resource.
*
* @param {string} folderSinkName
* A fully-qualified path representing folder_sink resource.
* @returns {string} A string representing the folder.
*/
matchFolderFromFolderSinkName(folderSinkName) {
return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName)
.folder;
}
/**
* Parse the sink from FolderSink resource.
*
* @param {string} folderSinkName
* A fully-qualified path representing folder_sink resource.
* @returns {string} A string representing the sink.
*/
matchSinkFromFolderSinkName(folderSinkName) {
return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink;
}
/**
* Return a fully-qualified logMetric resource name string.
*
* @param {string} project
* @param {string} metric
* @returns {string} Resource name string.
*/
logMetricPath(project, metric) {
return this.pathTemplates.logMetricPathTemplate.render({
project: project,
metric: metric,
});
}
/**
* Parse the project from LogMetric resource.
*
* @param {string} logMetricName
* A fully-qualified path representing LogMetric resource.
* @returns {string} A string representing the project.
*/
matchProjectFromLogMetricName(logMetricName) {
return this.pathTemplates.logMetricPathTemplate.match(logMetricName)
.project;
}
/**
* Parse the metric from LogMetric resource.
*
* @param {string} logMetricName
* A fully-qualified path representing LogMetric resource.
* @returns {string} A string representing the metric.
*/
matchMetricFromLogMetricName(logMetricName) {
return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric;
}
/**
* Return a fully-qualified organizationCmekSettings resource name string.
*
* @param {string} organization
* @returns {string} Resource name string.
*/
organizationCmekSettingsPath(organization) {
return this.pathTemplates.organizationCmekSettingsPathTemplate.render({
organization: organization,
});
}
/**
* Parse the organization from OrganizationCmekSettings resource.
*
* @param {string} organizationCmekSettingsName
* A fully-qualified path representing organization_cmekSettings resource.
* @returns {string} A string representing the organization.
*/
matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName) {
return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization;
}
/**
* Return a fully-qualified organizationExclusion resource name string.
*
* @param {string} organization
* @param {string} exclusion
* @returns {string} Resource name string.
*/
organizationExclusionPath(organization, exclusion) {
return this.pathTemplates.organizationExclusionPathTemplate.render({
organization: organization,
exclusion: exclusion,
});
}
/**
* Parse the organization from OrganizationExclusion resource.
*
* @param {string} organizationExclusionName
* A fully-qualified path representing organization_exclusion resource.
* @returns {string} A string representing the organization.
*/
matchOrganizationFromOrganizationExclusionName(organizationExclusionName) {
return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization;
}
/**
* Parse the exclusion from OrganizationExclusion resource.
*
* @param {string} organizationExclusionName
* A fully-qualified path representing organization_exclusion resource.
* @returns {string} A string representing the exclusion.
*/
matchExclusionFromOrganizationExclusionName(organizationExclusionName) {
return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion;
}
/**
* Return a fully-qualified organizationLocationBucket resource name string.
*
* @param {string} organization
* @param {string} location
* @param {string} bucket
* @returns {string} Resource name string.
*/
organizationLocationBucketPath(organization, location, bucket) {
return this.pathTemplates.organizationLocationBucketPathTemplate.render({
organization: organization,
location: location,
bucket: bucket,
});
}
/**
* Parse the organization from OrganizationLocationBucket resource.
*
* @param {string} organizationLocationBucketName
* A fully-qualified path representing organization_location_bucket resource.
* @returns {string} A string representing the organization.
*/
matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName) {
return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization;
}
/**
* Parse the location from OrganizationLocationBucket resource.
*
* @param {string} organizationLocationBucketName
* A fully-qualified path representing organization_location_bucket resource.
* @returns {string} A string representing the location.
*/
matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName) {
return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location;
}
/**
* Parse the bucket from OrganizationLocationBucket resource.
*
* @param {string} organizationLocationBucketName
* A fully-qualified path representing organization_location_bucket resource.
* @returns {string} A string representing the bucket.
*/
matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName) {
return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket;
}
/**
* Return a fully-qualified organizationLog resource name string.
*
* @param {string} organization
* @param {string} log
* @returns {string} Resource name string.
*/
organizationLogPath(organization, log) {
return this.pathTemplates.organizationLogPathTemplate.render({
organization: organization,
log: log,
});
}
/**
* Parse the organization from OrganizationLog resource.
*
* @param {string} organizationLogName
* A fully-qualified path representing organization_log resource.
* @returns {string} A string representing the organization.
*/
matchOrganizationFromOrganizationLogName(organizationLogName) {
return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization;
}
/**
* Parse the log from OrganizationLog resource.
*
* @param {string} organizationLogName
* A fully-qualified path representing organization_log resource.
* @returns {string} A string representing the log.
*/
matchLogFromOrganizationLogName(organizationLogName) {
return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log;
}
/**
* Return a fully-qualified organizationSink resource name string.
*
* @param {string} organization
* @param {string} sink
* @returns {string} Resource name string.
*/
organizationSinkPath(organization, sink) {
return this.pathTemplates.organizationSinkPathTemplate.render({
organization: organization,
sink: sink,
});
}
/**
* Parse the organization from OrganizationSink resource.
*
* @param {string} organizationSinkName
* A fully-qualified path representing organization_sink resource.
* @returns {string} A string representing the organization.
*/
matchOrganizationFromOrganizationSinkName(organizationSinkName) {
return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization;
}
/**
* Parse the sink from OrganizationSink resource.
*
* @param {string} organizationSinkName
* A fully-qualified path representing organization_sink resource.
* @returns {string} A string representing the sink.
*/
matchSinkFromOrganizationSinkName(organizationSinkName) {
return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink;
}
/**
* Return a fully-qualified project resource name string.
*
* @param {string} project
* @returns {string} Resource name string.
*/
projectPath(project) {
return this.pathTemplates.projectPathTemplate.render({
project: project,
});
}
/**
* Parse the project from Project resource.
*
* @param {string} projectName
* A fully-qualified path representing Project resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectName(projectName) {
return this.pathTemplates.projectPathTemplate.match(projectName).project;
}
/**
* Return a fully-qualified projectCmekSettings resource name string.
*
* @param {string} project
* @returns {string} Resource name string.
*/
projectCmekSettingsPath(project) {
return this.pathTemplates.projectCmekSettingsPathTemplate.render({
project: project,
});
}
/**
* Parse the project from ProjectCmekSettings resource.
*
* @param {string} projectCmekSettingsName
* A fully-qualified path representing project_cmekSettings resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectCmekSettingsName(projectCmekSettingsName) {
return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project;
}
/**
* Return a fully-qualified projectExclusion resource name string.
*
* @param {string} project
* @param {string} exclusion
* @returns {string} Resource name string.
*/
projectExclusionPath(project, exclusion) {
return this.pathTemplates.projectExclusionPathTemplate.render({
project: project,
exclusion: exclusion,
});
}
/**
* Parse the project from ProjectExclusion resource.
*
* @param {string} projectExclusionName
* A fully-qualified path representing project_exclusion resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectExclusionName(projectExclusionName) {
return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project;
}
/**
* Parse the exclusion from ProjectExclusion resource.
*
* @param {string} projectExclusionName
* A fully-qualified path representing project_exclusion resource.
* @returns {string} A string representing the exclusion.
*/
matchExclusionFromProjectExclusionName(projectExclusionName) {
return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion;
}
/**
* Return a fully-qualified projectLocationBucket resource name string.
*
* @param {string} project
* @param {string} location
* @param {string} bucket
* @returns {string} Resource name string.
*/
projectLocationBucketPath(project, location, bucket) {
return this.pathTemplates.projectLocationBucketPathTemplate.render({
project: project,
location: location,
bucket: bucket,
});
}
/**
* Parse the project from ProjectLocationBucket resource.
*
* @param {string} projectLocationBucketName
* A fully-qualified path representing project_location_bucket resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectLocationBucketName(projectLocationBucketName) {
return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project;
}
/**
* Parse the location from ProjectLocationBucket resource.
*
* @param {string} projectLocationBucketName
* A fully-qualified path representing project_location_bucket resource.
* @returns {string} A string representing the location.
*/
matchLocationFromProjectLocationBucketName(projectLocationBucketName) {
return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location;
}
/**
* Parse the bucket from ProjectLocationBucket resource.
*
* @param {string} projectLocationBucketName
* A fully-qualified path representing project_location_bucket resource.
* @returns {string} A string representing the bucket.
*/
matchBucketFromProjectLocationBucketName(projectLocationBucketName) {
return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket;
}
/**
* Return a fully-qualified projectLog resource name string.
*
* @param {string} project
* @param {string} log
* @returns {string} Resource name string.
*/
projectLogPath(project, log) {
return this.pathTemplates.projectLogPathTemplate.render({
project: project,
log: log,
});
}
/**
* Parse the project from ProjectLog resource.
*
* @param {string} projectLogName
* A fully-qualified path representing project_log resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectLogName(projectLogName) {
return this.pathTemplates.projectLogPathTemplate.match(projectLogName)
.project;
}
/**
* Parse the log from ProjectLog resource.
*
* @param {string} projectLogName
* A fully-qualified path representing project_log resource.
* @returns {string} A string representing the log.
*/
matchLogFromProjectLogName(projectLogName) {
return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log;
}
/**
* Return a fully-qualified projectSink resource name string.
*
* @param {string} project
* @param {string} sink
* @returns {string} Resource name string.
*/
projectSinkPath(project, sink) {
return this.pathTemplates.projectSinkPathTemplate.render({
project: project,
sink: sink,
});
}
/**
* Parse the project from ProjectSink resource.
*
* @param {string} projectSinkName
* A fully-qualified path representing project_sink resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectSinkName(projectSinkName) {
return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName)
.project;
}
/**
* Parse the sink from ProjectSink resource.
*
* @param {string} projectSinkName
* A fully-qualified path representing project_sink resource.
* @returns {string} A string representing the sink.
*/
matchSinkFromProjectSinkName(projectSinkName) {
return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName)
.sink;
}
/**
* Terminate the GRPC channel and close the client.
*
* The client will no longer be usable and all future behavior is undefined.
*/
close() {
this.initialize();
if (!this._terminated) {
return this.metricsServiceV2Stub.then(stub => {
this._terminated = true;
stub.close();
});
}
return Promise.resolve();
}
}
module.exports = MetricsServiceV2Client;
exports.MetricsServiceV2Client = MetricsServiceV2Client;
//# sourceMappingURL=metrics_service_v2_client.js.map
{
"name": "@google-cloud/logging",
"version": "8.0.0-beta.0",
"description": "Stackdriver Logging Client Library for Node.js",
"version": "7.3.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=8.10.0"
},
"repository": "googleapis/nodejs-logging",
"main": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"files": [
"build/src",
"build/protos"
],
"keywords": [

@@ -31,83 +19,93 @@ "google apis client",

],
"repository": "googleapis/nodejs-logging",
"license": "Apache-2.0",
"author": "Google Inc.",
"main": "build/src/index.js",
"files": [
"build/src",
"build/protos"
],
"scripts": {
"test": "c8 mocha --recursive ./build/test",
"clean": "gts clean",
"compile": "tsc -p . && cp -r proto* build/",
"compile-protos": "compileProtos src",
"predocs": "npm run compile",
"docs": "jsdoc -c .jsdoc.js",
"predocs": "npm run compile",
"predocs-test": "npm run docs",
"docs-test": "linkinator docs",
"fix": "gts fix",
"prelint": "cd samples; npm link ../; npm install",
"lint": "gts fix",
"prepare": "npm run compile",
"samples-test": "cd samples/ && npm link ../ && rm -rf node_modules && npm install && npm test && cd ../",
"presystem-test": "npm run compile",
"system-test": "c8 mocha build/system-test --timeout 600000",
"samples-test": "cd samples/ && c8 npm test && cd ../",
"lint": "gts check && eslint '**/*.js'",
"check": "gts check",
"clean": "gts clean",
"compile": "tsc -p . && cp -r src/v2 build/src/v2 && cp -r protos build && cp test/*.js build/test",
"fix": "gts fix && eslint --fix '**/*.js'",
"prepare": "npm run compile",
"system-test": "mocha build/system-test --timeout 600000",
"pretest": "npm run compile",
"posttest": "npm run check",
"docs-test": "linkinator docs",
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm i"
"test": "c8 mocha build/test"
},
"dependencies": {
"@google-cloud/common": "^2.2.2",
"@google-cloud/paginator": "^2.0.0",
"@google-cloud/projectify": "^1.0.0",
"@google-cloud/promisify": "^1.0.0",
"@opencensus/propagation-stackdriver": "0.0.20",
"arrify": "^2.0.0",
"dot-prop": "^5.1.0",
"@google-cloud/common": "^2.4.0",
"@google-cloud/paginator": "^3.0.0",
"@google-cloud/projectify": "^1.0.4",
"@google-cloud/promisify": "^2.0.0",
"@opencensus/propagation-stackdriver": "0.0.21",
"arrify": "^2.0.1",
"dot-prop": "^5.2.0",
"eventid": "^1.0.0",
"extend": "^3.0.2",
"gcp-metadata": "^3.1.0",
"google-auth-library": "^5.2.2",
"google-gax": "^1.11.0",
"gcp-metadata": "^3.5.0",
"google-auth-library": "^5.10.1",
"google-gax": "^2.1.0",
"is": "^3.3.0",
"on-finished": "^2.3.0",
"pumpify": "^2.0.0",
"snakecase-keys": "^3.0.0",
"stream-events": "^1.0.4",
"through2": "^3.0.0",
"type-fest": "^0.12.0"
"pumpify": "^2.0.1",
"snakecase-keys": "^3.1.2",
"stream-events": "^1.0.5",
"through2": "^3.0.1",
"type-fest": "^0.13.0"
},
"devDependencies": {
"@google-cloud/bigquery": "^4.0.0",
"@google-cloud/pubsub": "^1.0.0",
"@google-cloud/storage": "^4.0.0",
"@types/extend": "^3.0.0",
"@google-cloud/bigquery": "^4.7.0",
"@google-cloud/pubsub": "^1.6.0",
"@google-cloud/storage": "^4.6.0",
"@types/extend": "^3.0.1",
"@types/is": "0.0.21",
"@types/mocha": "^7.0.0",
"@types/mocha": "^7.0.2",
"@types/mv": "^2.1.0",
"@types/ncp": "^2.0.1",
"@types/ncp": "^2.0.3",
"@types/node": "^13.9.2",
"@types/on-finished": "^2.3.1",
"@types/proxyquire": "^1.3.28",
"@types/pumpify": "^1.4.1",
"@types/sinon": "^7.0.8",
"@types/sinon": "^9.0.0",
"@types/through2": "^2.0.34",
"@types/tmp": "^0.1.0",
"@types/uuid": "^3.4.4",
"assert-rejects": "^1.0.0",
"@types/uuid": "^7.0.2",
"bignumber.js": "^9.0.0",
"c8": "^7.0.0",
"codecov": "^3.0.4",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.0.0",
"c8": "^7.1.0",
"codecov": "^3.6.5",
"execa": "^4.0.0",
"gts": "^1.0.0",
"gts": "^2.0.0",
"http2spy": "^1.1.0",
"jsdoc": "^3.6.2",
"jsdoc-fresh": "^1.0.1",
"jsdoc-region-tag": "^1.0.2",
"linkinator": "^2.0.0",
"mocha": "^7.0.0",
"jsdoc": "^3.6.3",
"jsdoc-fresh": "^1.0.2",
"jsdoc-region-tag": "^1.0.4",
"linkinator": "^2.0.3",
"mocha": "^7.1.1",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"nock": "^12.0.0",
"prettier": "^1.15.1",
"proxyquire": "^2.1.0",
"sinon": "^9.0.0",
"typescript": "3.6.4",
"uuid": "^3.3.2"
"nock": "^12.0.3",
"null-loader": "^4.0.0",
"pack-n-play": "^1.0.0-2",
"proxyquire": "^2.1.3",
"sinon": "^9.0.1",
"ts-loader": "^7.0.0",
"typescript": "^3.8.3",
"uuid": "^7.0.2",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11"
},
"engines": {
"node": ">=10"
}
}

@@ -77,2 +77,4 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost."

resource: {type: 'global'},
// See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity
severity: 'INFO',
};

@@ -130,2 +132,23 @@

## Supported Node.js Versions
Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Libraries are compatible with all current _active_ and _maintenance_ versions of
Node.js.
Client libraries targetting some end-of-life versions of Node.js are available, and
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
The dist-tags follow the naming convention `legacy-(version)`.
_Legacy Node.js versions are supported as a best effort:_
* Legacy versions will not be tested in continuous integration.
* Some security patches may not be able to be backported.
* Dependencies will not be kept up-to-date, and features will not be backported.
#### Legacy tags available
* `legacy-8`: install client libraries from this dist-tag for versions
compatible with Node.js 8.
## Versioning

@@ -154,2 +177,8 @@

Please note that this `README.md`, the `samples/README.md`,
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
are generated from a central template. To edit one of these files, make an edit
to its template in this
[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
## License

@@ -156,0 +185,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc