コード例 #1
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     this.IncidentOperations = new IncidentOperations(this);
     this.BaseUri            = new Uri("http://incidentapi3oszghr6hgets.azurewebsites.net");
     SerializationSettings   = new JsonSerializerSettings
     {
         Formatting            = Formatting.Indented,
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
コード例 #2
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     this.IncidentOperations = new IncidentOperations(this);
     this.BaseUri            = new Uri(CloudConfigurationManager.GetSetting("INCIDENT_API_URL"));
     SerializationSettings   = new JsonSerializerSettings
     {
         Formatting            = Formatting.Indented,
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
コード例 #3
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='incidentId'>
 /// </param>
 /// <param name='newIncident'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> UpdateIncidentAsync(this IIncidentOperations operations, string incidentId, Incident newIncident, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UpdateIncidentWithHttpMessagesAsync(incidentId, newIncident, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the AlertsClient class.
 /// </summary>
 private AlertsClient()
     : base()
 {
     this._incidents         = new IncidentOperations(this);
     this._rules             = new RuleOperations(this);
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
コード例 #5
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> GetAllIncidentsAsync(this IIncidentOperations operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetAllIncidentsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #6
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IIncidentOperations.
 /// </param>
 /// <returns>
 /// The List incidents operation response.
 /// </returns>
 public static IncidentListResponse ListActiveForSubscription(this IIncidentOperations operations)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IIncidentOperations)s).ListActiveForSubscriptionAsync();
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
コード例 #7
0
 /// <param name='operations'>
 /// Reference to the IncidentAPI.IIncidentOperations.
 /// </param>
 /// <param name='incidentId'>
 /// Required.
 /// </param>
 /// <param name='newIncident'>
 /// Required.
 /// </param>
 public static string UpdateIncident(this IIncidentOperations operations, string incidentId, Incident newIncident)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IIncidentOperations)s).UpdateIncidentAsync(incidentId, newIncident);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
コード例 #8
0
 /// <param name='operations'>
 /// Reference to the IncidentAPI.IIncidentOperations.
 /// </param>
 public static int GetAllIncidentsCount(this IIncidentOperations operations)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IIncidentOperations)s).GetAllIncidentsCountAsync();
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
コード例 #9
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IIncidentOperations.
 /// </param>
 /// <param name='ruleId'>
 /// Required. The rule id.
 /// </param>
 /// <param name='isActive'>
 /// Required. A boolean to retrieve only active or resolved incidents.
 /// </param>
 /// <returns>
 /// The List incidents operation response.
 /// </returns>
 public static IncidentListResponse ListForRule(this IIncidentOperations operations, string ruleId, bool isActive)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IIncidentOperations)s).ListForRuleAsync(ruleId, isActive);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the AlertsClient class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 private AlertsClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._incidents  = new IncidentOperations(this);
     this._rules      = new RuleOperations(this);
     this._apiVersion = "2013-10-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
コード例 #11
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IIncidentOperations.
 /// </param>
 /// <param name='ruleId'>
 /// The rule id.
 /// </param>
 /// <param name='isActive'>
 /// A boolean to retrieve only active or resolved incidents.
 /// </param>
 /// <returns>
 /// The List incidents operation response.
 /// </returns>
 public static IncidentListResponse ListForRule(this IIncidentOperations operations, string ruleId, bool isActive)
 {
     try
     {
         return(operations.ListForRuleAsync(ruleId, isActive).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
コード例 #12
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IIncidentOperations.
 /// </param>
 /// <param name='incidentId'>
 /// The id of the incident to retrieve.
 /// </param>
 /// <returns>
 /// The Get Incident operation response.
 /// </returns>
 public static IncidentGetResponse Get(this IIncidentOperations operations, string incidentId)
 {
     try
     {
         return(operations.GetAsync(incidentId).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
コード例 #13
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IIncidentOperations.
 /// </param>
 /// <returns>
 /// The List incidents operation response.
 /// </returns>
 public static IncidentListResponse ListActiveForSubscription(this IIncidentOperations operations)
 {
     try
     {
         return(operations.ListActiveForSubscriptionAsync().Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the IncidentAPIClient class.
 /// </summary>
 /// <param name='rootHandler'>
 /// Optional. The http client handler used to handle http transport.
 /// </param>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public IncidentAPIClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
     : base(rootHandler, handlers)
 {
     this._incident = new IncidentOperations(this);
     this._baseUri  = new Uri("http://incidentapiylvdzuq2jlasa.azurewebsites.net");
 }
コード例 #15
0
 /// <summary>
 /// Initializes a new instance of the IncidentAPIClient class.
 /// </summary>
 public IncidentAPIClient()
     : base()
 {
     this._incident = new IncidentOperations(this);
     this._baseUri  = new Uri("http://incidentapiylvdzuq2jlasa.azurewebsites.net");
 }
コード例 #16
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static object SampleData(this IIncidentOperations operations)
 {
     return(Task.Factory.StartNew(s => ((IIncidentOperations)s).SampleDataAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
コード例 #17
0
        /// <param name='operations'>
        /// Reference to the IncidentAPI.IIncidentOperations.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <string> GetAllIncidentsAsync(this IIncidentOperations operations, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <string> result = await operations.GetAllIncidentsWithOperationResponseAsync(cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
コード例 #18
0
        /// <param name='operations'>
        /// Reference to the IncidentAPI.IIncidentOperations.
        /// </param>
        /// <param name='incidentId'>
        /// Required.
        /// </param>
        /// <param name='newIncident'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <string> UpdateIncidentAsync(this IIncidentOperations operations, string incidentId, Incident newIncident, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <string> result = await operations.UpdateIncidentWithOperationResponseAsync(incidentId, newIncident, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
コード例 #19
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='incidentId'>
 /// </param>
 public static object GetById(this IIncidentOperations operations, string incidentId)
 {
     return(Task.Factory.StartNew(s => ((IIncidentOperations)s).GetByIdAsync(incidentId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
コード例 #20
0
 /// <summary>
 /// Initializes a new instance of the IncidentAPIClient class.
 /// </summary>
 public IncidentAPIClient()
     : base()
 {
     this._incident = new IncidentOperations(this);
     this._baseUri  = new Uri(CloudConfigurationManager.GetSetting("INCIDENT_API_URL"));
 }
コード例 #21
0
 /// <summary>
 /// Initializes a new instance of the IncidentAPIClient class.
 /// </summary>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public IncidentAPIClient(params DelegatingHandler[] handlers)
     : base(handlers)
 {
     this._incident = new IncidentOperations(this);
     this._baseUri  = new Uri("http://incidentapilwcvaqj7qehhw.azurewebsites.net");
 }
コード例 #22
0
 /// <summary>
 /// Initializes a new instance of the IncidentAPIClient class.
 /// </summary>
 public IncidentAPIClient()
     : base()
 {
     this._incident = new IncidentOperations(this);
     this._baseUri  = new Uri("http://incidentapilwcvaqj7qehhw.azurewebsites.net");
 }
コード例 #23
0
 /// <summary>
 /// Initializes a new instance of the IncidentAPIClient class.
 /// </summary>
 /// <param name='rootHandler'>
 /// Optional. The http client handler used to handle http transport.
 /// </param>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public IncidentAPIClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
     : base(rootHandler, handlers)
 {
     this._incident = new IncidentOperations(this);
     this._baseUri  = new Uri(CloudConfigurationManager.GetSetting("INCIDENT_API_URL"));
 }
コード例 #24
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IIncidentOperations.
 /// </param>
 /// <param name='incidentId'>
 /// The id of the incident to retrieve.
 /// </param>
 /// <returns>
 /// The Get Incident operation response.
 /// </returns>
 public static Task <IncidentGetResponse> GetAsync(this IIncidentOperations operations, string incidentId)
 {
     return(operations.GetAsync(incidentId, CancellationToken.None));
 }
コード例 #25
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IIncidentOperations.
 /// </param>
 /// <returns>
 /// The List incidents operation response.
 /// </returns>
 public static Task <IncidentListResponse> ListActiveForSubscriptionAsync(this IIncidentOperations operations)
 {
     return(operations.ListActiveForSubscriptionAsync(CancellationToken.None));
 }
コード例 #26
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Alerts.IIncidentOperations.
 /// </param>
 /// <param name='ruleId'>
 /// The rule id.
 /// </param>
 /// <param name='isActive'>
 /// A boolean to retrieve only active or resolved incidents.
 /// </param>
 /// <returns>
 /// The List incidents operation response.
 /// </returns>
 public static Task <IncidentListResponse> ListForRuleAsync(this IIncidentOperations operations, string ruleId, bool isActive)
 {
     return(operations.ListForRuleAsync(ruleId, isActive, CancellationToken.None));
 }