Module: Google::Cloud::Monitoring::V3::ServiceMonitoringService::Paths

Extended by:
Paths
Included in:
Client, Paths
Defined in:
lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb

Overview

Path helper methods for the ServiceMonitoringService API.

Instance Method Summary collapse

Instance Method Details

#folder_path(folder:) ⇒ ::String

Create a fully-qualified Folder resource string.

The resource will be in the following format:

folders/{folder}

Parameters:

  • folder (String)

Returns:

  • (::String)


37
38
39
# File 'lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb', line 37

def folder_path folder:
  "folders/#{folder}"
end

#organization_path(organization:) ⇒ ::String

Create a fully-qualified Organization resource string.

The resource will be in the following format:

organizations/{organization}

Parameters:

  • organization (String)

Returns:

  • (::String)


51
52
53
# File 'lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb', line 51

def organization_path organization:
  "organizations/#{organization}"
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)


65
66
67
# File 'lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb', line 65

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

#service_level_objective_path(project: , service: , service_level_objective: ) ⇒ ::String #service_level_objective_path(organization: , service: , service_level_objective: ) ⇒ ::String #service_level_objective_path(folder: , service: , service_level_objective: ) ⇒ ::String

Create a fully-qualified ServiceLevelObjective resource string.

Overloads:

  • #service_level_objective_path(project: , service: , service_level_objective: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}

    Parameters:

    • project (String) (defaults to: )
    • service (String) (defaults to: )
    • service_level_objective (String) (defaults to: )
  • #service_level_objective_path(organization: , service: , service_level_objective: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}

    Parameters:

    • organization (String) (defaults to: )
    • service (String) (defaults to: )
    • service_level_objective (String) (defaults to: )
  • #service_level_objective_path(folder: , service: , service_level_objective: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}

    Parameters:

    • folder (String) (defaults to: )
    • service (String) (defaults to: )
    • service_level_objective (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb', line 152

def service_level_objective_path **args
  resources = {
    "project:service:service_level_objective" => (proc do |project:, service:, service_level_objective:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "service cannot contain /" if service.to_s.include? "/"

      "projects/#{project}/services/#{service}/serviceLevelObjectives/#{service_level_objective}"
    end),
    "organization:service:service_level_objective" => (proc do |organization:, service:, service_level_objective:|
      raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
      raise ::ArgumentError, "service cannot contain /" if service.to_s.include? "/"

      "organizations/#{organization}/services/#{service}/serviceLevelObjectives/#{service_level_objective}"
    end),
    "folder:service:service_level_objective" => (proc do |folder:, service:, service_level_objective:|
      raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
      raise ::ArgumentError, "service cannot contain /" if service.to_s.include? "/"

      "folders/#{folder}/services/#{service}/serviceLevelObjectives/#{service_level_objective}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end

#service_path(project: , service: ) ⇒ ::String #service_path(organization: , service: ) ⇒ ::String #service_path(folder: , service: ) ⇒ ::String

Create a fully-qualified Service resource string.

Overloads:

  • #service_path(project: , service: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/services/{service}

    Parameters:

    • project (String) (defaults to: )
    • service (String) (defaults to: )
  • #service_path(organization: , service: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/services/{service}

    Parameters:

    • organization (String) (defaults to: )
    • service (String) (defaults to: )
  • #service_path(folder: , service: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/services/{service}

    Parameters:

    • folder (String) (defaults to: )
    • service (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb', line 97

def service_path **args
  resources = {
    "project:service" => (proc do |project:, service:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/services/#{service}"
    end),
    "organization:service" => (proc do |organization:, service:|
      raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"

      "organizations/#{organization}/services/#{service}"
    end),
    "folder:service" => (proc do |folder:, service:|
      raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"

      "folders/#{folder}/services/#{service}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end

#workspace_path(project: ) ⇒ ::String #workspace_path(workspace: ) ⇒ ::String

Create a fully-qualified Workspace resource string.

Overloads:

  • #workspace_path(project: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}

    Parameters:

    • project (String) (defaults to: )
  • #workspace_path(workspace: ) ⇒ ::String

    The resource will be in the following format:

    workspaces/{workspace}

    Parameters:

    • workspace (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/google/cloud/monitoring/v3/service_monitoring_service/paths.rb', line 197

def workspace_path **args
  resources = {
    "project" => (proc do |project:|
      "projects/#{project}"
    end),
    "workspace" => (proc do |workspace:|
      "workspaces/#{workspace}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end