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.20.0.20140305101839 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-1.20.0 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-1.19.0 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/aws/requests/elb/modify_load_balancer_attributes.rb