Skip to content

Commit

Permalink
Hso 4887 (#2)
Browse files Browse the repository at this point in the history
* updated default API version to 6.0. Updated data type to decimal.
* major version bump. updated Copyright year
* added CHANGELOG.md
  • Loading branch information
cholmes1111 authored and eelkram committed Oct 12, 2018
1 parent cae5a6e commit cdd68a1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This file is used to list changes made in each version of the Brocade VTM plugin

2.0.0
------
Version 18.2 of the Pulse Secure VTM has introduced version 6.0 of the API
- Updated default API version to 6.0.
- Changed data type of the APIVersion variable from double to decimal
3 changes: 3 additions & 0 deletions Org.BeyondComputing.NewRelic.Brocade.VTM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="CHANGELOG.md">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="config\newrelic.template.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("BeyondComputing")]
[assembly: AssemblyProduct("Org.BeyondComputing.NewRelic.Brocade.VTM")]
[assembly: AssemblyCopyright("Copyright © Mark Studer 2015")]
[assembly: AssemblyCopyright("Copyright © Mark Studer 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0")]
[assembly: AssemblyFileVersion("1.5.0")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
1 change: 1 addition & 0 deletions VTM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public VTM(string host, int port, string username, string password)
// HTTP Client settings
var credentials = new NetworkCredential(username, password);
var handler = new HttpClientHandler { Credentials = credentials };

var url = string.Format("https://{0}:{1}", host, port);

// Create HTTP Client for all future requests to API
Expand Down
8 changes: 4 additions & 4 deletions VTMAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public override string Version

private string name;
private VTM VTM;
private double APIVersion;
private decimal APIVersion;

// Create Dictionary of EpochProcessors to track rate over time for unknown number of items
private Dictionary<string,IProcessor> processors = new Dictionary<string,IProcessor>();

private Logger log = Logger.GetLogger(typeof(VTMAgent).Name);

public VTMAgent(string name, string host, int port, string username, string password, double APIVersion)
public VTMAgent(string name, string host, int port, string username, string password, decimal APIVersion)
{
this.name = name;
this.VTM = new VTM(host, port, username, password);
Expand Down Expand Up @@ -87,7 +87,7 @@ private void PollGlobal()
ReportMetric("global/sys_cpu_busy_percent", "percent", globalStats.sys_cpu_busy_percent);

// Get Global Status API v3.7+
if (APIVersion >= 3.7)
if (APIVersion >= 3.7m)
{
dynamic globalStatus = VTM.fetchVTMObject<dynamic>($"/api/tm/{APIVersion}/status/local_tm/state");

Expand All @@ -110,7 +110,7 @@ private void PollPool()
dynamic failedNodes = null;

// Get Global Status API v3.7+
if (APIVersion >= 3.7)
if (APIVersion >= 3.7m)
{
failedNodes = VTM.fetchVTMObject<dynamic>($"/api/tm/{APIVersion}/status/local_tm/state").state.failed_nodes;
}
Expand Down
4 changes: 2 additions & 2 deletions VTMAgentFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class VTMAgentFactory : AgentFactory
public override Agent CreateAgentWithConfiguration(IDictionary<string, object> properties)
{
// Set the default version of the API to use if not found in the config file
const double _APIVersion = 3.8;
const decimal _APIVersion = 6.0m;

string name = (string)properties["name"];
string host = (string)properties["host"];
int port = int.Parse((string)properties["port"]);
string username = (string)properties["username"];
string password = (string)properties["password"];
double APIVersion = properties.ContainsKey("api_version") ? (double)properties["api_version"] : _APIVersion;
decimal APIVersion = properties.ContainsKey("api_version") ? (decimal)properties["api_version"] : _APIVersion;

if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(host) || string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
{
Expand Down

0 comments on commit cdd68a1

Please sign in to comment.