Module: Google::Cloud::CloudSecurityCompliance::V1::CmEnrollmentService::Paths

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

Overview

Path helper methods for the CmEnrollmentService API.

Instance Method Summary collapse

Instance Method Details

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

Create a fully-qualified CmEnrollment resource string.

Overloads:

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

    The resource will be in the following format:

    organizations/{organization}/locations/{location}/cmEnrollment

    Parameters:

    • organization (String)
    • location (String)
  • #cm_enrollment_path(project:, location:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/cmEnrollment

    Parameters:

    • project (String)
    • location (String)

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/cloud_security_compliance/v1/cm_enrollment_service/paths.rb', line 47

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

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

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

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