Sha256: 73260156cd3db0ab049b5f8144a52cc769f540c121e3be3aa485ed733d6c617c

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

module Fog
  module Compute
    class ProfitBricks
      class Real
        # Associates a NIC to a Load Balancer, enabling the NIC to participate in load-balancing
        #
        # ==== Parameters
        # * datacenter_id<~String>   - UUID of the data center
        # * load_balancer_id<~String> - UUID of the load balancer
        # * nic_id<~String>           - UUID of the NIC
        #
        # ==== Returns
        # * response<~Excon::Response> - No response parameters
        #   (HTTP/1.1 202 Accepted)
        #
        # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#remove-a-nic-association]
        def remove_nic_association(datacenter_id, load_balancer_id, nic_id)
          request(
              :expects => [202],
              :method  => 'DELETE',
              :path    => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}/balancednics/#{nic_id}"
          )
        rescue => error
          Fog::Errors::NotFound.new(error)
        end
      end

      class Mock
        def remove_nic_association(datacenter_id, load_balancer_id, nic_id)
          if load_balancer = self.data[:load_balancers]['items'].find {
              |lb| lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id
          }
          else
            raise Fog::Errors::NotFound.new("The requested resource could not be found")
          end

          response        = Excon::Response.new
          response.status = 202
          response
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-profitbricks-2.0.1 lib/fog/profitbricks/requests/compute/remove_nic_association.rb