Class: Comodule::Deployment::Helper::Aws::Ssl::Service
- Inherits:
-
Object
- Object
- Comodule::Deployment::Helper::Aws::Ssl::Service
- Includes:
- Base
- Defined in:
- lib/comodule/deployment/helper/aws/ssl.rb
Instance Method Summary collapse
- #delete ⇒ Object
- #describe ⇒ Object
- #find ⇒ Object
- #iam ⇒ Object
- #inspect_certificate(cert) ⇒ Object
- #inspect_certificate_body(cert) ⇒ Object
- #inspect_certificate_chain(cert) ⇒ Object
- #inspect_certificate_summary(cert) ⇒ Object
- #upload ⇒ Object
Methods included from Base
Instance Method Details
#delete ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/comodule/deployment/helper/aws/ssl.rb', line 27 def delete name = config.ssl.name cert = iam.server_certificates[name] puts "I am going to delete this server certificate #{name}. Are you sure? [N/y] " confirm = STDIN.gets unless confirm =~ /^y(es)?$/ puts "\nAbort!\n" return end puts cert.delete end |
#describe ⇒ Object
20 21 22 23 24 25 |
# File 'lib/comodule/deployment/helper/aws/ssl.rb', line 20 def describe puts iam.server_certificates.each do |cert| inspect_certificate cert end end |
#find ⇒ Object
105 106 107 108 109 |
# File 'lib/comodule/deployment/helper/aws/ssl.rb', line 105 def find iam.server_certificates.find do |cert| cert.name == config.ssl.name end end |
#iam ⇒ Object
16 17 18 |
# File 'lib/comodule/deployment/helper/aws/ssl.rb', line 16 def iam aws.iam end |
#inspect_certificate(cert) ⇒ Object
78 79 80 81 82 |
# File 'lib/comodule/deployment/helper/aws/ssl.rb', line 78 def inspect_certificate(cert) inspect_certificate_summary cert inspect_certificate_body cert inspect_certificate_chain cert end |
#inspect_certificate_body(cert) ⇒ Object
93 94 95 96 97 |
# File 'lib/comodule/deployment/helper/aws/ssl.rb', line 93 def inspect_certificate_body(cert) puts "body:" puts cert.certificate_body puts end |
#inspect_certificate_chain(cert) ⇒ Object
99 100 101 102 103 |
# File 'lib/comodule/deployment/helper/aws/ssl.rb', line 99 def inspect_certificate_chain(cert) puts "chain:" puts cert.certificate_chain puts end |
#inspect_certificate_summary(cert) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/comodule/deployment/helper/aws/ssl.rb', line 84 def inspect_certificate_summary(cert) puts "arn: #{cert.arn}" puts "id: #{cert.id}" puts "name: #{cert.name}" puts "path: #{cert.path}" puts "upload_date: #{cert.upload_date}" puts end |
#upload ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/comodule/deployment/helper/aws/ssl.rb', line 39 def upload body = File.open(owner.file_path(config.ssl.dir, config.ssl.body_file)).read chain = File.open(owner.file_path(config.ssl.dir, config.ssl.chain_file)).read key = File.open(owner.file_path(config.ssl.dir, config.ssl.key_file)).read puts "body:" puts body puts puts "chain:" puts chain puts puts "key" puts key puts puts "AWS IAM server certificate name: #{config.ssl.name}" puts "I am going to upload this server certificate to AWS IAM. Are you sure? [N/y] " confirm = STDIN.gets unless confirm =~ /^y(es)?$/ puts "\nAbort!\n" return end cert = iam.server_certificates.create( certificate_body: body, name: config.ssl.name, path: config.ssl.path || ?/, private_key: key, certificate_chain: chain ) unless cert 'Failed!' return end puts puts "Success:" inspect_certificate cert end |