google-cloud-core 1.3.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/CONTRIBUTING.md +2 -2
- data/README.md +2 -2
- data/lib/google/cloud.rb +1 -73
- data/lib/google/cloud/config.rb +22 -24
- data/lib/google/cloud/core/version.rb +1 -1
- data/lib/google/cloud/credentials.rb +14 -13
- metadata +37 -24
- data/lib/google/cloud/errors.rb +0 -324
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0da3f7e70a825960a1eefff5508fadf4e4e58005a16c1ee0cf3f1c9f04af65bb
         | 
| 4 | 
            +
              data.tar.gz: 82b1d53b8a7339152f8a65a2c0ded58ac4edc1549c24eeff03c9bdaae0f10c56
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9c29b01b9004f1cbe7a93a56e69286bce35a582f012ba819876f41667dc8b7b19d92c4f1108c314099d56882c9fe1022fe4a38d05dd76a70fda5bd48d78a0365
         | 
| 7 | 
            +
              data.tar.gz: af2334493f6309401623c8c3c6b4712f421a3ce12563b1cf6a8ffa5dc03380e8afb043590d0a56fe397ef645aa89458af57df718cf0fd9a01f2ac5291fb09ed1
         | 
    
        data/AUTHENTICATION.md
    CHANGED
    
    | @@ -4,7 +4,7 @@ With `google-cloud-ruby` it's incredibly easy to get authenticated and start usi | |
| 4 4 |  | 
| 5 5 | 
             
            ### Google Cloud Platform environments
         | 
| 6 6 |  | 
| 7 | 
            -
            While running on Google Cloud Platform  | 
| 7 | 
            +
            While running on Google Cloud Platform (GCP), including Google Compute Engine (GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud Functions (GCF) and Cloud Run, no extra work is needed. The **Project ID** and **Credentials** and are discovered automatically. Code should be written as if already authenticated.
         | 
| 8 8 |  | 
| 9 9 | 
             
            ### Project and Credential Lookup
         | 
| 10 10 |  | 
    
        data/CONTRIBUTING.md
    CHANGED
    
    | @@ -24,7 +24,7 @@ be able to accept your pull requests. | |
| 24 24 | 
             
            In order to use the google-cloud console and run the project's tests,
         | 
| 25 25 | 
             
            there is a small amount of setup:
         | 
| 26 26 |  | 
| 27 | 
            -
            1. Install Ruby. google-cloud requires Ruby 2. | 
| 27 | 
            +
            1. Install Ruby. google-cloud requires Ruby 2.5+. You may choose to
         | 
| 28 28 | 
             
               manage your Ruby and gem installations with [RVM](https://rvm.io/),
         | 
| 29 29 | 
             
               [rbenv](https://github.com/rbenv/rbenv), or
         | 
| 30 30 | 
             
               [chruby](https://github.com/postmodern/chruby).
         | 
| @@ -45,7 +45,7 @@ there is a small amount of setup: | |
| 45 45 |  | 
| 46 46 | 
             
               ```sh
         | 
| 47 47 | 
             
               $ cd google-cloud-core/
         | 
| 48 | 
            -
               $ bundle  | 
| 48 | 
            +
               $ bundle install
         | 
| 49 49 | 
             
               ```
         | 
| 50 50 |  | 
| 51 51 | 
             
            ## Console
         | 
    
        data/README.md
    CHANGED
    
    | @@ -9,11 +9,11 @@ information about the individual google-cloud gems. | |
| 9 9 |  | 
| 10 10 | 
             
            ## Supported Ruby Versions
         | 
| 11 11 |  | 
| 12 | 
            -
            This library is supported on Ruby 2. | 
| 12 | 
            +
            This library is supported on Ruby 2.5+.
         | 
| 13 13 |  | 
| 14 14 | 
             
            Google provides official support for Ruby versions that are actively supported
         | 
| 15 15 | 
             
            by Ruby Core—that is, Ruby versions that are either in normal maintenance or in
         | 
| 16 | 
            -
            security maintenance, and not end of life. Currently, this means Ruby 2. | 
| 16 | 
            +
            security maintenance, and not end of life. Currently, this means Ruby 2.5 and
         | 
| 17 17 | 
             
            later. Older versions of Ruby _may_ still work, but are unsupported and not
         | 
| 18 18 | 
             
            recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
         | 
| 19 19 | 
             
            about the Ruby support schedule.
         | 
    
        data/lib/google/cloud.rb
    CHANGED
    
    | @@ -121,73 +121,6 @@ module Google | |
| 121 121 | 
             
                  end
         | 
| 122 122 | 
             
                end
         | 
| 123 123 |  | 
| 124 | 
            -
                # Update the supported and recommended version thresholds according to the
         | 
| 125 | 
            -
                # MRI support schedule: supported means non-EOL, and recommended means in
         | 
| 126 | 
            -
                # normal (rather than security) maintenance. Generally, this means updating
         | 
| 127 | 
            -
                # these at the end of March each year, if the previous year patterns hold.
         | 
| 128 | 
            -
                # See https://www.ruby-lang.org/en/downloads/branches/
         | 
| 129 | 
            -
             | 
| 130 | 
            -
                ##
         | 
| 131 | 
            -
                # Minimum "supported" Ruby version (non-EOL)
         | 
| 132 | 
            -
                # @private
         | 
| 133 | 
            -
                #
         | 
| 134 | 
            -
                SUPPORTED_VERSION_THRESHOLD = "2.3".freeze
         | 
| 135 | 
            -
             | 
| 136 | 
            -
                ##
         | 
| 137 | 
            -
                # Minimum "recommended" Ruby version (normal maintenance)
         | 
| 138 | 
            -
                # @private
         | 
| 139 | 
            -
                #
         | 
| 140 | 
            -
                RECOMMENDED_VERSION_THRESHOLD = "2.4".freeze
         | 
| 141 | 
            -
             | 
| 142 | 
            -
                ##
         | 
| 143 | 
            -
                # Check Ruby version and emit a warning if it is old
         | 
| 144 | 
            -
                # @private
         | 
| 145 | 
            -
                #
         | 
| 146 | 
            -
                def self.warn_on_old_ruby_version \
         | 
| 147 | 
            -
                    supported_version: SUPPORTED_VERSION_THRESHOLD,
         | 
| 148 | 
            -
                    recommended_version: RECOMMENDED_VERSION_THRESHOLD
         | 
| 149 | 
            -
                  return if ENV["GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS"]
         | 
| 150 | 
            -
                  cur_version = Gem::Version.new RUBY_VERSION
         | 
| 151 | 
            -
                  if cur_version < Gem::Version.new(supported_version)
         | 
| 152 | 
            -
                    warn_unsupported_ruby cur_version, recommended_version
         | 
| 153 | 
            -
                  elsif cur_version < Gem::Version.new(recommended_version)
         | 
| 154 | 
            -
                    warn_nonrecommended_ruby cur_version, recommended_version
         | 
| 155 | 
            -
                  end
         | 
| 156 | 
            -
                rescue ArgumentError
         | 
| 157 | 
            -
                  warn "Unable to determine current Ruby version."
         | 
| 158 | 
            -
                end
         | 
| 159 | 
            -
             | 
| 160 | 
            -
                ##
         | 
| 161 | 
            -
                # Print a warning for an EOL version of Ruby
         | 
| 162 | 
            -
                # @private
         | 
| 163 | 
            -
                #
         | 
| 164 | 
            -
                def self.warn_unsupported_ruby cur_version, recommended_version
         | 
| 165 | 
            -
                  warn "WARNING: You are running Ruby #{cur_version}, which has reached" \
         | 
| 166 | 
            -
                    " end-of-life and is no longer supported by Ruby Core."
         | 
| 167 | 
            -
                  warn "The Google Cloud API clients work best on supported versions of" \
         | 
| 168 | 
            -
                    " Ruby. It is strongly recommended that you upgrade to Ruby" \
         | 
| 169 | 
            -
                    " #{recommended_version} or later."
         | 
| 170 | 
            -
                  warn "See https://www.ruby-lang.org/en/downloads/branches/ for more" \
         | 
| 171 | 
            -
                    " info on the Ruby maintenance schedule."
         | 
| 172 | 
            -
                  warn "To suppress this message, set the" \
         | 
| 173 | 
            -
                    " GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable."
         | 
| 174 | 
            -
                end
         | 
| 175 | 
            -
             | 
| 176 | 
            -
                ##
         | 
| 177 | 
            -
                # Print a warning for a supported but nearing EOL version of Ruby
         | 
| 178 | 
            -
                # @private
         | 
| 179 | 
            -
                #
         | 
| 180 | 
            -
                def self.warn_nonrecommended_ruby cur_version, recommended_version
         | 
| 181 | 
            -
                  warn "WARNING: You are running Ruby #{cur_version}, which is nearing" \
         | 
| 182 | 
            -
                    " end-of-life."
         | 
| 183 | 
            -
                  warn "The Google Cloud API clients work best on supported versions of" \
         | 
| 184 | 
            -
                    " Ruby. Consider upgrading to Ruby #{recommended_version} or later."
         | 
| 185 | 
            -
                  warn "See https://www.ruby-lang.org/en/downloads/branches/ for more" \
         | 
| 186 | 
            -
                    " info on the Ruby maintenance schedule."
         | 
| 187 | 
            -
                  warn "To suppress this message, set the" \
         | 
| 188 | 
            -
                    " GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable."
         | 
| 189 | 
            -
                end
         | 
| 190 | 
            -
             | 
| 191 124 | 
             
                ##
         | 
| 192 125 | 
             
                # Safely load all google-cloud-* gems.
         | 
| 193 126 | 
             
                # @private
         | 
| @@ -223,9 +156,7 @@ module Google | |
| 223 156 | 
             
                # @private
         | 
| 224 157 | 
             
                #
         | 
| 225 158 | 
             
                def self.auto_load_files
         | 
| 226 | 
            -
                  if Gem.respond_to? :find_latest_files
         | 
| 227 | 
            -
                    return Gem.find_latest_files "google-cloud-*.rb"
         | 
| 228 | 
            -
                  end
         | 
| 159 | 
            +
                  return Gem.find_latest_files "google-cloud-*.rb" if Gem.respond_to? :find_latest_files
         | 
| 229 160 | 
             
                  # Ruby 2.0 does not have Gem.find_latest_files
         | 
| 230 161 | 
             
                  Gem.find_files "google-cloud-*.rb"
         | 
| 231 162 | 
             
                end
         | 
| @@ -235,8 +166,5 @@ end | |
| 235 166 | 
             
            # Set the default top-level configuration
         | 
| 236 167 | 
             
            Google::Cloud.init_configuration
         | 
| 237 168 |  | 
| 238 | 
            -
            # Emit a warning if current Ruby is at or nearing end-of-life
         | 
| 239 | 
            -
            Google::Cloud.warn_on_old_ruby_version
         | 
| 240 | 
            -
             | 
| 241 169 | 
             
            # Auto-load all Google Cloud service gems.
         | 
| 242 170 | 
             
            Google::Cloud.auto_load_gems
         | 
    
        data/lib/google/cloud/config.rb
    CHANGED
    
    | @@ -308,9 +308,7 @@ module Google | |
| 308 308 | 
             
                  #
         | 
| 309 309 | 
             
                  def [] key
         | 
| 310 310 | 
             
                    key = resolve_key! key
         | 
| 311 | 
            -
                    unless @validators.key? key
         | 
| 312 | 
            -
                      warn! "Key #{key.inspect} does not exist. Returning nil."
         | 
| 313 | 
            -
                    end
         | 
| 311 | 
            +
                    warn! "Key #{key.inspect} does not exist. Returning nil." unless @validators.key? key
         | 
| 314 312 | 
             
                    value = @values[key]
         | 
| 315 313 | 
             
                    value = value.call if Config::DeferredValue === value
         | 
| 316 314 | 
             
                    value
         | 
| @@ -338,6 +336,7 @@ module Google | |
| 338 336 | 
             
                  def field? key
         | 
| 339 337 | 
             
                    @validators[key.to_sym].is_a? ::Proc
         | 
| 340 338 | 
             
                  end
         | 
| 339 | 
            +
                  alias respond_to? field?
         | 
| 341 340 |  | 
| 342 341 | 
             
                  ##
         | 
| 343 342 | 
             
                  # Check if the given key has been explicitly added as a subconfig name.
         | 
| @@ -397,11 +396,12 @@ module Google | |
| 397 396 | 
             
                  def to_s!
         | 
| 398 397 | 
             
                    elems = @validators.keys.map do |k|
         | 
| 399 398 | 
             
                      v = @values[k]
         | 
| 400 | 
            -
                      vstr = Config.config?(v) ? v.to_s! :  | 
| 399 | 
            +
                      vstr = Config.config?(v) ? v.to_s! : v.inspect
         | 
| 401 400 | 
             
                      " #{k}=#{vstr}"
         | 
| 402 401 | 
             
                    end
         | 
| 403 402 | 
             
                    "<Config:#{elems.join}>"
         | 
| 404 403 | 
             
                  end
         | 
| 404 | 
            +
                  alias inspect to_s!
         | 
| 405 405 |  | 
| 406 406 | 
             
                  ##
         | 
| 407 407 | 
             
                  # Returns a nested hash representation of this configuration state,
         | 
| @@ -434,10 +434,10 @@ module Google | |
| 434 434 | 
             
                      str = data.strip
         | 
| 435 435 | 
             
                      return str if ::File.file? str
         | 
| 436 436 | 
             
                      json = begin
         | 
| 437 | 
            -
             | 
| 438 | 
            -
             | 
| 439 | 
            -
             | 
| 440 | 
            -
             | 
| 437 | 
            +
                        ::JSON.parse str
         | 
| 438 | 
            +
                      rescue ::StandardError
         | 
| 439 | 
            +
                        nil
         | 
| 440 | 
            +
                      end
         | 
| 441 441 | 
             
                      return json if json.is_a? ::Hash
         | 
| 442 442 | 
             
                    end
         | 
| 443 443 | 
             
                    nil
         | 
| @@ -458,8 +458,8 @@ module Google | |
| 458 458 | 
             
                  def method_missing name, *args
         | 
| 459 459 | 
             
                    name_str = name.to_s
         | 
| 460 460 | 
             
                    super unless name_str =~ /^[a-zA-Z]\w*=?$/
         | 
| 461 | 
            -
                    if name_str. | 
| 462 | 
            -
                      self[name_str] = args.first
         | 
| 461 | 
            +
                    if name_str.end_with? "="
         | 
| 462 | 
            +
                      self[name_str[0...-1]] = args.first
         | 
| 463 463 | 
             
                    else
         | 
| 464 464 | 
             
                      self[name]
         | 
| 465 465 | 
             
                    end
         | 
| @@ -489,22 +489,22 @@ module Google | |
| 489 489 | 
             
                  ##
         | 
| 490 490 | 
             
                  # @private A validator that allows all values
         | 
| 491 491 | 
             
                  #
         | 
| 492 | 
            -
                  OPEN_VALIDATOR =  | 
| 492 | 
            +
                  OPEN_VALIDATOR = proc { true }
         | 
| 493 493 |  | 
| 494 494 | 
             
                  ##
         | 
| 495 495 | 
             
                  # @private a list of key names that are technically illegal because
         | 
| 496 496 | 
             
                  # they clash with method names.
         | 
| 497 497 | 
             
                  #
         | 
| 498 | 
            -
                  ILLEGAL_KEYS =  | 
| 499 | 
            -
             | 
| 500 | 
            -
             | 
| 501 | 
            -
             | 
| 502 | 
            -
             | 
| 503 | 
            -
             | 
| 504 | 
            -
             | 
| 505 | 
            -
             | 
| 506 | 
            -
             | 
| 507 | 
            -
             | 
| 498 | 
            +
                  ILLEGAL_KEYS = [:add_options,
         | 
| 499 | 
            +
                                  :initialize,
         | 
| 500 | 
            +
                                  :inspect,
         | 
| 501 | 
            +
                                  :instance_eval,
         | 
| 502 | 
            +
                                  :instance_exec,
         | 
| 503 | 
            +
                                  :method_missing,
         | 
| 504 | 
            +
                                  :send,
         | 
| 505 | 
            +
                                  :singleton_method_added,
         | 
| 506 | 
            +
                                  :singleton_method_removed,
         | 
| 507 | 
            +
                                  :singleton_method_undefined].freeze
         | 
| 508 508 |  | 
| 509 509 | 
             
                  ##
         | 
| 510 510 | 
             
                  # @private sentinel indicating a subconfig in the validators hash
         | 
| @@ -524,9 +524,7 @@ module Google | |
| 524 524 | 
             
                      warn! "Illegal key name: #{key_str.inspect}. Method dispatch will" \
         | 
| 525 525 | 
             
                            " not work for this key."
         | 
| 526 526 | 
             
                    end
         | 
| 527 | 
            -
                    if @validators.key? key
         | 
| 528 | 
            -
                      warn! "Key #{key.inspect} already exists. It will be replaced."
         | 
| 529 | 
            -
                    end
         | 
| 527 | 
            +
                    warn! "Key #{key.inspect} already exists. It will be replaced." if @validators.key? key
         | 
| 530 528 | 
             
                    key
         | 
| 531 529 | 
             
                  end
         | 
| 532 530 |  | 
| @@ -30,12 +30,12 @@ module Google | |
| 30 30 | 
             
                # This class is intended to be inherited by API-specific classes
         | 
| 31 31 | 
             
                # which overrides the SCOPE constant.
         | 
| 32 32 | 
             
                class Credentials
         | 
| 33 | 
            -
                  TOKEN_CREDENTIAL_URI = "https://oauth2.googleapis.com/token"
         | 
| 34 | 
            -
                  AUDIENCE = "https://oauth2.googleapis.com/token"
         | 
| 35 | 
            -
                  SCOPE = []
         | 
| 36 | 
            -
                  PATH_ENV_VARS =  | 
| 37 | 
            -
                  JSON_ENV_VARS =  | 
| 38 | 
            -
                  DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
         | 
| 33 | 
            +
                  TOKEN_CREDENTIAL_URI = "https://oauth2.googleapis.com/token".freeze
         | 
| 34 | 
            +
                  AUDIENCE = "https://oauth2.googleapis.com/token".freeze
         | 
| 35 | 
            +
                  SCOPE = [].freeze
         | 
| 36 | 
            +
                  PATH_ENV_VARS = ["GOOGLE_CLOUD_KEYFILE", "GCLOUD_KEYFILE"].freeze
         | 
| 37 | 
            +
                  JSON_ENV_VARS = ["GOOGLE_CLOUD_KEYFILE_JSON", "GCLOUD_KEYFILE_JSON"].freeze
         | 
| 38 | 
            +
                  DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"].freeze
         | 
| 39 39 |  | 
| 40 40 | 
             
                  attr_accessor :client
         | 
| 41 41 |  | 
| @@ -48,9 +48,10 @@ module Google | |
| 48 48 |  | 
| 49 49 | 
             
                  def initialize keyfile, scope: nil
         | 
| 50 50 | 
             
                    verify_keyfile_provided! keyfile
         | 
| 51 | 
            -
                     | 
| 51 | 
            +
                    case keyfile
         | 
| 52 | 
            +
                    when Signet::OAuth2::Client
         | 
| 52 53 | 
             
                      @client = keyfile
         | 
| 53 | 
            -
                     | 
| 54 | 
            +
                    when Hash
         | 
| 54 55 | 
             
                      hash = stringify_hash_keys keyfile
         | 
| 55 56 | 
             
                      hash["scope"] ||= scope
         | 
| 56 57 | 
             
                      @client = init_client hash
         | 
| @@ -114,7 +115,7 @@ module Google | |
| 114 115 | 
             
                  ##
         | 
| 115 116 | 
             
                  # returns a new Hash with string keys instead of symbol keys.
         | 
| 116 117 | 
             
                  def stringify_hash_keys hash
         | 
| 117 | 
            -
                     | 
| 118 | 
            +
                    hash.transform_keys(&:to_s)
         | 
| 118 119 | 
             
                  end
         | 
| 119 120 |  | 
| 120 121 | 
             
                  def client_options options
         | 
| @@ -125,10 +126,10 @@ module Google | |
| 125 126 |  | 
| 126 127 | 
             
                    # client options for initializing signet client
         | 
| 127 128 | 
             
                    { token_credential_uri: options["token_credential_uri"],
         | 
| 128 | 
            -
                      audience: | 
| 129 | 
            -
                      scope: | 
| 130 | 
            -
                      issuer: | 
| 131 | 
            -
                      signing_key: | 
| 129 | 
            +
                      audience:             options["audience"],
         | 
| 130 | 
            +
                      scope:                Array(options["scope"]),
         | 
| 131 | 
            +
                      issuer:               options["client_email"],
         | 
| 132 | 
            +
                      signing_key:          OpenSSL::PKey::RSA.new(options["private_key"]) }
         | 
| 132 133 | 
             
                  end
         | 
| 133 134 | 
             
                end
         | 
| 134 135 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: google-cloud-core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.6.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mike Moore
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2021-03-10 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: google-cloud-env
         | 
| @@ -26,63 +26,77 @@ dependencies: | |
| 26 26 | 
             
                  - !ruby/object:Gem::Version
         | 
| 27 27 | 
             
                    version: '1.0'
         | 
| 28 28 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 29 | 
            -
              name:  | 
| 29 | 
            +
              name: google-cloud-errors
         | 
| 30 30 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 31 31 | 
             
                requirements:
         | 
| 32 32 | 
             
                - - "~>"
         | 
| 33 33 | 
             
                  - !ruby/object:Gem::Version
         | 
| 34 | 
            -
                    version: ' | 
| 34 | 
            +
                    version: '1.0'
         | 
| 35 | 
            +
              type: :runtime
         | 
| 36 | 
            +
              prerelease: false
         | 
| 37 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 38 | 
            +
                requirements:
         | 
| 39 | 
            +
                - - "~>"
         | 
| 40 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 41 | 
            +
                    version: '1.0'
         | 
| 42 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 43 | 
            +
              name: autotest-suffix
         | 
| 44 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 45 | 
            +
                requirements:
         | 
| 46 | 
            +
                - - "~>"
         | 
| 47 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 48 | 
            +
                    version: '1.1'
         | 
| 35 49 | 
             
              type: :development
         | 
| 36 50 | 
             
              prerelease: false
         | 
| 37 51 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 38 52 | 
             
                requirements:
         | 
| 39 53 | 
             
                - - "~>"
         | 
| 40 54 | 
             
                  - !ruby/object:Gem::Version
         | 
| 41 | 
            -
                    version: ' | 
| 55 | 
            +
                    version: '1.1'
         | 
| 42 56 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 43 | 
            -
              name:  | 
| 57 | 
            +
              name: google-style
         | 
| 44 58 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 45 59 | 
             
                requirements:
         | 
| 46 60 | 
             
                - - "~>"
         | 
| 47 61 | 
             
                  - !ruby/object:Gem::Version
         | 
| 48 | 
            -
                    version:  | 
| 62 | 
            +
                    version: 1.25.1
         | 
| 49 63 | 
             
              type: :development
         | 
| 50 64 | 
             
              prerelease: false
         | 
| 51 65 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 52 66 | 
             
                requirements:
         | 
| 53 67 | 
             
                - - "~>"
         | 
| 54 68 | 
             
                  - !ruby/object:Gem::Version
         | 
| 55 | 
            -
                    version:  | 
| 69 | 
            +
                    version: 1.25.1
         | 
| 56 70 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 57 | 
            -
              name: minitest | 
| 71 | 
            +
              name: minitest
         | 
| 58 72 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 59 73 | 
             
                requirements:
         | 
| 60 74 | 
             
                - - "~>"
         | 
| 61 75 | 
             
                  - !ruby/object:Gem::Version
         | 
| 62 | 
            -
                    version: ' | 
| 76 | 
            +
                    version: '5.14'
         | 
| 63 77 | 
             
              type: :development
         | 
| 64 78 | 
             
              prerelease: false
         | 
| 65 79 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 66 80 | 
             
                requirements:
         | 
| 67 81 | 
             
                - - "~>"
         | 
| 68 82 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            -
                    version: ' | 
| 83 | 
            +
                    version: '5.14'
         | 
| 70 84 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 71 | 
            -
              name: minitest- | 
| 85 | 
            +
              name: minitest-autotest
         | 
| 72 86 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 73 87 | 
             
                requirements:
         | 
| 74 88 | 
             
                - - "~>"
         | 
| 75 89 | 
             
                  - !ruby/object:Gem::Version
         | 
| 76 | 
            -
                    version: ' | 
| 90 | 
            +
                    version: '1.0'
         | 
| 77 91 | 
             
              type: :development
         | 
| 78 92 | 
             
              prerelease: false
         | 
| 79 93 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 80 94 | 
             
                requirements:
         | 
| 81 95 | 
             
                - - "~>"
         | 
| 82 96 | 
             
                  - !ruby/object:Gem::Version
         | 
| 83 | 
            -
                    version: ' | 
| 97 | 
            +
                    version: '1.0'
         | 
| 84 98 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 85 | 
            -
              name:  | 
| 99 | 
            +
              name: minitest-focus
         | 
| 86 100 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 87 101 | 
             
                requirements:
         | 
| 88 102 | 
             
                - - "~>"
         | 
| @@ -96,33 +110,33 @@ dependencies: | |
| 96 110 | 
             
                  - !ruby/object:Gem::Version
         | 
| 97 111 | 
             
                    version: '1.1'
         | 
| 98 112 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 99 | 
            -
              name:  | 
| 113 | 
            +
              name: minitest-rg
         | 
| 100 114 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 101 115 | 
             
                requirements:
         | 
| 102 116 | 
             
                - - "~>"
         | 
| 103 117 | 
             
                  - !ruby/object:Gem::Version
         | 
| 104 | 
            -
                    version: ' | 
| 118 | 
            +
                    version: '5.2'
         | 
| 105 119 | 
             
              type: :development
         | 
| 106 120 | 
             
              prerelease: false
         | 
| 107 121 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 108 122 | 
             
                requirements:
         | 
| 109 123 | 
             
                - - "~>"
         | 
| 110 124 | 
             
                  - !ruby/object:Gem::Version
         | 
| 111 | 
            -
                    version: ' | 
| 125 | 
            +
                    version: '5.2'
         | 
| 112 126 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 113 | 
            -
              name:  | 
| 127 | 
            +
              name: redcarpet
         | 
| 114 128 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 115 129 | 
             
                requirements:
         | 
| 116 130 | 
             
                - - "~>"
         | 
| 117 131 | 
             
                  - !ruby/object:Gem::Version
         | 
| 118 | 
            -
                    version:  | 
| 132 | 
            +
                    version: '3.0'
         | 
| 119 133 | 
             
              type: :development
         | 
| 120 134 | 
             
              prerelease: false
         | 
| 121 135 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 122 136 | 
             
                requirements:
         | 
| 123 137 | 
             
                - - "~>"
         | 
| 124 138 | 
             
                  - !ruby/object:Gem::Version
         | 
| 125 | 
            -
                    version:  | 
| 139 | 
            +
                    version: '3.0'
         | 
| 126 140 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 127 141 | 
             
              name: simplecov
         | 
| 128 142 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -183,7 +197,6 @@ files: | |
| 183 197 | 
             
            - lib/google/cloud/config.rb
         | 
| 184 198 | 
             
            - lib/google/cloud/core/version.rb
         | 
| 185 199 | 
             
            - lib/google/cloud/credentials.rb
         | 
| 186 | 
            -
            - lib/google/cloud/errors.rb
         | 
| 187 200 | 
             
            homepage: https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-core
         | 
| 188 201 | 
             
            licenses:
         | 
| 189 202 | 
             
            - Apache-2.0
         | 
| @@ -196,14 +209,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 196 209 | 
             
              requirements:
         | 
| 197 210 | 
             
              - - ">="
         | 
| 198 211 | 
             
                - !ruby/object:Gem::Version
         | 
| 199 | 
            -
                  version: 2. | 
| 212 | 
            +
                  version: '2.5'
         | 
| 200 213 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 201 214 | 
             
              requirements:
         | 
| 202 215 | 
             
              - - ">="
         | 
| 203 216 | 
             
                - !ruby/object:Gem::Version
         | 
| 204 217 | 
             
                  version: '0'
         | 
| 205 218 | 
             
            requirements: []
         | 
| 206 | 
            -
            rubygems_version: 3. | 
| 219 | 
            +
            rubygems_version: 3.2.13
         | 
| 207 220 | 
             
            signing_key: 
         | 
| 208 221 | 
             
            specification_version: 4
         | 
| 209 222 | 
             
            summary: Internal shared library for google-cloud-ruby
         | 
    
        data/lib/google/cloud/errors.rb
    DELETED
    
    | @@ -1,324 +0,0 @@ | |
| 1 | 
            -
            # Copyright 2015 Google LLC
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # Licensed under the Apache License, Version 2.0 (the "License");
         | 
| 4 | 
            -
            # you may not use this file except in compliance with the License.
         | 
| 5 | 
            -
            # You may obtain a copy of the License at
         | 
| 6 | 
            -
            #
         | 
| 7 | 
            -
            #     https://www.apache.org/licenses/LICENSE-2.0
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            # Unless required by applicable law or agreed to in writing, software
         | 
| 10 | 
            -
            # distributed under the License is distributed on an "AS IS" BASIS,
         | 
| 11 | 
            -
            # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         | 
| 12 | 
            -
            # See the License for the specific language governing permissions and
         | 
| 13 | 
            -
            # limitations under the License.
         | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
            require "English"
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            module Google
         | 
| 19 | 
            -
              module Cloud
         | 
| 20 | 
            -
                ##
         | 
| 21 | 
            -
                # Base google-cloud exception class.
         | 
| 22 | 
            -
                class Error < StandardError
         | 
| 23 | 
            -
                  ##
         | 
| 24 | 
            -
                  # Construct a new Google::Cloud::Error object, optionally passing in a
         | 
| 25 | 
            -
                  # message.
         | 
| 26 | 
            -
                  def initialize msg = nil
         | 
| 27 | 
            -
                    super
         | 
| 28 | 
            -
                    @cause = $ERROR_INFO
         | 
| 29 | 
            -
                  end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                  # Add Error#cause (introduced in 2.1) to Ruby 2.0.
         | 
| 32 | 
            -
                  unless respond_to? :cause
         | 
| 33 | 
            -
                    ##
         | 
| 34 | 
            -
                    # The previous exception at the time this exception was raised. This is
         | 
| 35 | 
            -
                    # useful for wrapping exceptions and retaining the original exception
         | 
| 36 | 
            -
                    # information.
         | 
| 37 | 
            -
                    define_method :cause do
         | 
| 38 | 
            -
                      @cause
         | 
| 39 | 
            -
                    end
         | 
| 40 | 
            -
                  end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                  ##
         | 
| 43 | 
            -
                  # Returns the value of `status_code` from the underlying cause error
         | 
| 44 | 
            -
                  # object, if both are present. Otherwise returns `nil`.
         | 
| 45 | 
            -
                  #
         | 
| 46 | 
            -
                  # This is typically present on errors originating from calls to an API
         | 
| 47 | 
            -
                  # over HTTP/REST.
         | 
| 48 | 
            -
                  #
         | 
| 49 | 
            -
                  # @return [Object, nil]
         | 
| 50 | 
            -
                  def status_code
         | 
| 51 | 
            -
                    return nil unless cause && cause.respond_to?(:status_code)
         | 
| 52 | 
            -
                    cause.status_code
         | 
| 53 | 
            -
                  end
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                  ##
         | 
| 56 | 
            -
                  # Returns the value of `body` from the underlying cause error
         | 
| 57 | 
            -
                  # object, if both are present. Otherwise returns `nil`.
         | 
| 58 | 
            -
                  #
         | 
| 59 | 
            -
                  # This is typically present on errors originating from calls to an API
         | 
| 60 | 
            -
                  # over HTTP/REST.
         | 
| 61 | 
            -
                  #
         | 
| 62 | 
            -
                  # @return [Object, nil]
         | 
| 63 | 
            -
                  def body
         | 
| 64 | 
            -
                    return nil unless cause && cause.respond_to?(:body)
         | 
| 65 | 
            -
                    cause.body
         | 
| 66 | 
            -
                  end
         | 
| 67 | 
            -
             | 
| 68 | 
            -
                  ##
         | 
| 69 | 
            -
                  # Returns the value of `header` from the underlying cause error
         | 
| 70 | 
            -
                  # object, if both are present. Otherwise returns `nil`.
         | 
| 71 | 
            -
                  #
         | 
| 72 | 
            -
                  # This is typically present on errors originating from calls to an API
         | 
| 73 | 
            -
                  # over HTTP/REST.
         | 
| 74 | 
            -
                  #
         | 
| 75 | 
            -
                  # @return [Object, nil]
         | 
| 76 | 
            -
                  def header
         | 
| 77 | 
            -
                    return nil unless cause && cause.respond_to?(:header)
         | 
| 78 | 
            -
                    cause.header
         | 
| 79 | 
            -
                  end
         | 
| 80 | 
            -
             | 
| 81 | 
            -
                  ##
         | 
| 82 | 
            -
                  # Returns the value of `code` from the underlying cause error
         | 
| 83 | 
            -
                  # object, if both are present. Otherwise returns `nil`.
         | 
| 84 | 
            -
                  #
         | 
| 85 | 
            -
                  # This is typically present on errors originating from calls to an API
         | 
| 86 | 
            -
                  # over gRPC.
         | 
| 87 | 
            -
                  #
         | 
| 88 | 
            -
                  # @return [Object, nil]
         | 
| 89 | 
            -
                  def code
         | 
| 90 | 
            -
                    return nil unless cause && cause.respond_to?(:code)
         | 
| 91 | 
            -
                    cause.code
         | 
| 92 | 
            -
                  end
         | 
| 93 | 
            -
             | 
| 94 | 
            -
                  ##
         | 
| 95 | 
            -
                  # Returns the value of `details` from the underlying cause error
         | 
| 96 | 
            -
                  # object, if both are present. Otherwise returns `nil`.
         | 
| 97 | 
            -
                  #
         | 
| 98 | 
            -
                  # This is typically present on errors originating from calls to an API
         | 
| 99 | 
            -
                  # over gRPC.
         | 
| 100 | 
            -
                  #
         | 
| 101 | 
            -
                  # @return [Object, nil]
         | 
| 102 | 
            -
                  def details
         | 
| 103 | 
            -
                    return nil unless cause && cause.respond_to?(:details)
         | 
| 104 | 
            -
                    cause.details
         | 
| 105 | 
            -
                  end
         | 
| 106 | 
            -
             | 
| 107 | 
            -
                  ##
         | 
| 108 | 
            -
                  # Returns the value of `metadata` from the underlying cause error
         | 
| 109 | 
            -
                  # object, if both are present. Otherwise returns `nil`.
         | 
| 110 | 
            -
                  #
         | 
| 111 | 
            -
                  # This is typically present on errors originating from calls to an API
         | 
| 112 | 
            -
                  # over gRPC.
         | 
| 113 | 
            -
                  #
         | 
| 114 | 
            -
                  # @return [Object, nil]
         | 
| 115 | 
            -
                  def metadata
         | 
| 116 | 
            -
                    return nil unless cause && cause.respond_to?(:metadata)
         | 
| 117 | 
            -
                    cause.metadata
         | 
| 118 | 
            -
                  end
         | 
| 119 | 
            -
             | 
| 120 | 
            -
                  ##
         | 
| 121 | 
            -
                  # Returns the value of `status_details` from the underlying cause error
         | 
| 122 | 
            -
                  # object, if both are present. Otherwise returns `nil`.
         | 
| 123 | 
            -
                  #
         | 
| 124 | 
            -
                  # This is typically present on errors originating from calls to an API
         | 
| 125 | 
            -
                  # over gRPC.
         | 
| 126 | 
            -
                  #
         | 
| 127 | 
            -
                  # @return [Object, nil]
         | 
| 128 | 
            -
                  def status_details
         | 
| 129 | 
            -
                    return nil unless cause && cause.respond_to?(:status_details)
         | 
| 130 | 
            -
                    cause.status_details
         | 
| 131 | 
            -
                  end
         | 
| 132 | 
            -
             | 
| 133 | 
            -
                  # @private Create a new error object from a client error
         | 
| 134 | 
            -
                  def self.from_error error
         | 
| 135 | 
            -
                    klass = if error.respond_to? :code
         | 
| 136 | 
            -
                              grpc_error_class_for error.code
         | 
| 137 | 
            -
                            elsif error.respond_to? :status_code
         | 
| 138 | 
            -
                              gapi_error_class_for error.status_code
         | 
| 139 | 
            -
                            else
         | 
| 140 | 
            -
                              self
         | 
| 141 | 
            -
                            end
         | 
| 142 | 
            -
                    klass.new error.message
         | 
| 143 | 
            -
                  end
         | 
| 144 | 
            -
             | 
| 145 | 
            -
                  # @private Identify the subclass for a gRPC error
         | 
| 146 | 
            -
                  def self.grpc_error_class_for grpc_error_code
         | 
| 147 | 
            -
                    # The gRPC status code 0 is for a successful response.
         | 
| 148 | 
            -
                    # So there is no error subclass for a 0 status code, use current class.
         | 
| 149 | 
            -
                    [
         | 
| 150 | 
            -
                      self, CanceledError, UnknownError, InvalidArgumentError,
         | 
| 151 | 
            -
                      DeadlineExceededError, NotFoundError, AlreadyExistsError,
         | 
| 152 | 
            -
                      PermissionDeniedError, ResourceExhaustedError,
         | 
| 153 | 
            -
                      FailedPreconditionError, AbortedError, OutOfRangeError,
         | 
| 154 | 
            -
                      UnimplementedError, InternalError, UnavailableError, DataLossError,
         | 
| 155 | 
            -
                      UnauthenticatedError
         | 
| 156 | 
            -
                    ][grpc_error_code] || self
         | 
| 157 | 
            -
                  end
         | 
| 158 | 
            -
             | 
| 159 | 
            -
                  # @private Identify the subclass for a Google API Client error
         | 
| 160 | 
            -
                  def self.gapi_error_class_for http_status_code
         | 
| 161 | 
            -
                    # The http status codes mapped to their error classes.
         | 
| 162 | 
            -
                    {
         | 
| 163 | 
            -
                      400 => InvalidArgumentError, # FailedPreconditionError/OutOfRangeError
         | 
| 164 | 
            -
                      401 => UnauthenticatedError,
         | 
| 165 | 
            -
                      403 => PermissionDeniedError,
         | 
| 166 | 
            -
                      404 => NotFoundError,
         | 
| 167 | 
            -
                      409 => AlreadyExistsError, # AbortedError
         | 
| 168 | 
            -
                      412 => FailedPreconditionError,
         | 
| 169 | 
            -
                      429 => ResourceExhaustedError,
         | 
| 170 | 
            -
                      499 => CanceledError,
         | 
| 171 | 
            -
                      500 => InternalError, # UnknownError/DataLossError
         | 
| 172 | 
            -
                      501 => UnimplementedError,
         | 
| 173 | 
            -
                      503 => UnavailableError,
         | 
| 174 | 
            -
                      504 => DeadlineExceededError
         | 
| 175 | 
            -
                    }[http_status_code] || self
         | 
| 176 | 
            -
                  end
         | 
| 177 | 
            -
                end
         | 
| 178 | 
            -
             | 
| 179 | 
            -
                ##
         | 
| 180 | 
            -
                # Canceled indicates the operation was cancelled (typically by the caller).
         | 
| 181 | 
            -
                class CanceledError < Error
         | 
| 182 | 
            -
                end
         | 
| 183 | 
            -
             | 
| 184 | 
            -
                ##
         | 
| 185 | 
            -
                # Unknown error.  An example of where this error may be returned is
         | 
| 186 | 
            -
                # if a Status value received from another address space belongs to
         | 
| 187 | 
            -
                # an error-space that is not known in this address space.  Also
         | 
| 188 | 
            -
                # errors raised by APIs that do not return enough error information
         | 
| 189 | 
            -
                # may be converted to this error.
         | 
| 190 | 
            -
                class UnknownError < Error
         | 
| 191 | 
            -
                end
         | 
| 192 | 
            -
             | 
| 193 | 
            -
                ##
         | 
| 194 | 
            -
                # InvalidArgument indicates client specified an invalid argument.
         | 
| 195 | 
            -
                # Note that this differs from FailedPrecondition. It indicates arguments
         | 
| 196 | 
            -
                # that are problematic regardless of the state of the system
         | 
| 197 | 
            -
                # (e.g., a malformed file name).
         | 
| 198 | 
            -
                class InvalidArgumentError < Error
         | 
| 199 | 
            -
                end
         | 
| 200 | 
            -
             | 
| 201 | 
            -
                ##
         | 
| 202 | 
            -
                # DeadlineExceeded means operation expired before completion.
         | 
| 203 | 
            -
                # For operations that change the state of the system, this error may be
         | 
| 204 | 
            -
                # returned even if the operation has completed successfully. For
         | 
| 205 | 
            -
                # example, a successful response from a server could have been delayed
         | 
| 206 | 
            -
                # long enough for the deadline to expire.
         | 
| 207 | 
            -
                class DeadlineExceededError < Error
         | 
| 208 | 
            -
                end
         | 
| 209 | 
            -
             | 
| 210 | 
            -
                ##
         | 
| 211 | 
            -
                # NotFound means some requested entity (e.g., file or directory) was
         | 
| 212 | 
            -
                # not found.
         | 
| 213 | 
            -
                class NotFoundError < Error
         | 
| 214 | 
            -
                end
         | 
| 215 | 
            -
             | 
| 216 | 
            -
                ##
         | 
| 217 | 
            -
                # AlreadyExists means an attempt to create an entity failed because one
         | 
| 218 | 
            -
                # already exists.
         | 
| 219 | 
            -
                class AlreadyExistsError < Error
         | 
| 220 | 
            -
                end
         | 
| 221 | 
            -
             | 
| 222 | 
            -
                ##
         | 
| 223 | 
            -
                # PermissionDenied indicates the caller does not have permission to
         | 
| 224 | 
            -
                # execute the specified operation. It must not be used for rejections
         | 
| 225 | 
            -
                # caused by exhausting some resource (use ResourceExhausted
         | 
| 226 | 
            -
                # instead for those errors).  It must not be
         | 
| 227 | 
            -
                # used if the caller cannot be identified (use Unauthenticated
         | 
| 228 | 
            -
                # instead for those errors).
         | 
| 229 | 
            -
                class PermissionDeniedError < Error
         | 
| 230 | 
            -
                end
         | 
| 231 | 
            -
             | 
| 232 | 
            -
                ##
         | 
| 233 | 
            -
                # Unauthenticated indicates the request does not have valid
         | 
| 234 | 
            -
                # authentication credentials for the operation.
         | 
| 235 | 
            -
                class UnauthenticatedError < Error
         | 
| 236 | 
            -
                end
         | 
| 237 | 
            -
             | 
| 238 | 
            -
                ##
         | 
| 239 | 
            -
                # ResourceExhausted indicates some resource has been exhausted, perhaps
         | 
| 240 | 
            -
                # a per-user quota, or perhaps the entire file system is out of space.
         | 
| 241 | 
            -
                class ResourceExhaustedError < Error
         | 
| 242 | 
            -
                end
         | 
| 243 | 
            -
             | 
| 244 | 
            -
                ##
         | 
| 245 | 
            -
                # FailedPrecondition indicates operation was rejected because the
         | 
| 246 | 
            -
                # system is not in a state required for the operation's execution.
         | 
| 247 | 
            -
                # For example, directory to be deleted may be non-empty, an rmdir
         | 
| 248 | 
            -
                # operation is applied to a non-directory, etc.
         | 
| 249 | 
            -
                #
         | 
| 250 | 
            -
                # A litmus test that may help a service implementor in deciding
         | 
| 251 | 
            -
                # between FailedPrecondition, Aborted, and Unavailable:
         | 
| 252 | 
            -
                #  (a) Use Unavailable if the client can retry just the failing call.
         | 
| 253 | 
            -
                #  (b) Use Aborted if the client should retry at a higher-level
         | 
| 254 | 
            -
                #      (e.g., restarting a read-modify-write sequence).
         | 
| 255 | 
            -
                #  (c) Use FailedPrecondition if the client should not retry until
         | 
| 256 | 
            -
                #      the system state has been explicitly fixed.  E.g., if an "rmdir"
         | 
| 257 | 
            -
                #      fails because the directory is non-empty, FailedPrecondition
         | 
| 258 | 
            -
                #      should be returned since the client should not retry unless
         | 
| 259 | 
            -
                #      they have first fixed up the directory by deleting files from it.
         | 
| 260 | 
            -
                #  (d) Use FailedPrecondition if the client performs conditional
         | 
| 261 | 
            -
                #      REST Get/Update/Delete on a resource and the resource on the
         | 
| 262 | 
            -
                #      server does not match the condition. E.g., conflicting
         | 
| 263 | 
            -
                #      read-modify-write on the same resource.
         | 
| 264 | 
            -
                class FailedPreconditionError < Error
         | 
| 265 | 
            -
                end
         | 
| 266 | 
            -
             | 
| 267 | 
            -
                ##
         | 
| 268 | 
            -
                # Aborted indicates the operation was aborted, typically due to a
         | 
| 269 | 
            -
                # concurrency issue like sequencer check failures, transaction aborts,
         | 
| 270 | 
            -
                # etc.
         | 
| 271 | 
            -
                #
         | 
| 272 | 
            -
                # See litmus test above for deciding between FailedPrecondition,
         | 
| 273 | 
            -
                # Aborted, and Unavailable.
         | 
| 274 | 
            -
                class AbortedError < Error
         | 
| 275 | 
            -
                end
         | 
| 276 | 
            -
             | 
| 277 | 
            -
                ##
         | 
| 278 | 
            -
                # OutOfRange means operation was attempted past the valid range.
         | 
| 279 | 
            -
                # E.g., seeking or reading past end of file.
         | 
| 280 | 
            -
                #
         | 
| 281 | 
            -
                # Unlike InvalidArgument, this error indicates a problem that may
         | 
| 282 | 
            -
                # be fixed if the system state changes. For example, a 32-bit file
         | 
| 283 | 
            -
                # system will generate InvalidArgument if asked to read at an
         | 
| 284 | 
            -
                # offset that is not in the range [0,2^32-1], but it will generate
         | 
| 285 | 
            -
                # OutOfRange if asked to read from an offset past the current
         | 
| 286 | 
            -
                # file size.
         | 
| 287 | 
            -
                #
         | 
| 288 | 
            -
                # There is a fair bit of overlap between FailedPrecondition and
         | 
| 289 | 
            -
                # OutOfRange.  We recommend using OutOfRange (the more specific
         | 
| 290 | 
            -
                # error) when it applies so that callers who are iterating through
         | 
| 291 | 
            -
                # a space can easily look for an OutOfRange error to detect when
         | 
| 292 | 
            -
                # they are done.
         | 
| 293 | 
            -
                class OutOfRangeError < Error
         | 
| 294 | 
            -
                end
         | 
| 295 | 
            -
             | 
| 296 | 
            -
                ##
         | 
| 297 | 
            -
                # Unimplemented indicates operation is not implemented or not
         | 
| 298 | 
            -
                # supported/enabled in this service.
         | 
| 299 | 
            -
                class UnimplementedError < Error
         | 
| 300 | 
            -
                end
         | 
| 301 | 
            -
             | 
| 302 | 
            -
                ##
         | 
| 303 | 
            -
                # Internal errors.  Means some invariants expected by underlying
         | 
| 304 | 
            -
                # system has been broken.  If you see one of these errors,
         | 
| 305 | 
            -
                # something is very broken.
         | 
| 306 | 
            -
                class InternalError < Error
         | 
| 307 | 
            -
                end
         | 
| 308 | 
            -
             | 
| 309 | 
            -
                ##
         | 
| 310 | 
            -
                # Unavailable indicates the service is currently unavailable.
         | 
| 311 | 
            -
                # This is a most likely a transient condition and may be corrected
         | 
| 312 | 
            -
                # by retrying with a backoff.
         | 
| 313 | 
            -
                #
         | 
| 314 | 
            -
                # See litmus test above for deciding between FailedPrecondition,
         | 
| 315 | 
            -
                # Aborted, and Unavailable.
         | 
| 316 | 
            -
                class UnavailableError < Error
         | 
| 317 | 
            -
                end
         | 
| 318 | 
            -
             | 
| 319 | 
            -
                ##
         | 
| 320 | 
            -
                # DataLoss indicates unrecoverable data loss or corruption.
         | 
| 321 | 
            -
                class DataLossError < Error
         | 
| 322 | 
            -
                end
         | 
| 323 | 
            -
              end
         | 
| 324 | 
            -
            end
         |