Sha256: 84d795d6837dfe2f517f479fad15ad6146c9ee7415b71d6734e3b06615e67721

Contents?: true

Size: 1.09 KB

Versions: 27

Compression:

Stored size: 1.09 KB

Contents

module Fog
  module Image
    class OpenStack
      class Real
        def update_image_members(image_id, members)
          # Sample members
          # [
          #   {'member_id' => 'tenant1', 'can_share' => true  },
          #   {'member_id' => 'tenant2', 'can_share' => false }
          # ]
          data = { 'memberships' => members }

          request(
            :body    => Fog::JSON.encode(data),
            :expects => [200, 202],
            :method  => 'PUT',
            :path    => "images/#{image_id}/members"
          )
        end
      end # class Real

      class Mock
        def update_image_members(image_id, members)
          response = Excon::Response.new
          response.status = [200, 202][rand(1)]
          response.body = {
            'members' => [
              { 'member_id'=>'ff528b20431645ebb5fa4b0a71ca002f', 'can_share' => false },
              { 'member_id'=>'ff528b20431645ebb5fa4b0a71ca002f', 'can_share' => true  }
            ]
          }
          response
        end
      end # class Mock
    end # class OpenStack
  end # module Identity
end # module Fog

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
fog-maestrodev-1.19.0.20140212012611 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/openstack/requests/image/update_image_members.rb
fog-1.19.0 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/openstack/requests/image/update_image_members.rb