Class: OdaniaStaticPages::Config::Deploy::S3

Inherits:
Object
  • Object
show all
Defined in:
lib/odania_static_pages/config/s3.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bucket_name_green: 'odania-http-green', bucket_name_blue: 'odania-http-blue', logging_bucket: 'odania-logging', region: 'eu-central-1', state_bucket: 'odania-state', profile: nil, tags: {deployed_by: 'odania-static-pages'}) ⇒ S3

Returns a new instance of S3.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/odania_static_pages/config/s3.rb', line 7

def initialize(bucket_name_green: 'odania-http-green', bucket_name_blue: 'odania-http-blue',
							 logging_bucket: 'odania-logging', region: 'eu-central-1', state_bucket: 'odania-state',
							 profile: nil, tags: {deployed_by: 'odania-static-pages'})
	@bucket_name_green = bucket_name_green
	@bucket_name_blue = bucket_name_blue
	@logging_bucket = logging_bucket
	@state_bucket = state_bucket
	@region = region
	@profile = profile
	@tags = tags
end

Instance Attribute Details

#bucket_name_blueObject (readonly)

Returns the value of attribute bucket_name_blue.



5
6
7
# File 'lib/odania_static_pages/config/s3.rb', line 5

def bucket_name_blue
  @bucket_name_blue
end

#bucket_name_greenObject (readonly)

Returns the value of attribute bucket_name_green.



5
6
7
# File 'lib/odania_static_pages/config/s3.rb', line 5

def bucket_name_green
  @bucket_name_green
end

#logging_bucketObject (readonly)

Returns the value of attribute logging_bucket.



5
6
7
# File 'lib/odania_static_pages/config/s3.rb', line 5

def logging_bucket
  @logging_bucket
end

#profileObject (readonly)

Returns the value of attribute profile.



5
6
7
# File 'lib/odania_static_pages/config/s3.rb', line 5

def profile
  @profile
end

#regionObject (readonly)

Returns the value of attribute region.



5
6
7
# File 'lib/odania_static_pages/config/s3.rb', line 5

def region
  @region
end

#state_bucketObject (readonly)

Returns the value of attribute state_bucket.



5
6
7
# File 'lib/odania_static_pages/config/s3.rb', line 5

def state_bucket
  @state_bucket
end

Instance Method Details

#tagsObject



31
32
33
34
35
36
37
# File 'lib/odania_static_pages/config/s3.rb', line 31

def tags
	result = []
	@tags.each_pair do |key, val|
		result << {key: key, value: val}
	end
	result
end

#to_hObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/odania_static_pages/config/s3.rb', line 19

def to_h
	{
		bucket_name_green: @bucket_name_green,
		bucket_name_blue: @bucket_name_blue,
		logging_bucket: @logging_bucket,
		state_bucket: @state_bucket,
		region: @region,
		profile: @profile,
		tags: @tags.stringify_keys!
	}.stringify_keys!
end