Class: Fastly::Director

Inherits:
BelongsToServiceAndVersion show all
Defined in:
lib/fastly/director.rb

Overview

A logical collection of backends - for example all the asset servers in one data center

Instance Attribute Summary collapse

Attributes inherited from BelongsToServiceAndVersion

#version

Attributes inherited from Base

#fetcher

Instance Method Summary collapse

Methods inherited from BelongsToServiceAndVersion

#as_hash, delete_path, get_path, path_escape, post_path, put_path, #service, #version_number

Methods inherited from Base

#as_hash, #delete!, delete_path, get_path, #initialize, list_path, path, post_path, put_path, #require_api_key!, #save!

Constructor Details

This class inherits a constructor from Fastly::Base

Instance Attribute Details

#capacityObject

Returns the value of attribute capacity.



4
5
6
# File 'lib/fastly/director.rb', line 4

def capacity
  @capacity
end

#commentObject

Returns the value of attribute comment.



4
5
6
# File 'lib/fastly/director.rb', line 4

def comment
  @comment
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/fastly/director.rb', line 4

def name
  @name
end

#quorumObject

Returns the value of attribute quorum.



4
5
6
# File 'lib/fastly/director.rb', line 4

def quorum
  @quorum
end

#retriesObject

Returns the value of attribute retries.



4
5
6
# File 'lib/fastly/director.rb', line 4

def retries
  @retries
end

#service_idObject

Returns the value of attribute service_id.



4
5
6
# File 'lib/fastly/director.rb', line 4

def service_id
  @service_id
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/fastly/director.rb', line 4

def type
  @type
end

Instance Method Details

#add_backend(backend) ⇒ Object

Add a Backend object to a Director

Return true on success and false on failure



50
51
52
53
# File 'lib/fastly/director.rb', line 50

def add_backend(backend)
  hash = fetcher.client.post("#{Director.put_path(self)}/backend/#{backend.name}")
  !hash.nil?
end

#delete_backend(backend) ⇒ Object

Delete a Backend object from a Director

Return true on success and false on failure



58
59
60
61
# File 'lib/fastly/director.rb', line 58

def delete_backend(backend)
  hash = fetcher.client.delete("#{Director.put_path(self)}/backend/#{backend.name}")
  !hash.nil?
end