Sha256: ae8f6223cc6f8705e94f5f6a16550a039079041d410b14ca932266ae4b816063

Contents?: true

Size: 1.78 KB

Versions: 34

Compression:

Stored size: 1.78 KB

Contents

module Fog
  module AWS
    class ELB
      class Real

        require 'fog/aws/parsers/elb/empty'


        # Sets attributes of the load balancer
        #
        # Currently the only attribute that can be set is whether CrossZoneLoadBalancing
        # is enabled
        #
        # http://docs.aws.amazon.com/ElasticLoadBalancing/latest/APIReference/API_ModifyLoadBalancerAttributes.html
        # ==== Parameters
        # * lb_name<~String> - Name of the ELB
        # * options<~Hash>
        #   * 'CrossZoneLoadBalancing'<~Hash>:
        #     * 'Enabled'<~Boolean> whether to enable cross zone load balancing
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'ResponseMetadata'<~Hash>:
        #       * 'RequestId'<~String> - Id of request
        def modify_load_balancer_attributes(lb_name, options)
          attributes = Fog::AWS.serialize_keys 'LoadBalancerAttributes', options
          request(attributes.merge(
            'Action'           => 'ModifyLoadBalancerAttributes',
            'LoadBalancerName' => lb_name,
            :parser            => Fog::Parsers::AWS::ELB::Empty.new
          ))
        end

      end

      class Mock
        def modify_load_balancer_attributes(lb_name, attributes)
          raise Fog::AWS::ELB::NotFound unless load_balancer = self.data[:load_balancers][lb_name]

          if attributes['CrossZoneLoadBalancing']
            load_balancer['LoadBalancerAttributes'].merge! attributes
          end
          
          response = Excon::Response.new

          response.status = 200
          response.body = {
            "ResponseMetadata" => {
              "RequestId" => Fog::AWS::Mock.request_id
            }
          }

          response
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
fog-maestrodev-1.18.0.20131205181604 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb