Sha256: eb23bf97377fe1741e14e5aa750a2f6878d971f06ee8a9f25b928b43842e3110

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

module Fog
  module Compute
    class QingCloud
      class Real

        def leave_vxnet(vxnet_id, server_id)
          params = Fog::QingCloud.indexed_param('instances', [*server_id])
          params['vxnet'] = vxnet_id
          request({
            'action'    => 'LeaveVxnet',
          }.merge!(params))
        end
      end

      class Mock
        def leave_vxnet(vxnet_id, server_id)
          vxnets = self.data[:vxnets]

          # Transition from pending to available
          vxnets.each do |vxnet|
            case vxnet['state']
              when 'pending'
                vxnet['state'] = 'available'
            end
          end

          if filters['vxnet-id']
            vxnets = vxnets.reject {|vxnet| vxnet['vxnetId'] != filters['vxnet-id']}
          end

          Excon::Response.new(
            :status => 200,
            :body   => {
              'requestId' => Fog::QingCloud::Mock.request_id,
              'vxnetSet' => vxnets
            }
          )
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ns-fog-1.22.11 lib/fog/qingcloud/requests/compute/leave_vxnet.rb
ns-fog-1.22.10 lib/fog/qingcloud/requests/compute/leave_vxnet.rb
ns-fog-1.22.9 lib/fog/qingcloud/requests/compute/leave_vxnet.rb
ns-fog-1.22.8 lib/fog/qingcloud/requests/compute/leave_vxnet.rb
ns-fog-1.22.7 lib/fog/qingcloud/requests/compute/leave_vxnet.rb
ns-fog-1.22.6 lib/fog/qingcloud/requests/compute/leave_vxnet.rb
ns-fog-1.22.4 lib/fog/qingcloud/requests/compute/leave_vxnet.rb
ns-fog-1.22.3 lib/fog/qingcloud/requests/compute/leave_vxnet.rb
ns-fog-1.22.2 lib/fog/qingcloud/requests/compute/leave_vxnet.rb