module CustomResource::ElasticTranscoder::MixIns::Cli
Public Instance Methods
connect()
click to toggle source
# File lib/customresource/elastictranscoder/mixins/cli.rb, line 219 def connect() begin instprofcred = ::Aws::InstanceProfileCredentials.new( :ip_address => @options[:ip_address] || '169.254.169.254') instprofcred.refresh! major,minor,patch = ::Aws::VERSION.split(/\./) if major.to_i >= 2 and minor.to_i > 0 raise 'Cannot obtain InstanceProfileCredentials' unless instprofcred.credentials.access_key_id else raise 'Cannot obtain InstanceProfileCredentials' unless instprofcred.access_key_id end @logger.info instprofcred.inspect # noinspection RubyArgCount @elastictranscoder = ::Aws::ElasticTranscoder::Client.new(credentials: instprofcred, region: @region, :retry_limit => 10) rescue Exception => e if e.class.to_s.match %r'^Errno' abort! "#{e.message}: (InstanceProfileCredentials)?" else case e.class.to_s when /URI::InvalidURIError/ abort! "#{e.message}: HINT: Is the AWS SDK credentials configured correctly?" else abort! "#{e.message}" end end end end
get_item_data(item, section, params)
click to toggle source
# File lib/customresource/elastictranscoder/mixins/cli.rb, line 246 def get_item_data(item, section, params) # noinspection RubyStringKeysInHashInspection hash = case section when /Pipelines/ { 'Arn' => item[:arn], 'Name' => item[:name], 'PipelineId' => item[:id], 'Status' => item[:status], 'Role' => item[:role], 'InputBucket' => item[:input_bucket], 'OutputBucket' => item[:output_bucket], } when /Presets/ { 'Arn' => item[:arn], 'Name' => item[:name], 'Description' => item[:description], 'PresetId' => item[:id], 'Container' => item[:container], } when /Jobs/ { 'Arn' => item[:arn], } else abort! "Unsupported resource type: #{section}" end data = {} hash.each{ |k,v| data[k] = v unless v.nil? } data end
init_attributes()
click to toggle source
# File lib/customresource/elastictranscoder/mixins/cli.rb, line 10 def init_attributes @valid_keys = { :Presets => { :name => nil, :description => nil, :container => nil, :video => { :codec => nil, :codec_options => { :'*' => nil, }, :keyframes_max_dist => nil, :fixed_gop => nil, :bit_rate => nil, :frame_rate => nil, :max_frame_rate => nil, :resolution => nil, :aspect_ratio => nil, :max_width => nil, :max_height => nil, :display_aspect_ratio => nil, :sizing_policy => nil, :padding_policy => nil, :watermarks => { :id => nil, :max_width => nil, :max_height => nil, :sizing_policy => nil, :horizontal_align => nil, :horizontal_offset => nil, :vertical_align => nil, :vertical_offset => nil, :opacity => nil, :target => nil, }, }, :audio => { :codec => nil, :sample_rate => nil, :bit_rate => nil, :channels => nil, :codec_options => { :profile => nil, }, }, :thumbnails => { :format => nil, :interval => nil, :resolution => nil, :aspect_ratio => nil, :max_width => nil, :max_height => nil, :sizing_policy => nil, :padding_policy => nil, }, }, :Pipelines => { # required name: nil, # required input_bucket: nil, output_bucket: nil, # required role: nil, notifications: { progressing: nil, completed: nil, warning: nil, error: nil, }, content_config: { bucket: nil, storage_class: nil, permissions: { grantee_type: nil, grantee: nil, access: nil, }, }, thumbnail_config: { bucket: nil, storage_class: nil, permissions: { grantee_type: nil, grantee: nil, access: nil, }, }, }, :Jobs => { # required pipeline_id: nil, # required input: { key: nil, frame_rate: nil, resolution: nil, aspect_ratio: nil, interlaced: nil, container: nil, }, output: { key: nil, thumbnail_pattern: nil, rotate: nil, preset_id: nil, segment_duration: nil, watermarks: { preset_watermark_id: nil, input_key: nil, }, album_art: { merge_policy: nil, artwork: { input_key: nil, max_width: nil, max_height: nil, sizing_policy: nil, padding_policy: nil, album_art_format: nil, }, }, composition: { time_span: { start_time: nil, duration: nil, }, }, captions: { merge_policy: nil, caption_sources: { key: nil, language: nil, time_offset: nil, label: nil, }, caption_formats: { format: nil, pattern: nil, }, }, }, outputs: { key: nil, thumbnail_pattern: nil, rotate: nil, preset_id: nil, segment_duration: nil, watermarks: { preset_watermark_id: nil, input_key: nil, }, album_art: { merge_policy: nil, artwork: { input_key: nil, max_width: nil, max_height: nil, sizing_policy: nil, padding_policy: nil, album_art_format: nil, }, }, composition: { time_span: { start_time: nil, duration: nil, }, }, captions: { merge_policy: nil, caption_sources: { key: nil, language: nil, time_offset: nil, label: nil, }, caption_formats: { format: nil, pattern: nil, }, }, }, output_key_prefix: nil, playlists: { name: nil, format: nil, output_keys: nil, }, } } end