Module: Google::Cloud::CloudSecurityCompliance::V1::Config::Paths

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

Overview

Path helper methods for the Config API.

Instance Method Summary collapse

Instance Method Details

#cloud_control_path(organization:, location:, cloud_control:) ⇒ ::String #cloud_control_path(project:, location:, cloud_control:) ⇒ ::String

Create a fully-qualified CloudControl resource string.

Overloads:

  • #cloud_control_path(organization:, location:, cloud_control:) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/locations/{location}/cloudControls/{cloud_control}

    Parameters:

    • organization (String)
    • location (String)
    • cloud_control (String)
  • #cloud_control_path(project:, location:, cloud_control:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/cloudControls/{cloud_control}

    Parameters:

    • project (String)
    • location (String)
    • cloud_control (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/google/cloud/cloud_security_compliance/v1/config/paths.rb', line 49

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

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

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

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

#framework_path(organization:, location:, framework:) ⇒ ::String #framework_path(project:, location:, framework:) ⇒ ::String

Create a fully-qualified Framework resource string.

Overloads:

  • #framework_path(organization:, location:, framework:) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/locations/{location}/frameworks/{framework}

    Parameters:

    • organization (String)
    • location (String)
    • framework (String)
  • #framework_path(project:, location:, framework:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/frameworks/{framework}

    Parameters:

    • project (String)
    • location (String)
    • framework (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/google/cloud/cloud_security_compliance/v1/config/paths.rb', line 92

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

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

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

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

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

Create a fully-qualified Location resource string.

The resource will be in the following format:

projects/{project}/locations/{location}

Parameters:

  • project (String)
  • location (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


124
125
126
127
128
# File 'lib/google/cloud/cloud_security_compliance/v1/config/paths.rb', line 124

def location_path project:, location:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

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

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

Create a fully-qualified OrganizationLocation resource string.

The resource will be in the following format:

organizations/{organization}/locations/{location}

Parameters:

  • organization (String)
  • location (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


141
142
143
144
145
# File 'lib/google/cloud/cloud_security_compliance/v1/config/paths.rb', line 141

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

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