Sha256: 44a3d1f984e6299e830680b529bfa29d5daff4cd4e16fe0d9937f44bdd8b9bec

Contents?: true

Size: 1.91 KB

Versions: 78

Compression:

Stored size: 1.91 KB

Contents

module Fog
  module AWS
    class ELB
      class Real

        require 'fog/aws/parsers/elb/detach_load_balancer_from_subnets'

        # Disable a subnet for an existing ELB
        #
        # ==== Parameters
        # * subnet_ids<~Array> - List of subnet ids to enable on ELB
        # * lb_name<~String> - Load balancer to disable availability zones on
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'ResponseMetadata'<~Hash>:
        #       * 'RequestId'<~String> - Id of request
        #     * 'DetachLoadBalancerFromSubnetsResult'<~Hash>:
        #       * 'Subnets'<~Array> - array of strings describing the subnet ids currently enabled
        def detach_load_balancer_from_subnets(subnet_ids, lb_name)
          params = Fog::AWS.indexed_param('Subnets.member', [*subnet_ids])
          request({
            'Action'           => 'DetachLoadBalancerFromSubnets',
            'LoadBalancerName' => lb_name,
            :parser            => Fog::Parsers::AWS::ELB::DetachLoadBalancerFromSubnets.new
          }.merge!(params))
        end

        alias :disable_subnets :detach_load_balancer_from_subnets

      end

      class Mock

        def detach_load_balancer_from_subnets(subnet_ids, lb_name)
          raise Fog::AWS::ELB::NotFound unless load_balancer = self.data[:load_balancers][lb_name]

          response = Excon::Response.new
          response.status = 200

          load_balancer['Subnets'] << subnet_ids
          load_balancer['Subnets'].flatten!.uniq!

          response.body = {
            'ResponseMetadata' => {
              'RequestId' => Fog::AWS::Mock.request_id
            },
            'DetachLoadBalancerFromSubnetsResult' => {
              'Subnets' => load_balancer['Subnets']
            }
          }

          response
        end

        alias :disable_subnets :detach_load_balancer_from_subnets
      end
    end
  end
end

Version data entries

78 entries across 78 versions & 11 rubygems

Version Path
fog-1.22.0 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-1.21.0 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-1.20.0 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-1.19.0 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/elb/detach_load_balancer_from_subnets.rb