Sha256: 3d863ccff967ea2de9520304f1c1ab1440a0c98d504396c5ec580742cf0d9346

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

module Fog
  module Volume
    class HuaweiCloud
      module Real
        def update_snapshot(snapshot_id, data = {})
          request(
            :body    => Fog::JSON.encode('snapshot' => data),
            :expects => 200,
            :method  => 'PUT',
            :path    => "snapshots/#{snapshot_id}"
          )
        end
      end

      module Mock
        def update_snapshot(snapshot_id, options = {})
          unless snapshot_id
            raise ArgumentError, 'snapshot_id is required'
          end
          response = Excon::Response.new
          if snapshot = data[:snapshots][snapshot_id]
            response.status                 = 200
            snapshot['display_name']        = options['display_name'] if options['display_name']
            snapshot['display_description'] = options['display_description'] if options['display_description']
            snapshot['name']                = options['name'] if options['name']
            snapshot['description']         = options['description'] if options['description']
            snapshot['metadata']            = options['metadata'] if options['metadata']
            response.body                   = {'snapshot' => snapshot}
            response
          else
            raise Fog::HP::BlockStorageV2::NotFound
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/volume/huaweicloud/requests/update_snapshot.rb
fog-huaweicloud-0.0.2 lib/fog/volume/huaweicloud/requests/update_snapshot.rb
fog-huaweicloud-0.1.3 lib/fog/volume/huaweicloud/requests/update_snapshot.rb
fog-huaweicloud-0.1.2 lib/fog/volume/huaweicloud/requests/update_snapshot.rb