Module: Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/paths.rb

Overview

Path helper methods for the AdvisoryNotificationsService API.

Instance Method Summary collapse

Instance Method Details

#location_path(organization: , location: ) ⇒ ::String #location_path(project: , location: ) ⇒ ::String

Create a fully-qualified Location resource string.

Overloads:

  • #location_path(organization: , location: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/locations/{location}

    Parameters:

    • organization (String) (defaults to: )
    • location (String) (defaults to: )
  • #location_path(project: , location: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/paths.rb', line 47

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

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

      "projects/#{project}/locations/#{location}"
    end)
  }

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

#notification_path(organization: , location: , notification: ) ⇒ ::String #notification_path(project: , location: , notification: ) ⇒ ::String

Create a fully-qualified Notification resource string.

Overloads:

  • #notification_path(organization: , location: , notification: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/locations/{location}/notifications/{notification}

    Parameters:

    • organization (String) (defaults to: )
    • location (String) (defaults to: )
    • notification (String) (defaults to: )
  • #notification_path(project: , location: , notification: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/notifications/{notification}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • notification (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/paths.rb', line 88

def notification_path **args
  resources = {
    "location:notification:organization" => (proc do |organization:, location:, notification:|
      raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "organizations/#{organization}/locations/#{location}/notifications/#{notification}"
    end),
    "location:notification:project" => (proc do |project:, location:, notification:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "projects/#{project}/locations/#{location}/notifications/#{notification}"
    end)
  }

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

#settings_path(organization:, location:) ⇒ ::String

Create a fully-qualified Settings resource string.

The resource will be in the following format:

organizations/{organization}/locations/{location}/settings

Parameters:

  • organization (String)
  • location (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


120
121
122
123
124
# File 'lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/paths.rb', line 120

def settings_path organization:, location:
  raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"

  "organizations/#{organization}/locations/#{location}/settings"
end