awx 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/awx +5 -0
- data/lib/awx.rb +124 -0
- data/lib/version.rb +1 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f45efb7c22579d93855b4b979bd61d48b19c5d6d
|
4
|
+
data.tar.gz: 6f56e452dc4298b9cd1bafe150691325df84e745
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eabe941e7349e2003decadcd90258029c0ed7250c9f3f91305a85094387777217b732f4c5bfecc3214b16b26f8724a1ce7ac3163c418bcdb664bf80142f76313
|
7
|
+
data.tar.gz: 2101dcd95ea79eb57e6c58da6f6f7b10dba7bb1233247e2b2b2f6fe421af4ad75602c02d6608da9b4d8683dedda9fbefbe4b79c98c6456f73e24935e97c0df88
|
data/bin/awx
ADDED
data/lib/awx.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'columnist'
|
2
|
+
require 'convoy'
|
3
|
+
require 'yaml'
|
4
|
+
require 'blufin-lib'
|
5
|
+
|
6
|
+
require_relative 'version'
|
7
|
+
require 'core/config_unique'
|
8
|
+
require 'core/aws/aws_config'
|
9
|
+
require 'core/aws/aws_credentials'
|
10
|
+
|
11
|
+
Dir["#{File.dirname(__FILE__)}/core/**/*.rb"].each { |file| load(file) unless file =~ /\/(config_unique|aws_config|aws_credentials)\.rb\z/ }
|
12
|
+
Dir["#{File.dirname(__FILE__)}/routes/**/*.rb"].each { |file| load(file) }
|
13
|
+
|
14
|
+
module App
|
15
|
+
|
16
|
+
def self.execute
|
17
|
+
|
18
|
+
begin
|
19
|
+
|
20
|
+
unless !ARGV.any? || ARGV[0] == 'setup' || ARGV[0] == 'x'
|
21
|
+
App::Config.initialize
|
22
|
+
end
|
23
|
+
|
24
|
+
Convoy::App.create do |my|
|
25
|
+
|
26
|
+
# COLOR OF TITLE TEXT
|
27
|
+
title_color = 255
|
28
|
+
|
29
|
+
my.version VERSION
|
30
|
+
my.summary "\x1B[38;5;198mMY-CLI\x1B[0m \x1B[38;5;240m\xe2\x80\x94 BETA\x1B[0m"
|
31
|
+
my.description "\x1B[38;5;#{title_color}mA command line utility for myself.\nDesigned to work from anywhere on my mac.\n\nUse #{Blufin::Terminal::format_command('my')}\x1B[38;5;#{title_color}m to run.\x1B[0m"
|
32
|
+
|
33
|
+
# Checks whether a AWS 'blufin-cli' profile exists within ~/.aws ...
|
34
|
+
unless App::AWSConfig::get_credentials(App::AWSConfig::AWS_PROFILE_ALBERT_CLI).nil?
|
35
|
+
# a - AWS
|
36
|
+
my.command :aws, :aliases => [:a] do |aws|
|
37
|
+
aws.summary 'AWS related functionality'
|
38
|
+
# cf - AWS CLOUD FORMATION
|
39
|
+
aws.command :cloudformation, :aliases => [:c] do |aws_cloudformation|
|
40
|
+
aws_cloudformation.summary 'Create, list and delete cloud-formation stacks'
|
41
|
+
# c - AWS CLOUD FORMATION CREATE
|
42
|
+
aws_cloudformation.command :create, :aliases => [:c] do |aws_cloudformation_create|
|
43
|
+
aws_cloudformation_create.summary 'Create stack'
|
44
|
+
aws_cloudformation_create.options do |opts|
|
45
|
+
opts.opt :test, 'Run through test-template.', :short => '-t', :long => '--test', :type => :boolean
|
46
|
+
end
|
47
|
+
aws_cloudformation_create.action do |opts, args|
|
48
|
+
AppCommand::AWSCloudFormationCreate.new(opts, args).execute
|
49
|
+
end
|
50
|
+
end
|
51
|
+
# d - AWS CLOUD FORMATION DETECT-DRIFT
|
52
|
+
aws_cloudformation.command :detect_drift, :aliases => [:d] do |aws_cloudformation_detect_drift|
|
53
|
+
aws_cloudformation_detect_drift.summary 'Detect drift (for stack)'
|
54
|
+
aws_cloudformation_detect_drift.action do |opts, args|
|
55
|
+
AppCommand::AWSCloudFormationDetectDrift.new(opts, args).execute
|
56
|
+
end
|
57
|
+
end
|
58
|
+
# D - AWS CLOUD FORMATION DELETE
|
59
|
+
aws_cloudformation.command :delete, :aliases => [:D] do |aws_cloudformation_delete|
|
60
|
+
aws_cloudformation_delete.summary 'Delete stack'
|
61
|
+
aws_cloudformation_delete.action do |opts, args|
|
62
|
+
AppCommand::AWSCloudFormationDelete.new(opts, args).execute
|
63
|
+
end
|
64
|
+
end
|
65
|
+
aws_cloudformation.action do
|
66
|
+
system("#{ConfigUnique::GEM_NAME} a c -h")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
# l - AWS LIST
|
70
|
+
aws.command :list, :aliases => [:l] do |aws_list|
|
71
|
+
aws_list.summary 'List AWS instances/resources'
|
72
|
+
aws_list.options do |opts|
|
73
|
+
opts.opt :json, 'Return data as JSON', :short => '-j', :long => '--json', :type => :boolean
|
74
|
+
opts.opt :json_prompt, 'Return data as JSON (for Terminal::prompt)', :short => '-J', :long => '--json-prompt', :type => :boolean
|
75
|
+
opts.opt :yaml, 'Return data as Yaml', :short => '-y', :long => '--yaml', :type => :boolean
|
76
|
+
opts.opt :resource, "Specify a resource. For all resources type: #{Blufin::Terminal::format_command('all')}", :short => '-r', :long => '--resource', :type => :string
|
77
|
+
opts.opt :verbose, 'Output the original response from AWS (with all fields).', :short => '-v', :long => '--verbose', :type => :boolean
|
78
|
+
opts.opt :metadata, 'Output the YML definition file metadata.', :short => '-m', :long => '--metadata', :type => :boolean
|
79
|
+
# TODO - Implement Region + Project filtering (possibly more).
|
80
|
+
opts.opt :region, 'Specify a region', :short => '-R', :long => '--region', :type => :string
|
81
|
+
opts.opt :project, 'Specify a project (Tag: project)', :short => '-p', :long => '--project', :type => :string
|
82
|
+
end
|
83
|
+
aws_list.action do |opts, args|
|
84
|
+
AppCommand::AWSList.new(opts, args).execute
|
85
|
+
end
|
86
|
+
end
|
87
|
+
# L - AWS LAMBDA
|
88
|
+
aws.command :lambda, :aliases => [:L] do |aws_lambda|
|
89
|
+
aws_lambda.summary 'Quickly invoke a Lambda function locally (without the need to deploy)'
|
90
|
+
aws_lambda.options do |opts|
|
91
|
+
opts.opt :headers_file, 'The path to a JSON containing HTTP Headers you want to send', :short => '-H', :long => '--headers-file', :type => :string
|
92
|
+
opts.opt :payload_file, 'The path to a JSON payload you want to send', :short => '-p', :long => '--pay-load-file', :type => :string
|
93
|
+
end
|
94
|
+
aws_lambda.action do |opts, args|
|
95
|
+
AppCommand::AWSLambda.new(opts, args).execute
|
96
|
+
end
|
97
|
+
end
|
98
|
+
aws.action do |opts, args|
|
99
|
+
system("#{ConfigUnique::GEM_NAME} a -h")
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# x - SETUP
|
105
|
+
my.command :setup, :aliases => [:x] do |setup|
|
106
|
+
setup.summary 'Setup your configuration file'
|
107
|
+
setup.action do |opts, args|
|
108
|
+
AppCommand::Setup.new(opts, args).execute
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# MY (DEFAULT)
|
113
|
+
my.action do
|
114
|
+
system("#{ConfigUnique::GEM_NAME} -h")
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
rescue RuntimeError => e
|
120
|
+
|
121
|
+
Blufin::Terminal::print_exception(e);
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
data/lib/version.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
VERSION = '0.1.0'
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: awx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Albert Rannetsperger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-07-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: columnist
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: convoy
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: blufin-lib
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.4.0
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 1.4.0
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - '='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 1.4.0
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.4.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: parseconfig
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.0.8
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.0.8
|
75
|
+
description: An abstraction layer built around the AWS-cli (written in Ruby).
|
76
|
+
email: alb3rtuk@me.com
|
77
|
+
executables:
|
78
|
+
- awx
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- bin/awx
|
83
|
+
- lib/awx.rb
|
84
|
+
- lib/version.rb
|
85
|
+
homepage: http://rubygems.org/gems/awx
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '2.0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.5.1
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: An AWS-cli wrapper.
|
109
|
+
test_files: []
|