/// <summary> /// Gets a monitoring zone by ID. /// </summary> /// <param name="service">The monitoring service instance.</param> /// <param name="monitoringZoneId">The monitoring zone ID. This is obtained from <see cref="MonitoringZone.Id">MonitoringZone.Id</see>.</param> /// <returns>A <see cref="MonitoringZone"/> object describing the monitoring zone.</returns> /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException">If <paramref name="monitoringZoneId"/> is <see langword="null"/>.</exception> /// <exception cref="WebException">If the REST request does not return successfully.</exception> /// <seealso href="http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/service-monitoring-zones.html#service-monitoring-zones-get">Get Monitoring Zone (Rackspace Cloud Monitoring Developer Guide - API v1.0)</seealso> public static MonitoringZone GetMonitoringZone(this IMonitoringService service, MonitoringZoneId monitoringZoneId) { if (service == null) throw new ArgumentNullException("service"); try { return service.GetMonitoringZoneAsync(monitoringZoneId, CancellationToken.None).Result; } catch (AggregateException ex) { ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) throw innerExceptions[0]; throw; } }
/// <summary> /// Perform a traceroute operation from a monitoring zone to a particular target. /// </summary> /// <param name="service">The monitoring service instance.</param> /// <param name="monitoringZoneId">The monitoring zone ID. This is obtained from <see cref="MonitoringZone.Id">MonitoringZone.Id</see>.</param> /// <param name="configuration">A <see cref="TraceRouteConfiguration"/> object containing the traceroute parameters.</param> /// <returns>A <see cref="TraceRoute"/> object describing the results of the traceroute operation.</returns> /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"> /// If <paramref name="monitoringZoneId"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="configuration"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="WebException">If the REST request does not return successfully.</exception> /// <seealso href="http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/service-monitoring-zones.html#service-monitoring-zones-traceroute">Perform a "traceroute" from a Monitoring Zone (Rackspace Cloud Monitoring Developer Guide - API v1.0)</seealso> public static TraceRoute PerformTraceRouteFromMonitoringZone(this IMonitoringService service, MonitoringZoneId monitoringZoneId, TraceRouteConfiguration configuration) { if (service == null) throw new ArgumentNullException("service"); try { return service.PerformTraceRouteFromMonitoringZoneAsync(monitoringZoneId, configuration, CancellationToken.None).Result; } catch (AggregateException ex) { ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) throw innerExceptions[0]; throw; } }
/// <summary> /// Gets a collection of monitoring zones. /// </summary> /// <param name="service">The monitoring service instance.</param> /// <param name="marker">A marker identifying the next page of results. This parameter is used for <see href="http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/api-paginated-collections.html">pagination</see>, and is obtained from <see cref="ReadOnlyCollectionPage{T, TMarker}.NextMarker"/>. If the value is <see langword="null"/>, the list starts at the beginning.</param> /// <param name="limit">The maximum number of items to include in a single page of results. This parameter is used for <see href="http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/api-paginated-collections.html">pagination</see>. If the value is <see langword="null"/>, a provider-specific default value is used.</param> /// <returns> /// A <see cref="ReadOnlyCollectionPage{T, TMarker}"/> object containing the page /// of results and its associated pagination metadata. /// </returns> /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentOutOfRangeException">If <paramref name="limit"/> is less than or equal to 0.</exception> /// <exception cref="WebException">If the REST request does not return successfully.</exception> /// <seealso href="http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/service-monitoring-zones.html#service-monitoring-zones-list">List Monitoring Zones (Rackspace Cloud Monitoring Developer Guide - API v1.0)</seealso> /// <seealso href="http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/api-paginated-collections.html">Paginated Collections (Rackspace Cloud Monitoring Developer Guide - API v1.0)</seealso> public static ReadOnlyCollectionPage<MonitoringZone, MonitoringZoneId> ListMonitoringZones(this IMonitoringService service, MonitoringZoneId marker, int? limit) { if (service == null) throw new ArgumentNullException("service"); try { return service.ListMonitoringZonesAsync(marker, limit, CancellationToken.None).Result; } catch (AggregateException ex) { ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) throw innerExceptions[0]; throw; } }