Module: Google::Cloud::Logging::V2::MetricsService::Paths

Extended by:
Paths
Included in:
Client, Paths
Defined in:
lib/google/cloud/logging/v2/metrics_service/paths.rb

Overview

Path helper methods for the MetricsService API.

Instance Method Summary collapse

Instance Method Details

#log_metric_path(project:, metric:) ⇒ ::String

Create a fully-qualified LogMetric resource string.

The resource will be in the following format:

projects/{project}/metrics/{metric}

Parameters:

  • project (String)
  • metric (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


38
39
40
41
42
# File 'lib/google/cloud/logging/v2/metrics_service/paths.rb', line 38

def log_metric_path project:, metric:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/metrics/#{metric}"
end

#project_path(project:) ⇒ ::String

Create a fully-qualified Project resource string.

The resource will be in the following format:

projects/{project}

Parameters:

  • project (String)

Returns:

  • (::String)


54
55
56
# File 'lib/google/cloud/logging/v2/metrics_service/paths.rb', line 54

def project_path project:
  "projects/#{project}"
end