Module: Google::Cloud::Storage::Control::V2::StorageControl::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/storage/control/v2/storage_control/paths.rb

Overview

Path helper methods for the StorageControl API.

Instance Method Summary collapse

Instance Method Details

#anywhere_cache_path(project:, bucket:, anywhere_cache:) ⇒ ::String

Create a fully-qualified AnywhereCache resource string.

The resource will be in the following format:

projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}

Parameters:

  • project (String)
  • bucket (String)
  • anywhere_cache (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


40
41
42
43
44
45
# File 'lib/google/cloud/storage/control/v2/storage_control/paths.rb', line 40

def anywhere_cache_path project:, bucket:, anywhere_cache:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "bucket cannot contain /" if bucket.to_s.include? "/"

  "projects/#{project}/buckets/#{bucket}/anywhereCaches/#{anywhere_cache}"
end

#bucket_path(project:, bucket:) ⇒ ::String

Create a fully-qualified Bucket resource string.

The resource will be in the following format:

projects/{project}/buckets/{bucket}

Parameters:

  • project (String)
  • bucket (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


58
59
60
61
62
# File 'lib/google/cloud/storage/control/v2/storage_control/paths.rb', line 58

def bucket_path project:, bucket:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/buckets/#{bucket}"
end

#folder_path(project:, bucket:, folder:) ⇒ ::String

Create a fully-qualified Folder resource string.

The resource will be in the following format:

projects/{project}/buckets/{bucket}/folders/{folder=**}

Parameters:

  • project (String)
  • bucket (String)
  • folder (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


76
77
78
79
80
81
# File 'lib/google/cloud/storage/control/v2/storage_control/paths.rb', line 76

def folder_path project:, bucket:, folder:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "bucket cannot contain /" if bucket.to_s.include? "/"

  "projects/#{project}/buckets/#{bucket}/folders/#{folder}"
end

#intelligence_config_path(folder: , location: ) ⇒ ::String #intelligence_config_path(org: , location: ) ⇒ ::String #intelligence_config_path(project: , location: ) ⇒ ::String

Create a fully-qualified IntelligenceConfig resource string.

Overloads:

  • #intelligence_config_path(folder: , location: ) ⇒ ::String

    The resource will be in the following format:

    folders/{folder}/locations/{location}/intelligenceConfig

    Parameters:

    • folder (String) (defaults to: )
    • location (String) (defaults to: )
  • #intelligence_config_path(org: , location: ) ⇒ ::String

    The resource will be in the following format:

    organizations/{org}/locations/{location}/intelligenceConfig

    Parameters:

    • org (String) (defaults to: )
    • location (String) (defaults to: )
  • #intelligence_config_path(project: , location: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/intelligenceConfig

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/google/cloud/storage/control/v2/storage_control/paths.rb', line 111

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

      "folders/#{folder}/locations/#{location}/intelligenceConfig"
    end),
    "location:org" => (proc do |org:, location:|
      raise ::ArgumentError, "org cannot contain /" if org.to_s.include? "/"

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

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

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

#managed_folder_path(project:, bucket:, managed_folder:) ⇒ ::String

Create a fully-qualified ManagedFolder resource string.

The resource will be in the following format:

projects/{project}/buckets/{bucket}/managedFolders/{managed_folder=**}

Parameters:

  • project (String)
  • bucket (String)
  • managed_folder (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


147
148
149
150
151
152
# File 'lib/google/cloud/storage/control/v2/storage_control/paths.rb', line 147

def managed_folder_path project:, bucket:, managed_folder:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "bucket cannot contain /" if bucket.to_s.include? "/"

  "projects/#{project}/buckets/#{bucket}/managedFolders/#{managed_folder}"
end

#storage_layout_path(project:, bucket:) ⇒ ::String

Create a fully-qualified StorageLayout resource string.

The resource will be in the following format:

projects/{project}/buckets/{bucket}/storageLayout

Parameters:

  • project (String)
  • bucket (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


165
166
167
168
169
# File 'lib/google/cloud/storage/control/v2/storage_control/paths.rb', line 165

def storage_layout_path project:, bucket:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/buckets/#{bucket}/storageLayout"
end