Class: Aspera::Transfer::Spec
- Inherits:
-
Object
- Object
- Aspera::Transfer::Spec
- Defined in:
- lib/aspera/transfer/spec.rb
Overview
Parameters for Transfer Spec Parameters are generated from JSON Schema.
Constant Summary collapse
- ACCESS_KEY_TRANSFER_USER =
default transfer username for access key based transfers
'xfer'- SSH_PORT =
default ports for SSH and UDP
33_001- UDP_PORT =
33_001- AK_TSPEC_BASE =
base transfer spec for access keys
{ 'remote_user' => ACCESS_KEY_TRANSFER_USER, 'ssh_port' => SSH_PORT, 'fasp_port' => UDP_PORT }.freeze
- WSS_FIELDS =
fields for WSS
%w[wss_enabled wss_port].freeze
- TRANSPORT_FIELDS =
all fields for transport
(%w[remote_host] + AK_TSPEC_BASE.keys + WSS_FIELDS).freeze
- TAG_RESERVED =
reserved tag for Aspera
'aspera'- SPECIFIC =
%w{token paths direction source_root destination_root}.freeze
- SCHEMA =
CommandLineBuilder.read_schema(Schema::Registry::TRANSFER_SPEC, ascp: true)
Class Method Summary collapse
-
.direction_to_transfer_type(direction) ⇒ Object
translate send/receive to upload/download.
- .fix_transferd_resume_policy(transfer_spec) ⇒ Object
-
.rate_string_to_kbps(value) ⇒ Integer
Parse a human-readable rate string (as accepted by ascp -l) into an integer kbps value.
-
.transfer_type_to_direction(transfer_type) ⇒ Object
translate upload/download to send/receive.
Class Method Details
.direction_to_transfer_type(direction) ⇒ Object
translate send/receive to upload/download
50 51 52 |
# File 'lib/aspera/transfer/spec.rb', line 50 def direction_to_transfer_type(direction) XFER_DIR_TO_TYPE.fetch(direction) end |
.fix_transferd_resume_policy(transfer_spec) ⇒ Object
65 66 67 68 |
# File 'lib/aspera/transfer/spec.rb', line 65 def fix_transferd_resume_policy(transfer_spec) # Fix discrepancy in transfer spec transfer_spec['resume_policy'] = POLICY_FIX[transfer_spec['resume_policy']] if transfer_spec.key?('resume_policy') end |
.rate_string_to_kbps(value) ⇒ Integer
Parse a human-readable rate string (as accepted by ascp -l) into an integer kbps value. Accepted: plain integer (kbps), or integer + suffix k/K (kbps), m/M (x1000 kbps), g/G (x1000000 kbps).
58 59 60 61 62 63 |
# File 'lib/aspera/transfer/spec.rb', line 58 def rate_string_to_kbps(value) m = value.to_s.strip.match(/\A(\d+)([kKmMgG])?\z/) Aspera.assert(m) { "Invalid rate value: #{value.inspect}. Expected integer with optional suffix k/K, m/M or g/G." } multiplier = m[2] ? RATE_SUFFIX_KBPS.fetch(m[2].downcase) : 1 return m[1].to_i * multiplier end |
.transfer_type_to_direction(transfer_type) ⇒ Object
translate upload/download to send/receive
45 46 47 |
# File 'lib/aspera/transfer/spec.rb', line 45 def transfer_type_to_direction(transfer_type) XFER_TYPE_TO_DIR.fetch(transfer_type) end |