appdynamics-ruby 0.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/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +38 -0
- data/Rakefile +6 -0
- data/appdynamics-ruby.gemspec +27 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/appdynamics.rb +10 -0
- data/lib/appdynamics/application.rb +88 -0
- data/lib/appdynamics/controller.rb +123 -0
- data/lib/appdynamics/metric.rb +103 -0
- data/lib/appdynamics/node.rb +32 -0
- data/lib/appdynamics/tier.rb +31 -0
- data/lib/appdynamics/version.rb +3 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d99057f382b009ec469e193d39d5f3fdaaa61b22
|
4
|
+
data.tar.gz: d15676c94752d090bb2585fb74d60ea554160ce1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e1405fad5c48267a12a0414016278029cbe703cc34bae47b8f8091c041873bbe84193c130d56951ff3c48156e29d25105dab5b41fdc0c3a2ab86331d296558c
|
7
|
+
data.tar.gz: 07721ef2c451bfaf2093b046eb9f293da83d0ed7ce6755e318a5b405d402ad7074b76fd26d4d4d7290433409bf83cd1f56f68540897b502f21fa9732afe11947
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at chris.usick@nfl.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Chris Usick
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Appdynamics::Ruby
|
2
|
+
Lightweight library for working with Appdynamics APIs. Originally forked from [https://github.com/blitz-io/appdynamics-ruby](https://github.com/blitz-io/appdynamics-ruby)
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'appdynamics-ruby'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install appdynamics-ruby
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
TODO: Write usage instructions here
|
23
|
+
|
24
|
+
## Development
|
25
|
+
|
26
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
27
|
+
|
28
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/appdynamics-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
33
|
+
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
38
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "appdynamics-ruby"
|
7
|
+
spec.version = File.read 'VERSION'
|
8
|
+
spec.authors = ["Chris Usick"]
|
9
|
+
spec.email = ["chris.usick@nfl.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Write a short summary, because Rubygems requires one.}
|
12
|
+
spec.description = %q{Write a longer description or delete this line.}
|
13
|
+
spec.homepage = "http://example.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "httparty"
|
22
|
+
spec.add_development_dependency "vcr"
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
+
spec.add_development_dependency 'version_bumper', '~> 0.3.0'
|
27
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "appdynamics/ruby"
|
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
data/lib/appdynamics.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
module Appdynamics
|
2
|
+
class Application
|
3
|
+
attr_reader :controller, :application_id, :application_name
|
4
|
+
|
5
|
+
def initialize controller, application_id, application_name
|
6
|
+
@controller = controller
|
7
|
+
@application_name = application_name
|
8
|
+
@application_id = application_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def name
|
12
|
+
@application_name
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_hash
|
16
|
+
hsh = {
|
17
|
+
application_name: @application_name,
|
18
|
+
application_id: @application_id
|
19
|
+
}
|
20
|
+
hsh.merge!({nodes: @nodes.map{|node| node.to_hash}}) if @nodes
|
21
|
+
hsh.merge!({metrics: @metrics.map{|node| node.to_hash}}) if @metrics
|
22
|
+
hsh.merge!({tiers: @tiers.map{|node| node.to_hash}}) if @tiers
|
23
|
+
hsh
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.from_hash hsh, controller
|
27
|
+
application = Application.new controller, hsh['application_id'], hsh['application_name']
|
28
|
+
application.metrics = hsh['metrics'] if hsh['metrics']
|
29
|
+
application.tiers = hsh['tiers'] if hsh['tiers']
|
30
|
+
application.nodes = hsh['nodes'] if hsh['nodes']
|
31
|
+
application
|
32
|
+
end
|
33
|
+
|
34
|
+
def nodes
|
35
|
+
@nodes ||= controller.nodes_for self
|
36
|
+
end
|
37
|
+
|
38
|
+
def nodes= nodes
|
39
|
+
@nodes = nodes.map{|node|
|
40
|
+
Node.from_hash node, @controller, self
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def tiers
|
45
|
+
@tiers ||= controller.tiers_for self
|
46
|
+
end
|
47
|
+
|
48
|
+
def tiers= tiers
|
49
|
+
@tiers = tiers.map{|tier|
|
50
|
+
Tier.from_hash tier, @controller, self
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def metrics
|
55
|
+
@metrics ||= controller.metrics_for self
|
56
|
+
end
|
57
|
+
|
58
|
+
def metrics= metrics
|
59
|
+
@metrics = metrics.map{|metric|
|
60
|
+
Metric.from_hash metric, @controller, self
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
def find_metric_by_name nam
|
65
|
+
metric = nil
|
66
|
+
metrics.each do |m|
|
67
|
+
metric = m.find_by_name nam
|
68
|
+
break unless metric.nil?
|
69
|
+
end
|
70
|
+
metric
|
71
|
+
end
|
72
|
+
|
73
|
+
def find_metric_by_path path
|
74
|
+
metric = metrics.select{|metric| metric.name == path.first}.first
|
75
|
+
return nil unless metric
|
76
|
+
path.shift
|
77
|
+
path.each do |metric_name|
|
78
|
+
metric = metric.child_by_name metric_name
|
79
|
+
return nil unless metric
|
80
|
+
end
|
81
|
+
metric
|
82
|
+
end
|
83
|
+
|
84
|
+
def relative_route *_
|
85
|
+
"applications/#{application_id}"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'uri'
|
2
|
+
module Appdynamics
|
3
|
+
class Controller
|
4
|
+
include HTTParty
|
5
|
+
attr_reader :host_name, :account_name, :user_name, :password, :application_name, :application_id,
|
6
|
+
:base_uri, :applications, :nodes, :tiers
|
7
|
+
|
8
|
+
def initialize host_name, account_name, user_name, password
|
9
|
+
@host_name = host_name
|
10
|
+
@account_name = account_name
|
11
|
+
@user_name = user_name
|
12
|
+
@password = password
|
13
|
+
@base_uri = "http://#{host_name}/controller/rest"
|
14
|
+
@auth = {username: "#{user_name}@#{account_name}", password: password}
|
15
|
+
end
|
16
|
+
|
17
|
+
def serialize
|
18
|
+
YAML.dump self
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.deserialize datum
|
22
|
+
YAML.load datum
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_hash
|
26
|
+
hsh = {
|
27
|
+
host_name: @host_name,
|
28
|
+
account_name: @account_name,
|
29
|
+
user_name: @user_name,
|
30
|
+
password: @password
|
31
|
+
}
|
32
|
+
hsh.merge!({applications: @applications.map{|app| app.to_hash}}) if @applications
|
33
|
+
hsh
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.from_hash hsh
|
37
|
+
controller = Controller.new hsh['host_name'], hsh['account_name'], hsh['user_name'], hsh['password']
|
38
|
+
controller.applications = hsh['applications']
|
39
|
+
controller
|
40
|
+
end
|
41
|
+
|
42
|
+
def applications
|
43
|
+
return @applications unless @applications.nil?
|
44
|
+
result = []
|
45
|
+
begin
|
46
|
+
result = self.class.get("#{@base_uri}/applications", options)
|
47
|
+
rescue SocketError => ee
|
48
|
+
raise Exception.new "Bad host name, #{ee}"
|
49
|
+
end
|
50
|
+
|
51
|
+
raise Exception.new "HTTP Error: #{result.response.code}" unless result.response.code == "200"
|
52
|
+
|
53
|
+
@applications ||= result.map{|res|
|
54
|
+
Application.new self, res["id"], res["name"]
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def applications= applications
|
59
|
+
@applications = applications.map{|application|
|
60
|
+
Application.from_hash application, self
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
def reset_cache!
|
65
|
+
@nodes = @tiers = @applications = nil
|
66
|
+
end
|
67
|
+
|
68
|
+
def get path, additional_options = {}
|
69
|
+
result = self.class.get(URI.escape(path), options(additional_options))
|
70
|
+
raise Exception.new "HTTP Error: #{result.response.code}" unless result.response.code == "200"
|
71
|
+
result
|
72
|
+
end
|
73
|
+
|
74
|
+
def nodes_for application
|
75
|
+
path = "#{base_uri}/#{application.relative_route}/nodes"
|
76
|
+
result = get path
|
77
|
+
result.map{|res|
|
78
|
+
Node.new self, application, res
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
def tiers_for application
|
83
|
+
path = "#{base_uri}/#{application.relative_route}/tiers"
|
84
|
+
result = get path
|
85
|
+
result.map{|res|
|
86
|
+
Tier.new self, application, res
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
def metrics_for obj
|
91
|
+
path = "#{base_uri}/#{obj.relative_route}"
|
92
|
+
path += "/metrics" if obj.class == Application
|
93
|
+
result = get path
|
94
|
+
result.map{|res|
|
95
|
+
Metric.new self, obj, res
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
def metric_data_for metric, start_time, end_time, rollup = false
|
100
|
+
path = "#{base_uri}/#{metric.relative_route(true)}"
|
101
|
+
start_time = Time.parse start_time unless start_time.class == Time
|
102
|
+
end_time = Time.parse end_time unless end_time.class == Time
|
103
|
+
path = "#{base_uri}/#{metric.relative_route(true)}"
|
104
|
+
additional_options = {
|
105
|
+
'time-range-type' => "BETWEEN_TIMES",
|
106
|
+
'start-time' => start_time.to_i * 1000,
|
107
|
+
'end-time' => end_time.to_i * 1000,
|
108
|
+
'rollup' => rollup
|
109
|
+
}
|
110
|
+
result = get path, options({query: additional_options})
|
111
|
+
result
|
112
|
+
end
|
113
|
+
|
114
|
+
protected
|
115
|
+
def options additional_options = {}
|
116
|
+
base_options = {basic_auth: @auth}.merge additional_options
|
117
|
+
base_options[:query] ||= {}
|
118
|
+
base_options[:query][:output] ||= 'JSON'
|
119
|
+
base_options[:query][:rollup] ||= false
|
120
|
+
base_options
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
module Appdynamics
|
2
|
+
class Metric
|
3
|
+
attr_accessor :type, :name
|
4
|
+
attr_reader :controller, :parent
|
5
|
+
|
6
|
+
def initialize controller, parent, attrs
|
7
|
+
@controller = controller
|
8
|
+
@parent = parent
|
9
|
+
attrs.keys.each do |key|
|
10
|
+
self.send "#{key}=", attrs[key]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
hsh = {
|
16
|
+
name: @name,
|
17
|
+
type: @type
|
18
|
+
}
|
19
|
+
hsh.merge!({path: path})
|
20
|
+
hsh.merge!({metrics: @metrics.map{|metric| metric.to_hash}}) if @metrics
|
21
|
+
hsh
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.from_hash hsh, controller, parent
|
25
|
+
Metric.new controller, parent, hsh
|
26
|
+
end
|
27
|
+
|
28
|
+
def path
|
29
|
+
return @path unless @path.nil?
|
30
|
+
ar = [self.name]
|
31
|
+
node = self
|
32
|
+
while node.parent.class == Appdynamics::Metric && node = node.parent
|
33
|
+
ar.unshift node.name
|
34
|
+
end
|
35
|
+
@path = ar
|
36
|
+
@path
|
37
|
+
end
|
38
|
+
|
39
|
+
def path= pat
|
40
|
+
@path = pat
|
41
|
+
end
|
42
|
+
|
43
|
+
def metrics= metrics
|
44
|
+
@metrics = metrics.map {|metric|
|
45
|
+
Metric.new @controller, self, metric
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def find_by_name nam
|
50
|
+
return self if name == nam
|
51
|
+
metric = nil
|
52
|
+
metrics.each do |m|
|
53
|
+
metric = m.find_by_name nam
|
54
|
+
break unless metric.nil?
|
55
|
+
end
|
56
|
+
metric
|
57
|
+
end
|
58
|
+
|
59
|
+
def child_by_name nam
|
60
|
+
metrics.select{|metric|
|
61
|
+
metric.name == nam
|
62
|
+
}.first
|
63
|
+
end
|
64
|
+
|
65
|
+
def metrics
|
66
|
+
@metrics ||= controller.metrics_for self
|
67
|
+
end
|
68
|
+
|
69
|
+
def build_metrics_tree! tab_level = 0
|
70
|
+
return if leaf?
|
71
|
+
puts "#{' ' * tab_level}Building tree for #{name} (#{type})"
|
72
|
+
metrics.each do |m|
|
73
|
+
m.build_metrics_tree!(tab_level + 1)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def relative_route data_requested = false
|
78
|
+
rel_path = "#{parent.relative_route(data_requested)}"
|
79
|
+
case parent
|
80
|
+
when Appdynamics::Metric
|
81
|
+
rel_path += "|#{name}"
|
82
|
+
when Appdynamics::Application
|
83
|
+
if data_requested
|
84
|
+
rel_path += "/metric-data"
|
85
|
+
else
|
86
|
+
rel_path += "/metrics/"
|
87
|
+
end
|
88
|
+
rel_path += "?metric-path=#{name}"
|
89
|
+
end
|
90
|
+
rel_path
|
91
|
+
end
|
92
|
+
|
93
|
+
def data start_time, end_time, rollup = false
|
94
|
+
raw_data = controller.metric_data_for(self, start_time, end_time, rollup).first
|
95
|
+
raw_data["metricValues"]
|
96
|
+
end
|
97
|
+
|
98
|
+
protected
|
99
|
+
def leaf?
|
100
|
+
type == 'leaf'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Appdynamics
|
2
|
+
class Node
|
3
|
+
|
4
|
+
ATTRIBUTES = [:id, :name, :type, :tierId, :tierName, :machineId, :machineName, :machineOSType, :ipAddresses,
|
5
|
+
:machineAgentPresent, :machineAgentVersion, :appAgentPresent, :appAgentVersion, :nodeUniqueLocalId]
|
6
|
+
|
7
|
+
attr_accessor *ATTRIBUTES
|
8
|
+
|
9
|
+
def initialize controller, application, attrs
|
10
|
+
@controller = controller
|
11
|
+
@application = application
|
12
|
+
attrs.keys.each do |key|
|
13
|
+
self.send "#{key}=", attrs[key]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_hash
|
18
|
+
ATTRIBUTES.inject({}){|hsh, attr|
|
19
|
+
hsh[attr] = self.send(attr)
|
20
|
+
hsh
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.from_hash hsh, controller, application
|
25
|
+
Node.new controller, application, hsh
|
26
|
+
end
|
27
|
+
|
28
|
+
def relative_route *_
|
29
|
+
"#{application.relative_route}/nodes/#{id}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Appdynamics
|
2
|
+
class Tier
|
3
|
+
ATTRIBUTES = [:id, :agentType, :description, :name, :numberOfNodes, :type]
|
4
|
+
|
5
|
+
attr_accessor *ATTRIBUTES
|
6
|
+
attr_accessor :application, :controller
|
7
|
+
|
8
|
+
def initialize controller, application, attrs
|
9
|
+
@application = application
|
10
|
+
@controller = controller
|
11
|
+
attrs.keys.each do |key|
|
12
|
+
self.send "#{key}=", attrs[key]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_hash
|
17
|
+
ATTRIBUTES.inject({}){|hsh, attr|
|
18
|
+
hsh[attr] = self.send(attr)
|
19
|
+
hsh
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.from_hash hsh, controller, application
|
24
|
+
Tier.new controller, application, hsh
|
25
|
+
end
|
26
|
+
|
27
|
+
def relative_route *_
|
28
|
+
"#{application.relative_route}/tiers/#{id}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: appdynamics-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Usick
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: vcr
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: version_bumper
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.3.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.3.0
|
97
|
+
description: Write a longer description or delete this line.
|
98
|
+
email:
|
99
|
+
- chris.usick@nfl.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- appdynamics-ruby.gemspec
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- lib/appdynamics.rb
|
116
|
+
- lib/appdynamics/application.rb
|
117
|
+
- lib/appdynamics/controller.rb
|
118
|
+
- lib/appdynamics/metric.rb
|
119
|
+
- lib/appdynamics/node.rb
|
120
|
+
- lib/appdynamics/tier.rb
|
121
|
+
- lib/appdynamics/version.rb
|
122
|
+
homepage: http://example.com
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.4.5.1
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Write a short summary, because Rubygems requires one.
|
146
|
+
test_files: []
|