Sha256: 3ace0d5136f4ae71e4286cc5498fd351cd40a6ba23f2f3fb7d0141bc8a819d6e
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
module Fog module Compute class HuaweiCloud class Real # === Parameters # * server_id <~String> # * options <~Hash> def create_os_interface(server_id, options={}) body = { 'interfaceAttachment' => {} } if options[:port_id] body['interfaceAttachment']['port_id'] = options[:port_id] elsif options[:subnet_id] body['interfaceAttachment']['subnet_id'] = options[:subnet_id] end if options[:ip_address] body['interfaceAttachment']['fixed_ips'] = {ip_address: options[:ip_address]} end request( :body => Fog::JSON.encode(body), :expects => [200, 201, 202, 204], :method => 'POST', :path => "servers/#{server_id}/os-interface" ) end end class Mock def create_os_interface(server_id, options={}) Excon::Response.new( :body => {'interfaceAttachment' => data[:os_interfaces].first}, :status => 200 ) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems