MetricsServiceV2Client

v2~ MetricsServiceV2Client

Service for configuring logs-based metrics.

Constructor

new MetricsServiceV2Client(optionsopt)

Construct an instance of MetricsServiceV2Client.

Parameters:
Name Type Attributes Description
options object <optional>

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

Properties
Name Type Attributes Description
credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
email string <optional>

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

keyFilename string <optional>

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.

port number <optional>

The port on which to connect to the remote host.

projectId string <optional>

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.

apiEndpoint string <optional>

The domain name of the API remote host.

Members

(static) apiEndpoint

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

(static) port

The port for this API service.

(static) scopes

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

(static) servicePath

The DNS address for this API service.

Methods

billingAccountCmekSettingsPath(billing_account) → {string}

Return a fully-qualified billingAccountCmekSettings resource name string.

Parameters:
Name Type Description
billing_account string

billingAccountExclusionPath(billing_account, exclusion) → {string}

Return a fully-qualified billingAccountExclusion resource name string.

Parameters:
Name Type Description
billing_account string
exclusion string

billingAccountLocationBucketPath(billing_account, location, bucket) → {string}

Return a fully-qualified billingAccountLocationBucket resource name string.

Parameters:
Name Type Description
billing_account string
location string
bucket string

billingAccountLogPath(billing_account, log) → {string}

Return a fully-qualified billingAccountLog resource name string.

Parameters:
Name Type Description
billing_account string
log string

billingAccountSinkPath(billing_account, sink) → {string}

Return a fully-qualified billingAccountSink resource name string.

Parameters:
Name Type Description
billing_account string
sink string

close()

Terminate the GRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

createLogMetric(request, optionsopt) → {Promise}

Creates a logs-based metric.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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.

metric google.logging.v2.LogMetric

Required. The new logs-based metric, which must not have an identifier that already exists.

options object <optional>

Call options. See CallOptions for more details.

deleteLogMetric(request, optionsopt) → {Promise}

Deletes a logs-based metric.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
metricName string

Required. The resource name of the metric to delete:

  "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
options object <optional>

Call options. See CallOptions for more details.

folderCmekSettingsPath(folder) → {string}

Return a fully-qualified folderCmekSettings resource name string.

Parameters:
Name Type Description
folder string

folderExclusionPath(folder, exclusion) → {string}

Return a fully-qualified folderExclusion resource name string.

Parameters:
Name Type Description
folder string
exclusion string

folderLocationBucketPath(folder, location, bucket) → {string}

Return a fully-qualified folderLocationBucket resource name string.

Parameters:
Name Type Description
folder string
location string
bucket string

folderLogPath(folder, log) → {string}

Return a fully-qualified folderLog resource name string.

Parameters:
Name Type Description
folder string
log string

folderSinkPath(folder, sink) → {string}

Return a fully-qualified folderSink resource name string.

Parameters:
Name Type Description
folder string
sink string

getLogMetric(request, optionsopt) → {Promise}

Gets a logs-based metric.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
metricName string

Required. The resource name of the desired metric:

  "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
options object <optional>

Call options. See CallOptions for more details.

getProjectId(callback)

Return the project ID used by this class.

Parameters:
Name Type Description
callback function

the callback to be called with the current project Id.

initialize() → {Promise}

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.

listLogMetrics(request, optionsopt) → {Promise}

Lists logs-based metrics.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Attributes Description
parent string

Required. The name of the project containing the metrics:

  "projects/[PROJECT_ID]"
pageToken string <optional>

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.

pageSize number <optional>

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.

options object <optional>

Call options. See CallOptions for more details.

listLogMetricsAsync(request, optionsopt) → {Object}

Equivalent to listLogMetrics, but returns an iterable object.

for-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Attributes Description
parent string

Required. The name of the project containing the metrics:

  "projects/[PROJECT_ID]"
pageToken string <optional>

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.

pageSize number <optional>

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.

options object <optional>

Call options. See CallOptions for more details.

listLogMetricsStream(request, optionsopt) → {Stream}

Equivalent to listLogMetrics, but returns a NodeJS Stream object.

This fetches the paged responses for 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.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Attributes Description
parent string

Required. The name of the project containing the metrics:

  "projects/[PROJECT_ID]"
pageToken string <optional>

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.

pageSize number <optional>

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.

options object <optional>

Call options. See CallOptions for more details.

See:

logMetricPath(project, metric) → {string}

Return a fully-qualified logMetric resource name string.

Parameters:
Name Type Description
project string
metric string

matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName) → {string}

Parse the billing_account from BillingAccountCmekSettings resource.

Parameters:
Name Type Description
billingAccountCmekSettingsName string

A fully-qualified path representing billing_account_cmekSettings resource.

matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName) → {string}

Parse the billing_account from BillingAccountExclusion resource.

Parameters:
Name Type Description
billingAccountExclusionName string

A fully-qualified path representing billing_account_exclusion resource.

matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName) → {string}

Parse the billing_account from BillingAccountLocationBucket resource.

Parameters:
Name Type Description
billingAccountLocationBucketName string

A fully-qualified path representing billing_account_location_bucket resource.

matchBillingAccountFromBillingAccountLogName(billingAccountLogName) → {string}

Parse the billing_account from BillingAccountLog resource.

Parameters:
Name Type Description
billingAccountLogName string

A fully-qualified path representing billing_account_log resource.

matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName) → {string}

Parse the billing_account from BillingAccountSink resource.

Parameters:
Name Type Description
billingAccountSinkName string

A fully-qualified path representing billing_account_sink resource.

matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName) → {string}

Parse the bucket from BillingAccountLocationBucket resource.

Parameters:
Name Type Description
billingAccountLocationBucketName string

A fully-qualified path representing billing_account_location_bucket resource.

matchBucketFromFolderLocationBucketName(folderLocationBucketName) → {string}

Parse the bucket from FolderLocationBucket resource.

Parameters:
Name Type Description
folderLocationBucketName string

A fully-qualified path representing folder_location_bucket resource.

matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName) → {string}

Parse the bucket from OrganizationLocationBucket resource.

Parameters:
Name Type Description
organizationLocationBucketName string

A fully-qualified path representing organization_location_bucket resource.

matchBucketFromProjectLocationBucketName(projectLocationBucketName) → {string}

Parse the bucket from ProjectLocationBucket resource.

Parameters:
Name Type Description
projectLocationBucketName string

A fully-qualified path representing project_location_bucket resource.

matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName) → {string}

Parse the exclusion from BillingAccountExclusion resource.

Parameters:
Name Type Description
billingAccountExclusionName string

A fully-qualified path representing billing_account_exclusion resource.

matchExclusionFromFolderExclusionName(folderExclusionName) → {string}

Parse the exclusion from FolderExclusion resource.

Parameters:
Name Type Description
folderExclusionName string

A fully-qualified path representing folder_exclusion resource.

matchExclusionFromOrganizationExclusionName(organizationExclusionName) → {string}

Parse the exclusion from OrganizationExclusion resource.

Parameters:
Name Type Description
organizationExclusionName string

A fully-qualified path representing organization_exclusion resource.

matchExclusionFromProjectExclusionName(projectExclusionName) → {string}

Parse the exclusion from ProjectExclusion resource.

Parameters:
Name Type Description
projectExclusionName string

A fully-qualified path representing project_exclusion resource.

matchFolderFromFolderCmekSettingsName(folderCmekSettingsName) → {string}

Parse the folder from FolderCmekSettings resource.

Parameters:
Name Type Description
folderCmekSettingsName string

A fully-qualified path representing folder_cmekSettings resource.

matchFolderFromFolderExclusionName(folderExclusionName) → {string}

Parse the folder from FolderExclusion resource.

Parameters:
Name Type Description
folderExclusionName string

A fully-qualified path representing folder_exclusion resource.

matchFolderFromFolderLocationBucketName(folderLocationBucketName) → {string}

Parse the folder from FolderLocationBucket resource.

Parameters:
Name Type Description
folderLocationBucketName string

A fully-qualified path representing folder_location_bucket resource.

matchFolderFromFolderLogName(folderLogName) → {string}

Parse the folder from FolderLog resource.

Parameters:
Name Type Description
folderLogName string

A fully-qualified path representing folder_log resource.

matchFolderFromFolderSinkName(folderSinkName) → {string}

Parse the folder from FolderSink resource.

Parameters:
Name Type Description
folderSinkName string

A fully-qualified path representing folder_sink resource.

matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName) → {string}

Parse the location from BillingAccountLocationBucket resource.

Parameters:
Name Type Description
billingAccountLocationBucketName string

A fully-qualified path representing billing_account_location_bucket resource.

matchLocationFromFolderLocationBucketName(folderLocationBucketName) → {string}

Parse the location from FolderLocationBucket resource.

Parameters:
Name Type Description
folderLocationBucketName string

A fully-qualified path representing folder_location_bucket resource.

matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName) → {string}

Parse the location from OrganizationLocationBucket resource.

Parameters:
Name Type Description
organizationLocationBucketName string

A fully-qualified path representing organization_location_bucket resource.

matchLocationFromProjectLocationBucketName(projectLocationBucketName) → {string}

Parse the location from ProjectLocationBucket resource.

Parameters:
Name Type Description
projectLocationBucketName string

A fully-qualified path representing project_location_bucket resource.

matchLogFromBillingAccountLogName(billingAccountLogName) → {string}

Parse the log from BillingAccountLog resource.

Parameters:
Name Type Description
billingAccountLogName string

A fully-qualified path representing billing_account_log resource.

matchLogFromFolderLogName(folderLogName) → {string}

Parse the log from FolderLog resource.

Parameters:
Name Type Description
folderLogName string

A fully-qualified path representing folder_log resource.

matchLogFromOrganizationLogName(organizationLogName) → {string}

Parse the log from OrganizationLog resource.

Parameters:
Name Type Description
organizationLogName string

A fully-qualified path representing organization_log resource.

matchLogFromProjectLogName(projectLogName) → {string}

Parse the log from ProjectLog resource.

Parameters:
Name Type Description
projectLogName string

A fully-qualified path representing project_log resource.

matchMetricFromLogMetricName(logMetricName) → {string}

Parse the metric from LogMetric resource.

Parameters:
Name Type Description
logMetricName string

A fully-qualified path representing LogMetric resource.

matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName) → {string}

Parse the organization from OrganizationCmekSettings resource.

Parameters:
Name Type Description
organizationCmekSettingsName string

A fully-qualified path representing organization_cmekSettings resource.

matchOrganizationFromOrganizationExclusionName(organizationExclusionName) → {string}

Parse the organization from OrganizationExclusion resource.

Parameters:
Name Type Description
organizationExclusionName string

A fully-qualified path representing organization_exclusion resource.

matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName) → {string}

Parse the organization from OrganizationLocationBucket resource.

Parameters:
Name Type Description
organizationLocationBucketName string

A fully-qualified path representing organization_location_bucket resource.

matchOrganizationFromOrganizationLogName(organizationLogName) → {string}

Parse the organization from OrganizationLog resource.

Parameters:
Name Type Description
organizationLogName string

A fully-qualified path representing organization_log resource.

matchOrganizationFromOrganizationSinkName(organizationSinkName) → {string}

Parse the organization from OrganizationSink resource.

Parameters:
Name Type Description
organizationSinkName string

A fully-qualified path representing organization_sink resource.

matchProjectFromLogMetricName(logMetricName) → {string}

Parse the project from LogMetric resource.

Parameters:
Name Type Description
logMetricName string

A fully-qualified path representing LogMetric resource.

matchProjectFromProjectCmekSettingsName(projectCmekSettingsName) → {string}

Parse the project from ProjectCmekSettings resource.

Parameters:
Name Type Description
projectCmekSettingsName string

A fully-qualified path representing project_cmekSettings resource.

matchProjectFromProjectExclusionName(projectExclusionName) → {string}

Parse the project from ProjectExclusion resource.

Parameters:
Name Type Description
projectExclusionName string

A fully-qualified path representing project_exclusion resource.

matchProjectFromProjectLocationBucketName(projectLocationBucketName) → {string}

Parse the project from ProjectLocationBucket resource.

Parameters:
Name Type Description
projectLocationBucketName string

A fully-qualified path representing project_location_bucket resource.

matchProjectFromProjectLogName(projectLogName) → {string}

Parse the project from ProjectLog resource.

Parameters:
Name Type Description
projectLogName string

A fully-qualified path representing project_log resource.

matchProjectFromProjectName(projectName) → {string}

Parse the project from Project resource.

Parameters:
Name Type Description
projectName string

A fully-qualified path representing Project resource.

matchProjectFromProjectSinkName(projectSinkName) → {string}

Parse the project from ProjectSink resource.

Parameters:
Name Type Description
projectSinkName string

A fully-qualified path representing project_sink resource.

matchSinkFromBillingAccountSinkName(billingAccountSinkName) → {string}

Parse the sink from BillingAccountSink resource.

Parameters:
Name Type Description
billingAccountSinkName string

A fully-qualified path representing billing_account_sink resource.

matchSinkFromFolderSinkName(folderSinkName) → {string}

Parse the sink from FolderSink resource.

Parameters:
Name Type Description
folderSinkName string

A fully-qualified path representing folder_sink resource.

matchSinkFromOrganizationSinkName(organizationSinkName) → {string}

Parse the sink from OrganizationSink resource.

Parameters:
Name Type Description
organizationSinkName string

A fully-qualified path representing organization_sink resource.

matchSinkFromProjectSinkName(projectSinkName) → {string}

Parse the sink from ProjectSink resource.

Parameters:
Name Type Description
projectSinkName string

A fully-qualified path representing project_sink resource.

organizationCmekSettingsPath(organization) → {string}

Return a fully-qualified organizationCmekSettings resource name string.

Parameters:
Name Type Description
organization string

organizationExclusionPath(organization, exclusion) → {string}

Return a fully-qualified organizationExclusion resource name string.

Parameters:
Name Type Description
organization string
exclusion string

organizationLocationBucketPath(organization, location, bucket) → {string}

Return a fully-qualified organizationLocationBucket resource name string.

Parameters:
Name Type Description
organization string
location string
bucket string

organizationLogPath(organization, log) → {string}

Return a fully-qualified organizationLog resource name string.

Parameters:
Name Type Description
organization string
log string

organizationSinkPath(organization, sink) → {string}

Return a fully-qualified organizationSink resource name string.

Parameters:
Name Type Description
organization string
sink string

projectCmekSettingsPath(project) → {string}

Return a fully-qualified projectCmekSettings resource name string.

Parameters:
Name Type Description
project string

projectExclusionPath(project, exclusion) → {string}

Return a fully-qualified projectExclusion resource name string.

Parameters:
Name Type Description
project string
exclusion string

projectLocationBucketPath(project, location, bucket) → {string}

Return a fully-qualified projectLocationBucket resource name string.

Parameters:
Name Type Description
project string
location string
bucket string

projectLogPath(project, log) → {string}

Return a fully-qualified projectLog resource name string.

Parameters:
Name Type Description
project string
log string

projectPath(project) → {string}

Return a fully-qualified project resource name string.

Parameters:
Name Type Description
project string

projectSinkPath(project, sink) → {string}

Return a fully-qualified projectSink resource name string.

Parameters:
Name Type Description
project string
sink string

updateLogMetric(request, optionsopt) → {Promise}

Creates or updates a logs-based metric.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
metricName string

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.

metric google.logging.v2.LogMetric

Required. The updated metric.

options object <optional>

Call options. See CallOptions for more details.