Constructor

ConfigServiceV2Client

new ConfigServiceV2Client(options)

Construct an instance of ConfigServiceV2Client.

Parameter

options

Optional

object

The configuration object. See the subsequent parameters for more details.

Values in options have the following properties:

Parameter

credentials

Optional

object

Credentials object.

credentials.client_email

Optional

string

credentials.private_key

Optional

string

email

Optional

string

Account email address. Required when usaing a .pem or .p12 keyFilename.

keyFilename

Optional

string

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 above is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port

Optional

number

The port on which to connect to the remote host.

projectId

Optional

string

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 Application Default Credentials, your project ID will be detected automatically.

promise

Optional

function()

Custom promise module to use instead of native Promises.

servicePath

Optional

string

The domain name of the API remote host.

Properties

port

static

The port for this API service.

scopes

static

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static

The DNS address for this API service.

Methods

createExclusion

createExclusion(request, options, callback) returns Promise

Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The parent resource in which to create the exclusion:

  "projects/[PROJECT_ID]"
  "organizations/[ORGANIZATION_ID]"
  "billingAccounts/[BILLING_ACCOUNT_ID]"
  "folders/[FOLDER_ID]"

Examples: "projects/my-logging-project", "organizations/123456789".

exclusion

Object

Required. The new exclusion, whose name parameter is an exclusion name that is not already used in the parent resource.

This object should have the same structure as LogExclusion

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing LogExclusion.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is an object representing LogExclusion. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const logging = require('@google-cloud/logging');

var client = new logging.v2.ConfigServiceV2Client({
  // optional auth parameters.
});

var formattedParent = client.projectPath('[PROJECT]');
var exclusion = {};
var request = {
  parent: formattedParent,
  exclusion: exclusion,
};
client.createExclusion(request)
  .then(responses => {
    var response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

createSink

createSink(request, options, callback) returns Promise

Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

parent

string

Required. The resource in which to create the sink:

  "projects/[PROJECT_ID]"
  "organizations/[ORGANIZATION_ID]"
  "billingAccounts/[BILLING_ACCOUNT_ID]"
  "folders/[FOLDER_ID]"

Examples: "projects/my-logging-project", "organizations/123456789".

sink

Object

Required. The new sink, whose name parameter is a sink identifier that is not already in use.

This object should have the same structure as LogSink

uniqueWriterIdentity

Optional

boolean

Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Stackdriver Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.

If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing LogSink.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is an object representing LogSink. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const logging = require('@google-cloud/logging');

var client = new logging.v2.ConfigServiceV2Client({
  // optional auth parameters.
});

var formattedParent = client.projectPath('[PROJECT]');
var sink = {};
var request = {
  parent: formattedParent,
  sink: sink,
};
client.createSink(request)
  .then(responses => {
    var response = responses[0];
    // doThingsWith(response)
  })
  .catch(err => {
    console.error(err);
  });

deleteExclusion

deleteExclusion(request, options, callback) returns Promise

Deletes an exclusion.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

Required. The resource name of an existing exclusion to delete:

  "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
  "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
  "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
  "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"

Example: "projects/my-project-id/exclusions/my-exclusion-id".

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error)

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');

var client = new logging.v2.ConfigServiceV2Client({
  // optional auth parameters.
});

var formattedName = client.exclusionPath('[PROJECT]', '[EXCLUSION]');
client.deleteExclusion({name: formattedName}).catch(err => {
  console.error(err);
});

deleteSink

deleteSink(request, options, callback) returns Promise

Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

sinkName

string

Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:

  "projects/[PROJECT_ID]/sinks/[SINK_ID]"
  "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
  "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
  "folders/[FOLDER_ID]/sinks/[SINK_ID]"

Example: "projects/my-project-id/sinks/my-sink-id".

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error)

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');

var client = new logging.v2.ConfigServiceV2Client({
  // optional auth parameters.
});

var formattedSinkName = client.sinkPath('[PROJECT]', '[SINK]');
client.deleteSink({sinkName: formattedSinkName}).catch(err => {
  console.error(err);
});

exclusionPath

exclusionPath(project, exclusion) returns String

Return a fully-qualified exclusion resource name string.

Parameter

project

String

exclusion

String

Returns

String 

getExclusion

getExclusion(request, options, callback) returns Promise

Gets the description of an exclusion.

Parameter

request

Object

The request object that will be sent.

Values in request have the following properties:

Parameter

name

string

Required. The resource name of an existing exclusion:

  "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
  "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
  "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
  "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"

Example: "projects/my-project-id/exclusions/my-exclusion-id".

options

Optional

Object

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback

Optional

function(nullable Error, nullable Object)

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing LogExclusion.

Returns

Promise 

  • The promise which resolves to an array. The first element of the array is an object representing LogExclusion. The promise has a method named "cancel" which cancels the ongoing API call.

Example

const logging = require('@