Class: Jelastic::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/jelastic/environment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#action_keyObject

Returns the value of attribute action_key.



7
8
9
# File 'lib/jelastic/environment.rb', line 7

def action_key
  @action_key
end

#clientObject (readonly)

Returns the value of attribute client.



9
10
11
# File 'lib/jelastic/environment.rb', line 9

def client
  @client
end

#display_nameObject

Returns the value of attribute display_name.



7
8
9
# File 'lib/jelastic/environment.rb', line 7

def display_name
  @display_name
end

#engineObject

Returns the value of attribute engine.



7
8
9
# File 'lib/jelastic/environment.rb', line 7

def engine
  @engine
end

#high_availabilityObject

Returns the value of attribute high_availability.



7
8
9
# File 'lib/jelastic/environment.rb', line 7

def high_availability
  @high_availability
end

#nodesObject

Returns the value of attribute nodes.



7
8
9
# File 'lib/jelastic/environment.rb', line 7

def nodes
  @nodes
end

#regionObject

Returns the value of attribute region.



7
8
9
# File 'lib/jelastic/environment.rb', line 7

def region
  @region
end

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/jelastic/environment.rb', line 9

def response
  @response
end

#short_domainObject

Returns the value of attribute short_domain.



7
8
9
# File 'lib/jelastic/environment.rb', line 7

def short_domain
  @short_domain
end

#sslObject

Returns the value of attribute ssl.



7
8
9
# File 'lib/jelastic/environment.rb', line 7

def ssl
  @ssl
end

Class Method Details

.create(client, **params) {|environment| ... } ⇒ Object

Yields:

  • (environment)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jelastic/environment.rb', line 15

def self.create(client, **params)
  environment = allocate
  environment.nodes = []

  yield(environment)

  environment.action_key ||= SecureRandom.hex

  serialized_env = Serializers::Environment.new(environment).serialize

  response = client.create_environment(serialized_env)
  environment.instance_variable_set('@response', response)

  environment
end

Instance Method Details

#add_docker_node {|node| ... } ⇒ Object

Yields:

  • (node)


40
41
42
43
44
45
46
47
# File 'lib/jelastic/environment.rb', line 40

def add_docker_node
  node = DockerNode.new
  nodes << node

  yield(node)

  nil
end

#add_node {|node| ... } ⇒ Object

Yields:

  • (node)


31
32
33
34
35
36
37
38
# File 'lib/jelastic/environment.rb', line 31

def add_node
  node = Node.new
  nodes << node

  yield(node)

  nil
end

#high_availability?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/jelastic/environment.rb', line 53

def high_availability?
  high_availability
end

#ssl?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/jelastic/environment.rb', line 61

def ssl?
  ssl
end

#with_high_availabilityObject



49
50
51
# File 'lib/jelastic/environment.rb', line 49

def with_high_availability
  @high_availability = true
end

#with_sslObject



57
58
59
# File 'lib/jelastic/environment.rb', line 57

def with_ssl
  @ssl = true
end