internal async Task <HttpOperationResponse <string> > StartJobInternalAsync( JobInfo info, CancellationToken cancellationToken = default ) { if (info == default) { throw new ArgumentNullException(nameof(info)); } if (!info.IsValid) { throw new ArgumentException("The parameter is not valid", nameof(info)); } var _path = "/api/2018-03-14/telemetry/job"; var _query = new QueryBuilder(); var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Post, _url); string _requestContent = null; if (info != default) { _requestContent = Client.Serialize(info); _req.Content = new StringContent(_requestContent, Encoding.UTF8) { Headers = { ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"), }, }; } if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); var _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { var ex = new RestApiException { Request = new HttpRequestMessageWrapper(_req, _requestContent), Response = new HttpResponseMessageWrapper(_res, _responseContent), }; HandleFailedStartJobRequest(ex); HandleFailedRequest(ex); Client.OnFailedRequest(ex); throw ex; } return(new HttpOperationResponse <string> { Request = _req, Response = _res, Body = Client.Deserialize <string>(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
partial void HandleFailedWarningRequest(RestApiException ex);
partial void HandleFailedLogRequest(RestApiException ex);
internal async Task <HttpOperationResponse <IImmutableList <DetailedVMScalingHistory> > > GetDetailedVMScalingHistoryInternalAsync( DateTimeOffset date, string scaleSet = default, CancellationToken cancellationToken = default ) { if (date == default) { throw new ArgumentNullException(nameof(date)); } var _path = "/api/2018-03-14/scalesets/detailedHistory"; var _query = new QueryBuilder(); if (date != default) { _query.Add("date", Client.Serialize(date)); } if (!string.IsNullOrEmpty(scaleSet)) { _query.Add("scaleSet", Client.Serialize(scaleSet)); } var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Get, _url); if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); var _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { var ex = new RestApiException { Request = new HttpRequestMessageWrapper(_req, null), Response = new HttpResponseMessageWrapper(_res, _responseContent), }; HandleFailedGetDetailedVMScalingHistoryRequest(ex); HandleFailedRequest(ex); Client.OnFailedRequest(ex); throw ex; } return(new HttpOperationResponse <IImmutableList <DetailedVMScalingHistory> > { Request = _req, Response = _res, Body = Client.Deserialize <IImmutableList <DetailedVMScalingHistory> >(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
partial void HandleFailedStartBuildWorkItemRequest(RestApiException ex);
partial void HandleFailedChangeStateRequest(RestApiException ex);
internal async Task <HttpOperationResponse <ViewConfiguration> > GetRepositoriesInternalAsync( string vcb = default, CancellationToken cancellationToken = default ) { var _path = "/api/2018-03-14/repo"; var _query = new QueryBuilder(); if (!string.IsNullOrEmpty(vcb)) { _query.Add("_vcb", Client.Serialize(vcb)); } var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Get, _url); if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); var _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { var ex = new RestApiException { Request = new HttpRequestMessageWrapper(_req, null), Response = new HttpResponseMessageWrapper(_res, _responseContent), }; HandleFailedGetRepositoriesRequest(ex); HandleFailedRequest(ex); Client.OnFailedRequest(ex); throw ex; } return(new HttpOperationResponse <ViewConfiguration> { Request = _req, Response = _res, Body = Client.Deserialize <ViewConfiguration>(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
partial void HandleFailedMultiSourceRequest(RestApiException ex);
partial void HandleFailedAnalysisSummaryRequest(RestApiException ex);
internal async Task <HttpOperationResponse <QueueInfo> > QueueInfoInternalAsync( string queueId, CancellationToken cancellationToken = default ) { if (string.IsNullOrEmpty(queueId)) { throw new ArgumentNullException(nameof(queueId)); } var _path = "/api/2018-03-14/info/queues/{queueId}"; _path = _path.Replace("{queueId}", Client.Serialize(queueId)); var _query = new QueryBuilder(); var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Get, _url); if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); string _responseContent; if (!_res.IsSuccessStatusCode) { _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); var ex = new RestApiException( new HttpRequestMessageWrapper(_req, null), new HttpResponseMessageWrapper(_res, _responseContent)); HandleFailedQueueInfoRequest(ex); HandleFailedRequest(ex); Client.OnFailedRequest(ex); throw ex; } _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); return(new HttpOperationResponse <QueueInfo> { Request = _req, Response = _res, Body = Client.Deserialize <QueueInfo>(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
partial void HandleFailedHistoryRequest(RestApiException ex);
partial void HandleFailedQueueInfoRequest(RestApiException ex);
internal async Task <HttpOperationResponse> LogInternalAsync( string id, string logUri, string xHelixJobToken, string format = default, string module = default, CancellationToken cancellationToken = default ) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException(nameof(id)); } if (string.IsNullOrEmpty(logUri)) { throw new ArgumentNullException(nameof(logUri)); } if (string.IsNullOrEmpty(xHelixJobToken)) { throw new ArgumentNullException(nameof(xHelixJobToken)); } var _path = "/api/2018-03-14/telemetry/job/workitem/{id}/log"; _path = _path.Replace("{id}", Client.Serialize(id)); var _query = new QueryBuilder(); if (!string.IsNullOrEmpty(logUri)) { _query.Add("logUri", Client.Serialize(logUri)); } if (!string.IsNullOrEmpty(format)) { _query.Add("format", Client.Serialize(format)); } if (!string.IsNullOrEmpty(module)) { _query.Add("module", Client.Serialize(module)); } var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Post, _url); if (!string.IsNullOrEmpty(xHelixJobToken)) { _req.Headers.Add("X-Helix-Job-Token", xHelixJobToken); } if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); var _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { var ex = new RestApiException { Request = new HttpRequestMessageWrapper(_req, null), Response = new HttpResponseMessageWrapper(_res, _responseContent), }; HandleFailedLogRequest(ex); HandleFailedRequest(ex); Client.OnFailedRequest(ex); throw ex; } return(new HttpOperationResponse { Request = _req, Response = _res, }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
internal async Task <HttpOperationResponse <string> > StartXUnitWorkItemInternalAsync( string friendlyName, string xHelixJobToken, CancellationToken cancellationToken = default ) { if (string.IsNullOrEmpty(friendlyName)) { throw new ArgumentNullException(nameof(friendlyName)); } if (string.IsNullOrEmpty(xHelixJobToken)) { throw new ArgumentNullException(nameof(xHelixJobToken)); } var _path = "/api/2018-03-14/telemetry/job/xunit"; var _query = new QueryBuilder(); if (!string.IsNullOrEmpty(friendlyName)) { _query.Add("friendlyName", Client.Serialize(friendlyName)); } var _uriBuilder = new UriBuilder(Client.BaseUri); _uriBuilder.Path = _uriBuilder.Path.TrimEnd('/') + _path; _uriBuilder.Query = _query.ToString(); var _url = _uriBuilder.Uri; HttpRequestMessage _req = null; HttpResponseMessage _res = null; try { _req = new HttpRequestMessage(HttpMethod.Post, _url); if (!string.IsNullOrEmpty(xHelixJobToken)) { _req.Headers.Add("X-Helix-Job-Token", xHelixJobToken); } if (Client.Credentials != null) { await Client.Credentials.ProcessHttpRequestAsync(_req, cancellationToken).ConfigureAwait(false); } _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false); var _responseContent = await _res.Content.ReadAsStringAsync().ConfigureAwait(false); if (!_res.IsSuccessStatusCode) { var ex = new RestApiException { Request = new HttpRequestMessageWrapper(_req, null), Response = new HttpResponseMessageWrapper(_res, _responseContent), }; HandleFailedStartXUnitWorkItemRequest(ex); HandleFailedRequest(ex); Client.OnFailedRequest(ex); throw ex; } return(new HttpOperationResponse <string> { Request = _req, Response = _res, Body = Client.Deserialize <string>(_responseContent), }); } catch (Exception) { _req?.Dispose(); _res?.Dispose(); throw; } }
partial void HandleFailedSetReasonRequest(RestApiException ex);
partial void HandleFailedBuildRequest(RestApiException ex);
partial void HandleFailedGetMachineStatusRequest(RestApiException ex);
partial void HandleFailedJobSummaryRequest(RestApiException ex);
partial void HandleFailedGetRepositoriesRequest(RestApiException ex);
partial void HandleFailedWorkItemSummaryRequest(RestApiException ex);
partial void HandleFailedGetDetailedVMScalingHistoryRequest(RestApiException ex);
partial void HandleFailedAnalysisDetailRequest(RestApiException ex);
internal void OnFailedRequest(RestApiException ex) { HandleFailedRequest(ex); }
partial void HandleFailedPropertiesRequest(RestApiException ex);
partial void HandleFailedFinishXUnitWorkItemRequest(RestApiException ex);
partial void HandleFailedInvestigation_ContinueRequest(RestApiException ex);
partial void HandleFailedErrorRequest(RestApiException ex);
partial void HandleFailedGetDetailsRequest(RestApiException ex);
partial void HandleFailedStartJobRequest(RestApiException ex);
partial void HandleFailedExtendExpirationRequest(RestApiException ex);