module Google::Cloud::Storage
def self.anonymous retries: nil, timeout: nil, open_timeout: nil,
- Example: Use `skip_lookup` to avoid retrieving non-public metadata: -
Returns:
-
(Google::Cloud::Storage::Project)
-
Parameters:
-
upload_chunk_size
(Integer
) -- The chunk size of storage upload, in bytes. -
universe_domain
(String
) -- Override of the universe domain. Optional. -
endpoint
(String
) -- Override of the endpoint host name. Optional. -
send_timeout
(Integer
) -- How long, in seconds, before receiving response from server times out. Optional. -
read_timeout
(Integer
) -- How long, in seconds, before requests time out. Optional. -
open_timeout
(Integer
) -- How long, in seconds, before failed connections time out. Optional. -
timeout
(Integer
) -- (default timeout) The max duration, in seconds, to wait before timing out. Optional. -
multiplier
(Integer
) -- Each successive interval grows by this factor. A multipler of 1.5 means the next -
max_interval
(Integer
) -- The maximum interval in seconds that any individual retry can reach. -
base_interval
(Float
) -- The initial interval in seconds between tries. -
max_elapsed_time
(Integer
) -- Total time in seconds that requests are allowed to keep being retried. -
retries
(Integer
) -- Number of times to retry requests on server
def self.anonymous retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil, endpoint: nil, max_elapsed_time: nil, base_interval: nil, max_interval: nil, multiplier: nil, upload_chunk_size: nil, universe_domain: nil open_timeout ||= timeout read_timeout ||= timeout send_timeout ||= timeout Storage::Project.new( Storage::Service.new( nil, nil, retries: retries, timeout: timeout, open_timeout: open_timeout, read_timeout: read_timeout, send_timeout: send_timeout, host: endpoint, max_elapsed_time: max_elapsed_time, base_interval: base_interval, max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size, universe_domain: universe_domain ) ) end
def self.configure
-
(Google::Cloud::Config)
- The configuration object the
def self.configure yield Google::Cloud.configure.storage if block_given? Google::Cloud.configure.storage end
def self.default_credentials scope: nil
- Private: - Default credentials.
def self.default_credentials scope: nil Google::Cloud.configure.storage.credentials || Google::Cloud.configure.credentials || Storage::Credentials.default(scope: scope) end
def self.default_project_id
- Private: - Default project.
def self.default_project_id Google::Cloud.configure.storage.project_id || Google::Cloud.configure.project_id || Google::Cloud.env.project_id end
def self.new project_id: nil, credentials: nil, scope: nil, retries: nil,
-
(Google::Cloud::Storage::Project)
-
Parameters:
-
keyfile
(String
) -- Alias for the `credentials` argument. -
project
(String
) -- Alias for the `project_id` argument. Deprecated. -
upload_chunk_size
(Integer
) -- The chunk size of storage upload, in bytes. -
universe_domain
(String
) -- Override of the universe domain. Optional. -
endpoint
(String
) -- Override of the endpoint host name. Optional. -
send_timeout
(Integer
) -- How long, in seconds, before receiving response from server times out. Optional. -
read_timeout
(Integer
) -- How long, in seconds, before requests time out. Optional. -
open_timeout
(Integer
) -- How long, in seconds, before failed connections time out. Optional. -
timeout
(Integer
) -- (default timeout) The max duration, in seconds, to wait before timing out. Optional. -
multiplier
(Integer
) -- Each successive interval grows by this factor. A multipler of 1.5 means the next -
max_interval
(Integer
) -- The maximum interval in seconds that any individual retry can reach. -
base_interval
(Float
) -- The initial interval in seconds between tries. -
max_elapsed_time
(Integer
) -- Total time in seconds that requests are allowed to keep being retried. -
retries
(Integer
) -- Number of times to retry requests on server -
scope
(String, Array
) -- The OAuth 2.0 scopes controlling -
credentials
(String, Hash, Google::Auth::Credentials
) -- The path to -
project_id
(String
) -- Project identifier for the Storage service
def self.new project_id: nil, credentials: nil, scope: nil, retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil, endpoint: nil, project: nil, keyfile: nil, max_elapsed_time: nil, base_interval: nil, max_interval: nil, multiplier: nil, upload_chunk_size: nil, universe_domain: nil scope ||= configure.scope retries ||= configure.retries timeout ||= configure.timeout open_timeout ||= configure.open_timeout || timeout read_timeout ||= configure.read_timeout || timeout send_timeout ||= configure.send_timeout || timeout endpoint ||= configure.endpoint credentials ||= keyfile || default_credentials(scope: scope) max_elapsed_time ||= configure.max_elapsed_time base_interval ||= configure.base_interval max_interval ||= configure.max_interval multiplier ||= configure.multiplier upload_chunk_size ||= configure.upload_chunk_size universe_domain ||= configure.universe_domain unless credentials.is_a? Google::Auth::Credentials credentials = Storage::Credentials.new credentials, scope: scope end project_id = resolve_project_id(project_id || project, credentials) raise ArgumentError, "project_id is missing" if project_id.empty? Storage::Project.new( Storage::Service.new( project_id, credentials, retries: retries, timeout: timeout, open_timeout: open_timeout, read_timeout: read_timeout, send_timeout: send_timeout, host: endpoint, quota_project: configure.quota_project, max_elapsed_time: max_elapsed_time, base_interval: base_interval, max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size, universe_domain: universe_domain ) ) end
def self.resolve_project_id given_project, credentials
- Private: - Resolve project.
def self.resolve_project_id given_project, credentials project_id = given_project || default_project_id if credentials.respond_to? :project_id project_id ||= credentials.project_id end project_id.to_s # Always cast to a string end