Module: IcingaCertService::Download

Included in:
Client
Defined in:
lib/cert-service/download.rb

Overview

Client Class to create on-the-fly a certificate to connect automaticly as satellite to an icinga2-master

Instance Method Summary collapse

Instance Method Details

#download(params) ⇒ Object

allows you to download a static file which is stored in the directory assets

currently only ‘icinga2_certificates.sh’



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cert-service/download.rb', line 12

def download(params)

  file_name        = validate( params, required: true, var: 'file_name', type: String )
  request          = validate( params, required: true, var: 'request', type: Hash )

  whitelist = ['icinga2_certificates.sh']

  return { status: 500, message: 'file are unknown' } unless( whitelist.include?(file_name) )

  { status: 200, path: format('%s/assets', @base_directory), file_name: file_name }
end