Sha256: a5af79b8f5b6bbdbb3da72cf02c94aef010479eb0995e41ca853d36c2356f54b

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

module Yao::Resources
  class LoadBalancerPoolMember < Base
    friendly_attributes :monitor_port, :name, :weight,
                        :admin_state_up, :provisioning_status,
                        :monitor_address, :address,
                        :protocol_port, :operating_status

    def project
      Yao::Tenant.find self["project_id"]
    end

    def subnet
      Yao::Subnet.find self["subnet_id"]
    end

    self.service        = "load-balancer"
    self.api_version    = "v2.0"
    self.resource_name  = "member"
    self.resources_name = "members"

    class << self

      def list(pool, query={})
        self.resources_path = member_resources_path(pool)
        super(query)
      end

      def get(pool, id_or_permalink, query={})
        self.resources_path = member_resources_path(pool)
        super(id_or_permalink, query)
      end
      alias find get

      def create(pool, resource_params)
        self.resources_path = member_resources_path(pool)
        super(resource_params)
      end

      def update(pool, id, resource_params)
        self.resources_path = member_resources_path(pool)
        super(id, resource_params)
      end

      def destroy(pool, id)
        self.resources_path = member_resources_path(pool)
        super(id)
      end

      private
      def member_resources_path(pool)
        "lbaas/pools/#{pool.id}/#{self.resources_name}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yao-0.3.7 lib/yao/resources/loadbalancer_pool_member.rb