unimatrix-cli 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +4 -0
  5. data/README.md +12 -0
  6. data/Rakefile +6 -0
  7. data/VERSION +1 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/exe/unimatrix +11 -0
  11. data/lib/unimatrix_cli.rb +74 -0
  12. data/lib/unimatrix_cli/alchemist/rendition/list_command.rb +72 -0
  13. data/lib/unimatrix_cli/alchemist/rendition_profile/assign_command.rb +59 -0
  14. data/lib/unimatrix_cli/alchemist/rendition_profile/list_command.rb +36 -0
  15. data/lib/unimatrix_cli/alchemist/video/create_command.rb +40 -0
  16. data/lib/unimatrix_cli/alchemist/video/describe_command.rb +40 -0
  17. data/lib/unimatrix_cli/alchemist/video_encoder/create_command.rb +37 -0
  18. data/lib/unimatrix_cli/alchemist/video_encoder/describe_command.rb +39 -0
  19. data/lib/unimatrix_cli/alchemist/video_encoder/encode_command.rb +102 -0
  20. data/lib/unimatrix_cli/alchemist/video_encoder/list_command.rb +35 -0
  21. data/lib/unimatrix_cli/archivist/blueprint/create_command.rb +94 -0
  22. data/lib/unimatrix_cli/citadel/app/build_command.rb +28 -0
  23. data/lib/unimatrix_cli/citadel/app/console_command.rb +17 -0
  24. data/lib/unimatrix_cli/citadel/app/db_setup_command.rb +17 -0
  25. data/lib/unimatrix_cli/citadel/app/environment_command.rb +30 -0
  26. data/lib/unimatrix_cli/citadel/app/logs_command.rb +17 -0
  27. data/lib/unimatrix_cli/citadel/app/migrate_command.rb +17 -0
  28. data/lib/unimatrix_cli/citadel/app/migrate_status_command.rb +17 -0
  29. data/lib/unimatrix_cli/citadel/app/rake_command.rb +18 -0
  30. data/lib/unimatrix_cli/citadel/app/routes_command.rb +17 -0
  31. data/lib/unimatrix_cli/citadel/citadel_command.rb +285 -0
  32. data/lib/unimatrix_cli/citadel/instance/details_command.rb +18 -0
  33. data/lib/unimatrix_cli/citadel/instance/scp_command.rb +48 -0
  34. data/lib/unimatrix_cli/citadel/instance/ssh_command.rb +29 -0
  35. data/lib/unimatrix_cli/citadel/instance/status_command.rb +17 -0
  36. data/lib/unimatrix_cli/citadel/instance/user_data_command.rb +17 -0
  37. data/lib/unimatrix_cli/citadel/instance/user_data_logs_command.rb +17 -0
  38. data/lib/unimatrix_cli/cli.rb +30 -0
  39. data/lib/unimatrix_cli/command.rb +138 -0
  40. data/lib/unimatrix_cli/config/acceptance.yml +23 -0
  41. data/lib/unimatrix_cli/config/configuration.rb +66 -0
  42. data/lib/unimatrix_cli/config/production.yml +15 -0
  43. data/lib/unimatrix_cli/config/staging.yml +15 -0
  44. data/lib/unimatrix_cli/config/unimatrix.rb +4 -0
  45. data/lib/unimatrix_cli/iris/stream/create_command.rb +43 -0
  46. data/lib/unimatrix_cli/iris/stream/describe_command.rb +35 -0
  47. data/lib/unimatrix_cli/iris/stream_encoder/create_command.rb +43 -0
  48. data/lib/unimatrix_cli/iris/stream_encoder/describe_command.rb +37 -0
  49. data/lib/unimatrix_cli/iris/stream_input/create_command.rb +43 -0
  50. data/lib/unimatrix_cli/iris/stream_input/describe_command.rb +37 -0
  51. data/lib/unimatrix_cli/iris/stream_output/create_command.rb +55 -0
  52. data/lib/unimatrix_cli/iris/stream_output/describe_command.rb +37 -0
  53. data/lib/unimatrix_cli/iris/stream_recorder/create_command.rb +49 -0
  54. data/lib/unimatrix_cli/iris/stream_recorder/describe_command.rb +37 -0
  55. data/lib/unimatrix_cli/iris/stream_transcriber/create_command.rb +54 -0
  56. data/lib/unimatrix_cli/iris/stream_transcriber/describe_command.rb +37 -0
  57. data/lib/unimatrix_cli/iris/stream_transmutator/create_command.rb +65 -0
  58. data/lib/unimatrix_cli/iris/stream_transmutator/describe_command.rb +38 -0
  59. data/lib/unimatrix_cli/login_command.rb +91 -0
  60. data/lib/unimatrix_cli/logout_command.rb +21 -0
  61. data/lib/unimatrix_cli/version.rb +3 -0
  62. data/lib/unimatrix_cli/zephyrus/input/create_command.rb +40 -0
  63. data/lib/unimatrix_cli/zephyrus/input/describe_command.rb +35 -0
  64. data/lib/unimatrix_cli/zephyrus/input/list_command.rb +38 -0
  65. data/lib/unimatrix_cli/zephyrus/output/list_command.rb +44 -0
  66. data/lib/unimatrix_cli/zephyrus/recording/configuration_command.rb +43 -0
  67. data/lib/unimatrix_cli/zephyrus/rendition/list_command.rb +40 -0
  68. data/lib/unimatrix_cli/zephyrus/routing/configuration_command.rb +43 -0
  69. data/lib/unimatrix_cli/zephyrus/transcoding/configuration_command.rb +55 -0
  70. data/lib/unimatrix_cli/zephyrus/transcribing/configuration_command.rb +55 -0
  71. data/lib/unimatrix_cli/zephyrus/transmutation/configuration_command.rb +55 -0
  72. data/lib/unimatrix_parser.rb +796 -0
  73. data/unimatrix-cli.gemspec +30 -0
  74. metadata +247 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 289b4aba277e1ba0205363531ccd394b57a686b2
4
+ data.tar.gz: b7606be0d77d7044b13aafbb74c14f16544fc100
5
+ SHA512:
6
+ metadata.gz: 808ed295e4e9803c40d513368e5157ff10bf39d91acefecf0463cd6db5cf2e985fd50cd655042284992d4f98a94c31f4d1fce683305f933b83487d1b22d1cef1
7
+ data.tar.gz: e85d8c5cab5e736cee4869a77ef04a0b2a31fc0c24144716f8516b7a71ff04933edba0cefb021f1200fc748d5937af195392b404e46e6071c39690eba90dd06d
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ development.yml
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in unimatrix-cli.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # Unimatrix::CLI
2
+
3
+ A CLI for interacting with Unimatrix apps
4
+
5
+ ## Installation
6
+
7
+ $ gem install unimatrix-cli
8
+
9
+ ## Usage
10
+
11
+ Type `unimatrix` to see available commands.
12
+ Type `<command> --help` to see options.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.2.0
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "unimatrix_cli"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/unimatrix ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'unimatrix_cli'
4
+ cli = UnimatrixCLI::CLI.new
5
+ command = cli.parse_command
6
+
7
+ if UnimatrixCLI.const_defined?( command )
8
+ UnimatrixCLI.const_get( command ).new.execute
9
+ else
10
+ $stderr.puts "Error: The command #{ command } is not valid."
11
+ end
@@ -0,0 +1,74 @@
1
+ require 'unimatrix'
2
+
3
+ require 'unimatrix_parser'
4
+
5
+ require 'unimatrix_cli/config/configuration'
6
+ require 'unimatrix_cli/config/unimatrix'
7
+ require 'unimatrix_cli/version'
8
+ require 'unimatrix_cli/command'
9
+
10
+ require 'unimatrix_cli/login_command'
11
+ require 'unimatrix_cli/logout_command'
12
+
13
+ # archivist
14
+ require 'unimatrix_cli/archivist/blueprint/create_command'
15
+
16
+ # alchemist
17
+ require 'unimatrix_cli/alchemist/rendition/list_command'
18
+ require 'unimatrix_cli/alchemist/rendition_profile/assign_command'
19
+ require 'unimatrix_cli/alchemist/rendition_profile/list_command'
20
+ require 'unimatrix_cli/alchemist/video/create_command'
21
+ require 'unimatrix_cli/alchemist/video/describe_command'
22
+ require 'unimatrix_cli/alchemist/video_encoder/encode_command'
23
+ require 'unimatrix_cli/alchemist/video_encoder/create_command'
24
+ require 'unimatrix_cli/alchemist/video_encoder/describe_command'
25
+ require 'unimatrix_cli/alchemist/video_encoder/list_command'
26
+
27
+ # citadel
28
+ require 'unimatrix_cli/citadel/citadel_command'
29
+ require 'unimatrix_cli/citadel/app/build_command'
30
+ require 'unimatrix_cli/citadel/app/console_command'
31
+ require 'unimatrix_cli/citadel/app/db_setup_command'
32
+ require 'unimatrix_cli/citadel/app/environment_command'
33
+ require 'unimatrix_cli/citadel/app/logs_command'
34
+ require 'unimatrix_cli/citadel/app/migrate_command'
35
+ require 'unimatrix_cli/citadel/app/migrate_status_command'
36
+ require 'unimatrix_cli/citadel/app/rake_command'
37
+ require 'unimatrix_cli/citadel/app/routes_command'
38
+ require 'unimatrix_cli/citadel/instance/details_command'
39
+ require 'unimatrix_cli/citadel/instance/scp_command'
40
+ require 'unimatrix_cli/citadel/instance/ssh_command'
41
+ require 'unimatrix_cli/citadel/instance/status_command'
42
+ require 'unimatrix_cli/citadel/instance/user_data_command'
43
+ require 'unimatrix_cli/citadel/instance/user_data_logs_command'
44
+
45
+ # iris
46
+ require 'unimatrix_cli/iris/stream/create_command'
47
+ require 'unimatrix_cli/iris/stream/describe_command'
48
+ require 'unimatrix_cli/iris/stream_encoder/create_command'
49
+ require 'unimatrix_cli/iris/stream_encoder/describe_command'
50
+ require 'unimatrix_cli/iris/stream_input/create_command'
51
+ require 'unimatrix_cli/iris/stream_input/describe_command'
52
+ require 'unimatrix_cli/iris/stream_output/create_command'
53
+ require 'unimatrix_cli/iris/stream_output/describe_command'
54
+ require 'unimatrix_cli/iris/stream_recorder/create_command'
55
+ require 'unimatrix_cli/iris/stream_recorder/describe_command'
56
+ require 'unimatrix_cli/iris/stream_transcriber/create_command'
57
+ require 'unimatrix_cli/iris/stream_transcriber/describe_command'
58
+ require 'unimatrix_cli/iris/stream_transmutator/create_command'
59
+ require 'unimatrix_cli/iris/stream_transmutator/describe_command'
60
+
61
+ # zephyrus
62
+ require 'unimatrix_cli/zephyrus/input/create_command'
63
+ require 'unimatrix_cli/zephyrus/input/describe_command'
64
+ require 'unimatrix_cli/zephyrus/input/list_command'
65
+ require 'unimatrix_cli/zephyrus/output/list_command'
66
+ require 'unimatrix_cli/zephyrus/recording/configuration_command'
67
+ require 'unimatrix_cli/zephyrus/rendition/list_command'
68
+ require 'unimatrix_cli/zephyrus/routing/configuration_command'
69
+ require 'unimatrix_cli/zephyrus/transcoding/configuration_command'
70
+ require 'unimatrix_cli/zephyrus/transcribing/configuration_command'
71
+ require 'unimatrix_cli/zephyrus/transmutation/configuration_command'
72
+
73
+ # must be loaded after all commands in order to dynamically enumerate available commands
74
+ require 'unimatrix_cli/cli'
@@ -0,0 +1,72 @@
1
+ module UnimatrixCLI
2
+ module Alchemist
3
+ module Rendition
4
+ class ListCommand < Command
5
+
6
+ option :realm, "The realm uuid", type: :string, required: true
7
+ option :video, "The video uuid", type: :string, required: true
8
+
9
+ synopsis "List all the renditions for the specified video "
10
+
11
+ def execute
12
+ activity_proxies = find_renditions_and_activity_proxies
13
+
14
+ if validate_collection( activity_proxies, 'Alchemist::ActivityProxy' )
15
+
16
+ completed_proxies = activity_proxies.reject { | proxy | proxy.renditions.empty? }
17
+ renditions = completed_proxies.map( &:renditions ).flatten
18
+
19
+ if validate_collection( renditions, 'Alchemist::Rendition' )
20
+ renditions.each do | rendition |
21
+ write( message: parse_rendition( rendition ) )
22
+ end
23
+ activity_proxies.each do | activity_proxy |
24
+ message = parse_activity_proxy( activity_proxy )
25
+ write( message: message ) if message
26
+ end
27
+ else
28
+ write(
29
+ message: "No completed, pending, or progressing " +
30
+ "renditions found: #{ renditions.inspect }",
31
+ error: true
32
+ )
33
+ end
34
+ else
35
+ write(
36
+ message: "Error retrieving activity_proxies for " +
37
+ "the given video: #{ activity_proxies.inspect }",
38
+ error: true
39
+ )
40
+ end
41
+ end
42
+
43
+ #----------------------------------------------------------------------------
44
+
45
+ private; def find_renditions_and_activity_proxies
46
+ endpoint = "/realms/#{ @options[ :realm ] }/videos/" +
47
+ "#{ @options[ :video ] }/activity_proxies"
48
+
49
+ options = {
50
+ type: 'VideoEncodingActivityProxy'
51
+ }
52
+
53
+ operation( endpoint, options ).include( 'renditions' ).read
54
+ end
55
+
56
+ private; def parse_rendition( rendition )
57
+ "Rendition #{ rendition.name }: #{ rendition.uuid }, " +
58
+ "url: #{ rendition.url }"
59
+ end
60
+
61
+ private; def parse_activity_proxy( activity_proxy )
62
+ unless activity_proxy.state == 'succeeded'
63
+ "Rendition for profile #{ activity_proxy.rendition_profile_uuid }, " +
64
+ "state: #{ activity_proxy.state }, " +
65
+ "progress: #{ activity_proxy.progress }, " +
66
+ "message: #{ activity_proxy.message }"
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,59 @@
1
+ module UnimatrixCLI
2
+ module Alchemist
3
+ module RenditionProfile
4
+ class AssignCommand < Command
5
+
6
+ option :realm, "The realm uuid", type: :string, required: true
7
+ option :rendition_profile, "The rendition_profile uuid", type: :string, required: true, short: :p
8
+ option :video_encoder, "The video_encoder uuid", type: :string, required: true, short: :e
9
+
10
+ synopsis "Assign a rendition_profile to a video_encoder"
11
+
12
+ def execute
13
+ video_encoder = assign_rendition_profiles_to_encoder
14
+
15
+ if validate( video_encoder, 'Alchemist::VideoEncoder' )
16
+
17
+ rendition_profile = video_encoder.rendition_profiles.first
18
+
19
+ if validate( rendition_profile, 'Alchemist::RenditionProfile' )
20
+ write(
21
+ message: "Success assigning rendition_profile " +
22
+ "#{ rendition_profile.uuid } to " +
23
+ "video_encoder #{ video_encoder.uuid }"
24
+ )
25
+ else
26
+ write(
27
+ message: "Error assigning rendition_profile " +
28
+ "to video_encoder: #{ video_encoder.inspect }",
29
+ error: true
30
+ )
31
+ end
32
+ else
33
+ write(
34
+ message: "Error assigning rendition_profile " +
35
+ "to video_encoder: #{ video_encoder.inspect }",
36
+ error: true
37
+ )
38
+ end
39
+ end
40
+
41
+ #----------------------------------------------------------------------------
42
+
43
+ private; def assign_rendition_profiles_to_encoder
44
+ endpoint = "/realms/#{ @options[ :realm ] }/video_encoders/" +
45
+ "#{ @options[ :video_encoder ] }/rendition_profiles"
46
+
47
+ rendition_profile = Unimatrix::Alchemist::RenditionProfile.new(
48
+ uuid: @options[ :rendition_profile ]
49
+ )
50
+
51
+ operation( endpoint ).write(
52
+ 'rendition_profiles', rendition_profile
53
+ ).first rescue nil
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,36 @@
1
+ module UnimatrixCLI
2
+ module Alchemist
3
+ module RenditionProfile
4
+ class ListCommand < Command
5
+
6
+ option :realm, "The realm uuid", type: :string, required: true
7
+
8
+ synopsis "List all the rendition_profiles for the specified realm"
9
+
10
+ def execute
11
+ rendition_profiles = find_rendition_profiles
12
+
13
+ if validate_collection( rendition_profiles, 'Alchemist::RenditionProfile' )
14
+ rendition_profiles.each do | rendition_profile |
15
+ write( message: rendition_profile.uuid )
16
+ end
17
+ else
18
+ write(
19
+ message: "No rendition_profiles found: #{ rendition_profiles.inspect }",
20
+ error: true
21
+ )
22
+ end
23
+ end
24
+
25
+ #----------------------------------------------------------------------------
26
+
27
+ private; def find_rendition_profiles
28
+ endpoint = "/realms/#{ @options[ :realm ] }/rendition_profiles"
29
+
30
+ operation( endpoint ).read
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,40 @@
1
+ module UnimatrixCLI
2
+ module Alchemist
3
+ module Video
4
+ class CreateCommand < Command
5
+
6
+ option :realm, "The realm uuid", type: :string, required: true
7
+ option :url, "The url of the video", type: :string, required: true
8
+ option :name, "The name of the video", type: :string, required: true
9
+
10
+ synopsis "Create a new video"
11
+
12
+ def execute
13
+ video = create_video
14
+
15
+ if validate( video, 'Alchemist::Video' )
16
+ write( message: "Video uuid: #{ video.uuid }" )
17
+ else
18
+ write(
19
+ message: "Error creating video: #{ video.inspect }",
20
+ error: true
21
+ )
22
+ end
23
+ end
24
+
25
+ #----------------------------------------------------------------------------
26
+
27
+ private; def create_video
28
+ endpoint = "/realms/#{ @options[ :realm ] }/videos"
29
+
30
+ video = Unimatrix::Alchemist::Video.new(
31
+ input_url: @options[ :url ],
32
+ name: @options[ :name ]
33
+ )
34
+
35
+ operation( endpoint ).write( 'videos', video ).first rescue nil
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ module UnimatrixCLI
2
+ module Alchemist
3
+ module Video
4
+ class DescribeCommand < Command
5
+
6
+ option :realm, "The realm uuid", type: :string, required: true
7
+ option :video, "The video uuid", type: :string, required: true
8
+
9
+ synopsis "Describe a video"
10
+
11
+ def execute
12
+ video = find_video
13
+
14
+ if validate( video, 'Alchemist::Video' )
15
+ parse_object( video ).each do | response |
16
+ write( message: response )
17
+ end
18
+ else
19
+ write(
20
+ message: "Video could not be found: #{ video.inspect }",
21
+ error: true
22
+ )
23
+ end
24
+ end
25
+
26
+ #----------------------------------------------------------------------------
27
+
28
+ private; def find_video
29
+ endpoint = "/realms/#{ @options[ :realm ] }/videos"
30
+
31
+ options = {
32
+ uuid: @options[ :video ]
33
+ }
34
+
35
+ operation( endpoint, options ).read.first
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,37 @@
1
+ module UnimatrixCLI
2
+ module Alchemist
3
+ module VideoEncoder
4
+ class CreateCommand < Command
5
+
6
+ option :realm, "The realm uuid", type: :string, required: true
7
+
8
+ synopsis "Create a new video_encoder"
9
+
10
+ def execute
11
+ video_encoder = create_video_encoder
12
+
13
+ if validate( video_encoder, 'Alchemist::VideoEncoder' )
14
+ write( message: "VideoEncoder uuid: #{ video_encoder.uuid }" )
15
+ else
16
+ write(
17
+ message: "Error creating video_encoder: #{ video_encoder.inspect }",
18
+ error: true
19
+ )
20
+ end
21
+ end
22
+
23
+ #----------------------------------------------------------------------------
24
+
25
+ private; def create_video_encoder
26
+ video_encoder = Unimatrix::Alchemist::VideoEncoder.new(
27
+ state: 'default'
28
+ )
29
+
30
+ operation(
31
+ "/realms/#{ @options[ :realm ] }/video_encoders"
32
+ ).write( 'video_encoders', video_encoder ).first rescue nil
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end