Sha256: dbe0b83d3c35e4d28504c378338ea00e204c6b9b6795b6b0fe608e39d5f2a116

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

module Fog
  module Compute
    class Gridscale
      class Real

        def ip_create(family, options ={})

          create_options = {
              :family   => family,
          }
          create_options[:labels] = options[:labels] || []

          if options[:name]
            create_options[:name] = options[:name]
          end

          if options[:failover]
            create_options[:failover] = options[:failover]
          end

          if options[:reverse_dns]
            create_options[:reverse_dns] = options[:reverse_dns]
          end

          if options[:location_uuid]
            create_options[:location_uuid] = options[:location_uuid]
          else
            create_options[:location_uuid] = '45ed677b-3702-4b36-be2a-a2eab9827950'
          end
          encoded_body = Fog::JSON.encode(create_options)

          request(
              :expects => [202],
              :headers => {
                  'Content-Type' => "application/json; charset=UTF-8",
              },
              :method  => 'POST',
              :path    => '/objects/ips',
              :body    => encoded_body,
              )
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-gridscale-0.1.5 lib/fog/compute/gridscale/requests/ip_create.rb
fog-gridscale-0.1.4 lib/fog/compute/gridscale/requests/ip_create.rb
fog-gridscale-0.1.3 lib/fog/compute/gridscale/requests/ip_create.rb
fog-gridscale-0.1.2 lib/fog/compute/gridscale/requests/ip_create.rb