Module: Google::Cloud::OsConfig::V1::OsConfigZonalService::Paths

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

Overview

Path helper methods for the OsConfigZonalService API.

Instance Method Summary collapse

Instance Method Details

#instance_os_policy_assignment_path(project:, location:, instance:, assignment:) ⇒ ::String

Create a fully-qualified InstanceOSPolicyAssignment resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}

Parameters:

  • project (String)
  • location (String)
  • instance (String)
  • assignment (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


83
84
85
86
87
88
89
# File 'lib/google/cloud/os_config/v1/os_config_zonal_service/paths.rb', line 83

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

  "projects/#{project}/locations/#{location}/instances/#{instance}/osPolicyAssignments/#{assignment}"
end

#instance_path(project: , zone: , instance: ) ⇒ ::String #instance_path(project: , location: , instance: ) ⇒ ::String

Create a fully-qualified Instance resource string.

Overloads:

  • #instance_path(project: , zone: , instance: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/zones/{zone}/instances/{instance}

    Parameters:

    • project (String) (defaults to: )
    • zone (String) (defaults to: )
    • instance (String) (defaults to: )
  • #instance_path(project: , location: , instance: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/instances/{instance}

    Parameters:

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

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/os_config/v1/os_config_zonal_service/paths.rb', line 49

def instance_path **args
  resources = {
    "instance:project:zone" => (proc do |project:, zone:, instance:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "zone cannot contain /" if zone.to_s.include? "/"

      "projects/#{project}/zones/#{zone}/instances/#{instance}"
    end),
    "instance:location:project" => (proc do |project:, location:, instance:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

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

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

#inventory_path(project:, location:, instance:) ⇒ ::String

Create a fully-qualified Inventory resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/instances/{instance}/inventory

Parameters:

  • project (String)
  • location (String)
  • instance (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


103
104
105
106
107
108
# File 'lib/google/cloud/os_config/v1/os_config_zonal_service/paths.rb', line 103

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

  "projects/#{project}/locations/#{location}/instances/#{instance}/inventory"
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)


121
122
123
124
125
# File 'lib/google/cloud/os_config/v1/os_config_zonal_service/paths.rb', line 121

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

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

#os_policy_assignment_path(project:, location:, os_policy_assignment:) ⇒ ::String

Create a fully-qualified OSPolicyAssignment resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}

Parameters:

  • project (String)
  • location (String)
  • os_policy_assignment (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


139
140
141
142
143
144
# File 'lib/google/cloud/os_config/v1/os_config_zonal_service/paths.rb', line 139

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

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

#os_policy_assignment_report_path(project:, location:, instance:, assignment:) ⇒ ::String

Create a fully-qualified OSPolicyAssignmentReport resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report

Parameters:

  • project (String)
  • location (String)
  • instance (String)
  • assignment (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


159
160
161
162
163
164
165
# File 'lib/google/cloud/os_config/v1/os_config_zonal_service/paths.rb', line 159

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

  "projects/#{project}/locations/#{location}/instances/#{instance}/osPolicyAssignments/#{assignment}/report"
end

#vulnerability_report_path(project:, location:, instance:) ⇒ ::String

Create a fully-qualified VulnerabilityReport resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport

Parameters:

  • project (String)
  • location (String)
  • instance (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


179
180
181
182
183
184
# File 'lib/google/cloud/os_config/v1/os_config_zonal_service/paths.rb', line 179

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

  "projects/#{project}/locations/#{location}/instances/#{instance}/vulnerabilityReport"
end