Module: Google::Cloud::Monitoring::V3::SnoozeService::Paths
- Extended by:
- Paths
- Defined in:
- lib/google/cloud/monitoring/v3/snooze_service/paths.rb
Overview
Path helper methods for the SnoozeService API.
Instance Method Summary collapse
-
#alert_policy_path(**args) ⇒ ::String
Create a fully-qualified AlertPolicy resource string.
-
#project_path(project:) ⇒ ::String
Create a fully-qualified Project resource string.
-
#snooze_path(project:, snooze:) ⇒ ::String
Create a fully-qualified Snooze resource string.
-
#workspace_path(**args) ⇒ ::String
Create a fully-qualified Workspace resource string.
Instance Method Details
#alert_policy_path(project: , alert_policy: ) ⇒ ::String #alert_policy_path(organization: , alert_policy: ) ⇒ ::String #alert_policy_path(folder: , alert_policy: ) ⇒ ::String
Create a fully-qualified AlertPolicy resource string.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/google/cloud/monitoring/v3/snooze_service/paths.rb', line 55 def alert_policy_path **args resources = { "alert_policy:project" => (proc do |project:, alert_policy:| raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" "projects/#{project}/alertPolicies/#{alert_policy}" end), "alert_policy:organization" => (proc do |organization:, alert_policy:| raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/" "organizations/#{organization}/alertPolicies/#{alert_policy}" end), "alert_policy:folder" => (proc do |folder:, alert_policy:| raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/" "folders/#{folder}/alertPolicies/#{alert_policy}" end) } resource = resources[args.keys.sort.join(":")] raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil? resource.call(**args) end |
#project_path(project:) ⇒ ::String
Create a fully-qualified Project resource string.
The resource will be in the following format:
projects/{project}
89 90 91 |
# File 'lib/google/cloud/monitoring/v3/snooze_service/paths.rb', line 89 def project_path project: "projects/#{project}" end |
#snooze_path(project:, snooze:) ⇒ ::String
Create a fully-qualified Snooze resource string.
The resource will be in the following format:
projects/{project}/snoozes/{snooze}
104 105 106 107 108 |
# File 'lib/google/cloud/monitoring/v3/snooze_service/paths.rb', line 104 def snooze_path project:, snooze: raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" "projects/#{project}/snoozes/#{snooze}" end |
#workspace_path(project: ) ⇒ ::String #workspace_path(workspace: ) ⇒ ::String
Create a fully-qualified Workspace resource string.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/google/cloud/monitoring/v3/snooze_service/paths.rb', line 128 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 |