Sha256: ac8b6597fd55b9910c78a696b6f045576a335162d2a17e3858fad82dace8bb7b

Contents?: true

Size: 1.83 KB

Versions: 4

Compression:

Stored size: 1.83 KB

Contents

require 'fog/compute/gridscale/models/loadbalancer'

module Fog
  module Compute
    class Gridscale
      class Loadbalancer < Fog::Model
        identity :object_uuid

        attribute :algorithm
        attribute :backend_servers
        attribute :change_time
        attribute :create_time
        attribute :current_price
        attribute :forwarding_rules
        attribute :labels
        attribute :listen_ipv4_uuid
        attribute :listen_ipv6_uuid
        attribute :location_country
        attribute :location_iata
        attribute :location_name
        attribute :location_site
        attribute :location_uuid
        attribute :name
        attribute :object_uuid
        attribute :redirect_http_to_https
        attribute :status
        attribute :usage_in_minutes

        def save
          raise Fog::Errors::Error.new('Re-saving an existing object may create a duplicate') if persisted?
          requires :name, :algorithm, :listen_ipv4_uuid, :listen_ipv6_uuid, :backend_servers, :forwarding_rules, :redirect_http_to_https, :labels

          options = {}

          if attributes[:storage_type]
            options[:storage_type] = storage_type
          end

          if attributes[:location_uuid]
            options[:location_uuid] = location_uuid
          end

          data = service.load_balancer_create(name, algorithm, listen_ipv4_uuid, listen_ipv6_uuid, backend_servers, forwarding_rules, redirect_http_to_https, labels, options)

          merge_attributes(data.body)
          true
        end

        def delete
          requires :object_uuid
          response = service.load_balancer_delete object_uuid
          response.body
        end

        def destroy
          requires :object_uuid
          response = service.load_balancer_delete(object_uuid)
          response.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/models/loadbalancer.rb
fog-gridscale-0.1.4 lib/fog/compute/gridscale/models/loadbalancer.rb
fog-gridscale-0.1.3 lib/fog/compute/gridscale/models/loadbalancer.rb
fog-gridscale-0.1.2 lib/fog/compute/gridscale/models/loadbalancer.rb