Skip to content

Commit

Permalink
Merge pull request #15 from davetimmins/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
davetimmins authored Jan 25, 2018
2 parents db5d235 + 72a468c commit cc29fbf
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 8 deletions.
3 changes: 2 additions & 1 deletion NUGET-DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var autoTokenProviderLocationGateway = await PortalGateway.Create("https://sampl
Now you have access to the various operations supported by it. For example to call a query against a service

```c#
var query = new Query("Earthquakes/EarthquakesFromLastSevenDays/MapServer/0".AsEndpoint())
var query = new Query("Earthquakes/EarthquakesFromLastSevenDays/MapServer/0")
{
Where = "magnitude > 4.0"
};
Expand Down Expand Up @@ -63,6 +63,7 @@ REST admin operations:
- `ServiceReport` - admin operation to get the service report
- `StartService` - admin operation to start a service
- `StopService` - admin operation to stop a service
- `ServiceStatistics` - admin operation to get the statistics of a service

There are also methods to add / update and download attachments for a feature and you can extend this library by writing your own operations.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ REST admin operations:
- `ServiceReport` - admin operation to get the service report
- `StartService` - admin operation to start a service
- `StopService` - admin operation to stop a service
- `ServiceStatistics` - admin operation to get the statistics of a service

There are also methods to add / update and download attachments for a feature and you can extend this library by writing your own operations.

Expand Down
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var solution = "./Anywhere.ArcGIS.sln";

var version = "1.2.1";
var version = "1.3.0";
var versionSuffix = Environment.GetEnvironmentVariable("VERSION_SUFFIX");

//////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/Anywhere.ArcGIS/Anywhere.ArcGIS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<RepositoryUrl>https://github.com/davetimmins/Anywhere.ArcGIS</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>ArcGIS ArcGISServer ArcGISOnline Esri REST netstandard anywhere GIS Mapping Map Location GeoLocation OAuth</PackageTags>
<Version>1.2.1</Version>
<Version>1.3.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Anywhere.ArcGIS/ArcGISOnlineAppLoginOAuthProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/// </summary>
public class ArcGISOnlineAppLoginOAuthProvider : ITokenProvider, IDisposable
{
static HttpClient _httpClient;
HttpClient _httpClient;
protected readonly GenerateOAuthToken OAuthRequest;
Token _token;
readonly ILog _logger;
Expand Down
2 changes: 1 addition & 1 deletion src/Anywhere.ArcGIS/AttachmentWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Anywhere.ArcGIS
{
public class AttachmentWorker : IPortalGateway, IDisposable
{
static HttpClient _httpClient;
HttpClient _httpClient;
readonly ILog _logger;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Anywhere.ArcGIS/FederatedTokenProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/// </summary>
public class FederatedTokenProvider : ITokenProvider, IDisposable
{
static HttpClient _httpClient;
HttpClient _httpClient;
protected readonly GenerateFederatedToken TokenRequest;
Token _token;
readonly ILog _logger;
Expand Down
105 changes: 105 additions & 0 deletions src/Anywhere.ArcGIS/Operation/Admin/ServiceStatistics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using Anywhere.ArcGIS.Common;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Anywhere.ArcGIS.Operation.Admin
{
[DataContract]
public class ServiceStatistics : ArcGISServerOperation
{
public ServiceStatistics(ServiceDescription serviceDescription, Action beforeRequest = null, Action afterRequest = null)
: base(new ArcGISServerAdminEndpoint(string.Format(Operations.ServiceStatistics, serviceDescription.Name, serviceDescription.Type)), beforeRequest, afterRequest)
{ }
}

[DataContract]
public class ServiceStatisticsResponse : PortalResponse
{
[DataMember(Name = "summary")]
public StatisticsSummary Summary { get; set; }

[DataMember(Name = "perMachine")]
public List<MachineStatistics> PerMachine { get; set; }
}

[DataContract]
public class StatisticsSummary
{
[DataMember(Name = "folderName")]
public string FolderName { get; set; }

[DataMember(Name = "serviceName")]
public string ServiceName { get; set; }

[DataMember(Name = "type")]
public string ServiceType { get; set; }

[DataMember(Name = "startTime")]
public string startTime { get; set; }

[DataMember(Name = "max")]
public int Max { get; set; }

[DataMember(Name = "busy")]
public int Busy { get; set; }

[DataMember(Name = "free")]
public int Free { get; set; }

[DataMember(Name = "initializing")]
public int Initializing { get; set; }

[DataMember(Name = "notCreated")]
public int NotCreated { get; set; }

[DataMember(Name = "transactions")]
public int Transactions { get; set; }

[DataMember(Name = "totalBusyTime")]
public int TotalBusyTime { get; set; }

[DataMember(Name = "isStatisticsAvailable")]
public bool StatisticsAvailable { get; set; }
}

[DataContract]
public class MachineStatistics
{
[DataMember(Name = "folderName")]
public string FolderName { get; set; }

[DataMember(Name = "serviceName")]
public string ServiceName { get; set; }

[DataMember(Name = "type")]
public string ServiceType { get; set; }

[DataMember(Name = "machineName")]
public string MachineName { get; set; }

[DataMember(Name = "max")]
public int Max { get; set; }

[DataMember(Name = "busy")]
public int Busy { get; set; }

[DataMember(Name = "free")]
public int Free { get; set; }

[DataMember(Name = "initializing")]
public int Initializing { get; set; }

[DataMember(Name = "notCreated")]
public int NotCreated { get; set; }

[DataMember(Name = "transactions")]
public int Transactions { get; set; }

[DataMember(Name = "totalBusyTime")]
public int TotalBusyTime { get; set; }

[DataMember(Name = "isStatisticsAvailable")]
public bool StatisticsAvailable { get; set; }
}
}
1 change: 1 addition & 0 deletions src/Anywhere.ArcGIS/Operation/CommonParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public static class Operations
public const string StartService = "services/{0}.{1}/start";
public const string StopService = "services/{0}.{1}/stop";
public const string ServiceReport = "services/{0}/report";
public const string ServiceStatistics = "services/{0}.{1}/statistics";
public const string ArcGISOnlineSearch = "search";
public const string ServerInfoRoute = "rest/info";
public const string ServerHealthCheckRoute = "rest/info/healthCheck";
Expand Down
11 changes: 11 additions & 0 deletions src/Anywhere.ArcGIS/PortalGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,17 @@ public PortalGateway(string rootUrl, string username, string password, ISerializ
return Post<StartStopServiceResponse, StopService>(new StopService(serviceDescription), ct);
}

/// <summary>
/// Provides a view into the life cycle of all instances of the service on all server machines within the cluster.
/// </summary>
/// <param name="serviceDescription">Service description usually generated from a previous call to DescribeSite</param>
/// <param name="ct">Optional cancellation token to cancel pending request</param>
/// <returns>The statistics for the service</returns>
public virtual Task<ServiceStatisticsResponse> ServiceStatistics(ServiceDescription serviceDescription, CancellationToken ct = default(CancellationToken))
{
return Get<ServiceStatisticsResponse, ServiceStatistics>(new ServiceStatistics(serviceDescription), ct);
}

/// <summary>
/// Call the reverse geocode operation.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Anywhere.ArcGIS/PortalGatewayBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class PortalGatewayBase : IPortalGateway, IDisposable
internal const string AGOPortalUrl = "https://www.arcgis.com/sharing/rest/";
protected const string GeometryServerUrlRelative = "/Utilities/Geometry/GeometryServer";
protected const string GeometryServerUrl = "https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer";
static HttpClient _httpClient;
HttpClient _httpClient;
protected IEndpoint GeometryServiceIEndpoint;
readonly ILog _logger;

Expand Down
2 changes: 1 addition & 1 deletion src/Anywhere.ArcGIS/TokenProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// </summary>
public class TokenProvider : ITokenProvider, IDisposable
{
static HttpClient _httpClient;
HttpClient _httpClient;
protected GenerateToken TokenRequest;
Token _token;
PublicKeyResponse _publicKey;
Expand Down

0 comments on commit cc29fbf

Please sign in to comment.