Module: Google::Cloud::SecurityCenter::V1p1beta1::SecurityCenter::Paths

Extended by:
Paths
Included in:
Client, Paths
Defined in:
lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb

Overview

Path helper methods for the SecurityCenter API.

Instance Method Summary collapse

Instance Method Details

#finding_path(organization: , source: , finding: ) ⇒ ::String #finding_path(folder: , source: , finding: ) ⇒ ::String #finding_path(project: , source: , finding: ) ⇒ ::String

Create a fully-qualified Finding resource string.

Overloads:

  • #finding_path(organization: , source: , finding: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/sources/{source}/findings/{finding}

    Parameters:

    • organization (String) (defaults to: )
    • source (String) (defaults to: )
    • finding (String) (defaults to: )
  • #finding_path(folder: , source: , finding: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/sources/{source}/findings/{finding}

    Parameters:

    • folder (String) (defaults to: )
    • source (String) (defaults to: )
    • finding (String) (defaults to: )
  • #finding_path(project: , source: , finding: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/sources/{source}/findings/{finding}

    Parameters:

    • project (String) (defaults to: )
    • source (String) (defaults to: )
    • finding (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb', line 58

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

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

      "folders/#{folder}/sources/#{source}/findings/#{finding}"
    end),
    "finding:project:source" => (proc do |project:, source:, finding:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"

      "projects/#{project}/sources/#{source}/findings/#{finding}"
    end)
  }

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

#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)


95
96
97
# File 'lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb', line 95

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

#notification_config_path(organization:, notification_config:) ⇒ ::String

Create a fully-qualified NotificationConfig resource string.

The resource will be in the following format:

organizations/{organization}/notificationConfigs/{notification_config}

Parameters:

  • organization (String)
  • notification_config (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


110
111
112
113
114
# File 'lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb', line 110

def notification_config_path organization:, notification_config:
  raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"

  "organizations/#{organization}/notificationConfigs/#{notification_config}"
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)


126
127
128
# File 'lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb', line 126

def organization_path organization:
  "organizations/#{organization}"
end

#organization_settings_path(organization:) ⇒ ::String

Create a fully-qualified OrganizationSettings resource string.

The resource will be in the following format:

organizations/{organization}/organizationSettings

Parameters:

  • organization (String)

Returns:

  • (::String)


140
141
142
# File 'lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb', line 140

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


154
155
156
# File 'lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb', line 154

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

#security_marks_path(organization: , asset: ) ⇒ ::String #security_marks_path(organization: , source: , finding: ) ⇒ ::String #security_marks_path(folder: , asset: ) ⇒ ::String #security_marks_path(project: , asset: ) ⇒ ::String #security_marks_path(folder: , source: , finding: ) ⇒ ::String #security_marks_path(project: , source: , finding: ) ⇒ ::String

Create a fully-qualified SecurityMarks resource string.

Overloads:

  • #security_marks_path(organization: , asset: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/assets/{asset}/securityMarks

    Parameters:

    • organization (String) (defaults to: )
    • asset (String) (defaults to: )
  • #security_marks_path(organization: , source: , finding: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/sources/{source}/findings/{finding}/securityMarks

    Parameters:

    • organization (String) (defaults to: )
    • source (String) (defaults to: )
    • finding (String) (defaults to: )
  • #security_marks_path(folder: , asset: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/assets/{asset}/securityMarks

    Parameters:

    • folder (String) (defaults to: )
    • asset (String) (defaults to: )
  • #security_marks_path(project: , asset: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/assets/{asset}/securityMarks

    Parameters:

    • project (String) (defaults to: )
    • asset (String) (defaults to: )
  • #security_marks_path(folder: , source: , finding: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/sources/{source}/findings/{finding}/securityMarks

    Parameters:

    • folder (String) (defaults to: )
    • source (String) (defaults to: )
    • finding (String) (defaults to: )
  • #security_marks_path(project: , source: , finding: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/sources/{source}/findings/{finding}/securityMarks

    Parameters:

    • project (String) (defaults to: )
    • source (String) (defaults to: )
    • finding (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb', line 213

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

      "organizations/#{organization}/assets/#{asset}/securityMarks"
    end),
    "finding:organization:source" => (proc do |organization:, source:, finding:|
      raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
      raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"

      "organizations/#{organization}/sources/#{source}/findings/#{finding}/securityMarks"
    end),
    "asset:folder" => (proc do |folder:, asset:|
      raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"

      "folders/#{folder}/assets/#{asset}/securityMarks"
    end),
    "asset:project" => (proc do |project:, asset:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/assets/#{asset}/securityMarks"
    end),
    "finding:folder:source" => (proc do |folder:, source:, finding:|
      raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
      raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"

      "folders/#{folder}/sources/#{source}/findings/#{finding}/securityMarks"
    end),
    "finding:project:source" => (proc do |project:, source:, finding:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "source cannot contain /" if source.to_s.include? "/"

      "projects/#{project}/sources/#{source}/findings/#{finding}/securityMarks"
    end)
  }

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

#source_path(organization: , source: ) ⇒ ::String #source_path(folder: , source: ) ⇒ ::String #source_path(project: , source: ) ⇒ ::String

Create a fully-qualified Source resource string.

Overloads:

  • #source_path(organization: , source: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{organization}/sources/{source}

    Parameters:

    • organization (String) (defaults to: )
    • source (String) (defaults to: )
  • #source_path(folder: , source: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/sources/{source}

    Parameters:

    • folder (String) (defaults to: )
    • source (String) (defaults to: )
  • #source_path(project: , source: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/sources/{source}

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb', line 283

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

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

      "folders/#{folder}/sources/#{source}"
    end),
    "project:source" => (proc do |project:, source:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/sources/#{source}"
    end)
  }

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

#topic_path(project:, topic:) ⇒ ::String

Create a fully-qualified Topic resource string.

The resource will be in the following format:

projects/{project}/topics/{topic}

Parameters:

  • project (String)
  • topic (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


318
319
320
321
322
# File 'lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb', line 318

def topic_path project:, topic:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/topics/#{topic}"
end