Sha256: 2bbfa07a8ab82bcb6d594e5d27180c7012a4df7785ebbe347e3d642a590d50b1

Contents?: true

Size: 973 Bytes

Versions: 4

Compression:

Stored size: 973 Bytes

Contents

module Fog
  module Compute
    class HuaweiCloud
      class Real
        def delete_meta(collection_name, parent_id, key)
          request(
            :expects => 204,
            :method  => 'DELETE',
            :path    => "#{collection_name}/#{parent_id}/metadata/#{key}"
          )
        end
      end

      class Mock
        def delete_meta(collection_name, parent_id, _key)
          if collection_name == "images"
            unless list_images_detail.body['images'].find { |image| image['id'] == parent_id }
              raise Fog::Compute::HuaweiCloud::NotFound
            end
          end

          if collection_name == "servers"
            unless list_servers_detail.body['servers'].find { |server| server['id'] == parent_id }
              raise Fog::Compute::HuaweiCloud::NotFound
            end
          end

          response = Excon::Response.new
          response.status = 204
          response
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/compute/huaweicloud/requests/delete_meta.rb
fog-huaweicloud-0.0.2 lib/fog/compute/huaweicloud/requests/delete_meta.rb
fog-huaweicloud-0.1.3 lib/fog/compute/huaweicloud/requests/delete_meta.rb
fog-huaweicloud-0.1.2 lib/fog/compute/huaweicloud/requests/delete_meta.rb