| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using System.Threading; |
| | 12 | | using System.Threading.Tasks; |
| | 13 | | using Azure; |
| | 14 | | using Azure.Analytics.Synapse.Artifacts.Models; |
| | 15 | | using Azure.Core; |
| | 16 | | using Azure.Core.Pipeline; |
| | 17 | |
|
| | 18 | | namespace Azure.Analytics.Synapse.Artifacts |
| | 19 | | { |
| | 20 | | internal partial class PipelineRestClient |
| | 21 | | { |
| | 22 | | private string endpoint; |
| | 23 | | private string apiVersion; |
| | 24 | | private ClientDiagnostics _clientDiagnostics; |
| | 25 | | private HttpPipeline _pipeline; |
| | 26 | |
|
| | 27 | | /// <summary> Initializes a new instance of PipelineRestClient. </summary> |
| | 28 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 29 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 30 | | /// <param name="endpoint"> The workspace development endpoint, for example https://myworkspace.dev.azuresynapse |
| | 31 | | /// <param name="apiVersion"> Api Version. </param> |
| | 32 | | /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="apiVersion"/> is nul |
| 8 | 33 | | public PipelineRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string ap |
| | 34 | | { |
| 8 | 35 | | if (endpoint == null) |
| | 36 | | { |
| 0 | 37 | | throw new ArgumentNullException(nameof(endpoint)); |
| | 38 | | } |
| 8 | 39 | | if (apiVersion == null) |
| | 40 | | { |
| 0 | 41 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 42 | | } |
| | 43 | |
|
| 8 | 44 | | this.endpoint = endpoint; |
| 8 | 45 | | this.apiVersion = apiVersion; |
| 8 | 46 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 47 | | _pipeline = pipeline; |
| 8 | 48 | | } |
| | 49 | |
|
| | 50 | | internal HttpMessage CreateGetPipelinesByWorkspaceRequest() |
| | 51 | | { |
| 4 | 52 | | var message = _pipeline.CreateMessage(); |
| 4 | 53 | | var request = message.Request; |
| 4 | 54 | | request.Method = RequestMethod.Get; |
| 4 | 55 | | var uri = new RawRequestUriBuilder(); |
| 4 | 56 | | uri.AppendRaw(endpoint, false); |
| 4 | 57 | | uri.AppendPath("/pipelines", false); |
| 4 | 58 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 59 | | request.Uri = uri; |
| 4 | 60 | | return message; |
| | 61 | | } |
| | 62 | |
|
| | 63 | | /// <summary> Lists pipelines. </summary> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public async Task<Response<PipelineListResponse>> GetPipelinesByWorkspaceAsync(CancellationToken cancellationTok |
| | 66 | | { |
| 2 | 67 | | using var message = CreateGetPipelinesByWorkspaceRequest(); |
| 2 | 68 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 69 | | switch (message.Response.Status) |
| | 70 | | { |
| | 71 | | case 200: |
| | 72 | | { |
| | 73 | | PipelineListResponse value = default; |
| 2 | 74 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 75 | | value = PipelineListResponse.DeserializePipelineListResponse(document.RootElement); |
| 2 | 76 | | return Response.FromValue(value, message.Response); |
| | 77 | | } |
| | 78 | | default: |
| 0 | 79 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 80 | | } |
| 2 | 81 | | } |
| | 82 | |
|
| | 83 | | /// <summary> Lists pipelines. </summary> |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | public Response<PipelineListResponse> GetPipelinesByWorkspace(CancellationToken cancellationToken = default) |
| | 86 | | { |
| 2 | 87 | | using var message = CreateGetPipelinesByWorkspaceRequest(); |
| 2 | 88 | | _pipeline.Send(message, cancellationToken); |
| 2 | 89 | | switch (message.Response.Status) |
| | 90 | | { |
| | 91 | | case 200: |
| | 92 | | { |
| | 93 | | PipelineListResponse value = default; |
| 2 | 94 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 95 | | value = PipelineListResponse.DeserializePipelineListResponse(document.RootElement); |
| 2 | 96 | | return Response.FromValue(value, message.Response); |
| | 97 | | } |
| | 98 | | default: |
| 0 | 99 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 100 | | } |
| 2 | 101 | | } |
| | 102 | |
|
| | 103 | | internal HttpMessage CreateCreateOrUpdatePipelineRequest(string pipelineName, PipelineResource pipeline, string |
| | 104 | | { |
| 0 | 105 | | var message = _pipeline.CreateMessage(); |
| 0 | 106 | | var request = message.Request; |
| 0 | 107 | | request.Method = RequestMethod.Put; |
| 0 | 108 | | var uri = new RawRequestUriBuilder(); |
| 0 | 109 | | uri.AppendRaw(endpoint, false); |
| 0 | 110 | | uri.AppendPath("/pipelines/", false); |
| 0 | 111 | | uri.AppendPath(pipelineName, true); |
| 0 | 112 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 113 | | request.Uri = uri; |
| 0 | 114 | | if (ifMatch != null) |
| | 115 | | { |
| 0 | 116 | | request.Headers.Add("If-Match", ifMatch); |
| | 117 | | } |
| 0 | 118 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 119 | | var content = new Utf8JsonRequestContent(); |
| 0 | 120 | | content.JsonWriter.WriteObjectValue(pipeline); |
| 0 | 121 | | request.Content = content; |
| 0 | 122 | | return message; |
| | 123 | | } |
| | 124 | |
|
| | 125 | | /// <summary> Creates or updates a pipeline. </summary> |
| | 126 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 127 | | /// <param name="pipeline"> Pipeline resource definition. </param> |
| | 128 | | /// <param name="ifMatch"> ETag of the pipeline entity. Should only be specified for update, for which it shoul |
| | 129 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 130 | | /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> or <paramref name="pipeline"/> is n |
| | 131 | | public async Task<Response<PipelineResource>> CreateOrUpdatePipelineAsync(string pipelineName, PipelineResource |
| | 132 | | { |
| 0 | 133 | | if (pipelineName == null) |
| | 134 | | { |
| 0 | 135 | | throw new ArgumentNullException(nameof(pipelineName)); |
| | 136 | | } |
| 0 | 137 | | if (pipeline == null) |
| | 138 | | { |
| 0 | 139 | | throw new ArgumentNullException(nameof(pipeline)); |
| | 140 | | } |
| | 141 | |
|
| 0 | 142 | | using var message = CreateCreateOrUpdatePipelineRequest(pipelineName, pipeline, ifMatch); |
| 0 | 143 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 144 | | switch (message.Response.Status) |
| | 145 | | { |
| | 146 | | case 200: |
| | 147 | | { |
| | 148 | | PipelineResource value = default; |
| 0 | 149 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 150 | | value = PipelineResource.DeserializePipelineResource(document.RootElement); |
| 0 | 151 | | return Response.FromValue(value, message.Response); |
| | 152 | | } |
| | 153 | | default: |
| 0 | 154 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 155 | | } |
| 0 | 156 | | } |
| | 157 | |
|
| | 158 | | /// <summary> Creates or updates a pipeline. </summary> |
| | 159 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 160 | | /// <param name="pipeline"> Pipeline resource definition. </param> |
| | 161 | | /// <param name="ifMatch"> ETag of the pipeline entity. Should only be specified for update, for which it shoul |
| | 162 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 163 | | /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> or <paramref name="pipeline"/> is n |
| | 164 | | public Response<PipelineResource> CreateOrUpdatePipeline(string pipelineName, PipelineResource pipeline, string |
| | 165 | | { |
| 0 | 166 | | if (pipelineName == null) |
| | 167 | | { |
| 0 | 168 | | throw new ArgumentNullException(nameof(pipelineName)); |
| | 169 | | } |
| 0 | 170 | | if (pipeline == null) |
| | 171 | | { |
| 0 | 172 | | throw new ArgumentNullException(nameof(pipeline)); |
| | 173 | | } |
| | 174 | |
|
| 0 | 175 | | using var message = CreateCreateOrUpdatePipelineRequest(pipelineName, pipeline, ifMatch); |
| 0 | 176 | | _pipeline.Send(message, cancellationToken); |
| 0 | 177 | | switch (message.Response.Status) |
| | 178 | | { |
| | 179 | | case 200: |
| | 180 | | { |
| | 181 | | PipelineResource value = default; |
| 0 | 182 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 183 | | value = PipelineResource.DeserializePipelineResource(document.RootElement); |
| 0 | 184 | | return Response.FromValue(value, message.Response); |
| | 185 | | } |
| | 186 | | default: |
| 0 | 187 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 188 | | } |
| 0 | 189 | | } |
| | 190 | |
|
| | 191 | | internal HttpMessage CreateGetPipelineRequest(string pipelineName, string ifNoneMatch) |
| | 192 | | { |
| 4 | 193 | | var message = _pipeline.CreateMessage(); |
| 4 | 194 | | var request = message.Request; |
| 4 | 195 | | request.Method = RequestMethod.Get; |
| 4 | 196 | | var uri = new RawRequestUriBuilder(); |
| 4 | 197 | | uri.AppendRaw(endpoint, false); |
| 4 | 198 | | uri.AppendPath("/pipelines/", false); |
| 4 | 199 | | uri.AppendPath(pipelineName, true); |
| 4 | 200 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 201 | | request.Uri = uri; |
| 4 | 202 | | if (ifNoneMatch != null) |
| | 203 | | { |
| 0 | 204 | | request.Headers.Add("If-None-Match", ifNoneMatch); |
| | 205 | | } |
| 4 | 206 | | return message; |
| | 207 | | } |
| | 208 | |
|
| | 209 | | /// <summary> Gets a pipeline. </summary> |
| | 210 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 211 | | /// <param name="ifNoneMatch"> ETag of the pipeline entity. Should only be specified for get. If the ETag matche |
| | 212 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 213 | | /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception> |
| | 214 | | public async Task<Response<PipelineResource>> GetPipelineAsync(string pipelineName, string ifNoneMatch = null, C |
| | 215 | | { |
| 2 | 216 | | if (pipelineName == null) |
| | 217 | | { |
| 0 | 218 | | throw new ArgumentNullException(nameof(pipelineName)); |
| | 219 | | } |
| | 220 | |
|
| 2 | 221 | | using var message = CreateGetPipelineRequest(pipelineName, ifNoneMatch); |
| 2 | 222 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 223 | | switch (message.Response.Status) |
| | 224 | | { |
| | 225 | | case 200: |
| | 226 | | { |
| | 227 | | PipelineResource value = default; |
| 2 | 228 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 229 | | value = PipelineResource.DeserializePipelineResource(document.RootElement); |
| 2 | 230 | | return Response.FromValue(value, message.Response); |
| | 231 | | } |
| | 232 | | case 304: |
| 0 | 233 | | return Response.FromValue<PipelineResource>(null, message.Response); |
| | 234 | | default: |
| 0 | 235 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 236 | | } |
| 2 | 237 | | } |
| | 238 | |
|
| | 239 | | /// <summary> Gets a pipeline. </summary> |
| | 240 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 241 | | /// <param name="ifNoneMatch"> ETag of the pipeline entity. Should only be specified for get. If the ETag matche |
| | 242 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 243 | | /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception> |
| | 244 | | public Response<PipelineResource> GetPipeline(string pipelineName, string ifNoneMatch = null, CancellationToken |
| | 245 | | { |
| 2 | 246 | | if (pipelineName == null) |
| | 247 | | { |
| 0 | 248 | | throw new ArgumentNullException(nameof(pipelineName)); |
| | 249 | | } |
| | 250 | |
|
| 2 | 251 | | using var message = CreateGetPipelineRequest(pipelineName, ifNoneMatch); |
| 2 | 252 | | _pipeline.Send(message, cancellationToken); |
| 2 | 253 | | switch (message.Response.Status) |
| | 254 | | { |
| | 255 | | case 200: |
| | 256 | | { |
| | 257 | | PipelineResource value = default; |
| 2 | 258 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 259 | | value = PipelineResource.DeserializePipelineResource(document.RootElement); |
| 2 | 260 | | return Response.FromValue(value, message.Response); |
| | 261 | | } |
| | 262 | | case 304: |
| 0 | 263 | | return Response.FromValue<PipelineResource>(null, message.Response); |
| | 264 | | default: |
| 0 | 265 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 266 | | } |
| 2 | 267 | | } |
| | 268 | |
|
| | 269 | | internal HttpMessage CreateDeletePipelineRequest(string pipelineName) |
| | 270 | | { |
| 0 | 271 | | var message = _pipeline.CreateMessage(); |
| 0 | 272 | | var request = message.Request; |
| 0 | 273 | | request.Method = RequestMethod.Delete; |
| 0 | 274 | | var uri = new RawRequestUriBuilder(); |
| 0 | 275 | | uri.AppendRaw(endpoint, false); |
| 0 | 276 | | uri.AppendPath("/pipelines/", false); |
| 0 | 277 | | uri.AppendPath(pipelineName, true); |
| 0 | 278 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 279 | | request.Uri = uri; |
| 0 | 280 | | return message; |
| | 281 | | } |
| | 282 | |
|
| | 283 | | /// <summary> Deletes a pipeline. </summary> |
| | 284 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 285 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 286 | | /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception> |
| | 287 | | public async Task<Response> DeletePipelineAsync(string pipelineName, CancellationToken cancellationToken = defau |
| | 288 | | { |
| 0 | 289 | | if (pipelineName == null) |
| | 290 | | { |
| 0 | 291 | | throw new ArgumentNullException(nameof(pipelineName)); |
| | 292 | | } |
| | 293 | |
|
| 0 | 294 | | using var message = CreateDeletePipelineRequest(pipelineName); |
| 0 | 295 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 296 | | switch (message.Response.Status) |
| | 297 | | { |
| | 298 | | case 200: |
| | 299 | | case 204: |
| 0 | 300 | | return message.Response; |
| | 301 | | default: |
| 0 | 302 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 303 | | } |
| 0 | 304 | | } |
| | 305 | |
|
| | 306 | | /// <summary> Deletes a pipeline. </summary> |
| | 307 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 308 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 309 | | /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception> |
| | 310 | | public Response DeletePipeline(string pipelineName, CancellationToken cancellationToken = default) |
| | 311 | | { |
| 0 | 312 | | if (pipelineName == null) |
| | 313 | | { |
| 0 | 314 | | throw new ArgumentNullException(nameof(pipelineName)); |
| | 315 | | } |
| | 316 | |
|
| 0 | 317 | | using var message = CreateDeletePipelineRequest(pipelineName); |
| 0 | 318 | | _pipeline.Send(message, cancellationToken); |
| 0 | 319 | | switch (message.Response.Status) |
| | 320 | | { |
| | 321 | | case 200: |
| | 322 | | case 204: |
| 0 | 323 | | return message.Response; |
| | 324 | | default: |
| 0 | 325 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 326 | | } |
| 0 | 327 | | } |
| | 328 | |
|
| | 329 | | internal HttpMessage CreateCreatePipelineRunRequest(string pipelineName, string referencePipelineRunId, bool? is |
| | 330 | | { |
| 0 | 331 | | var message = _pipeline.CreateMessage(); |
| 0 | 332 | | var request = message.Request; |
| 0 | 333 | | request.Method = RequestMethod.Post; |
| 0 | 334 | | var uri = new RawRequestUriBuilder(); |
| 0 | 335 | | uri.AppendRaw(endpoint, false); |
| 0 | 336 | | uri.AppendPath("/pipelines/", false); |
| 0 | 337 | | uri.AppendPath(pipelineName, true); |
| 0 | 338 | | uri.AppendPath("/createRun", false); |
| 0 | 339 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 340 | | if (referencePipelineRunId != null) |
| | 341 | | { |
| 0 | 342 | | uri.AppendQuery("referencePipelineRunId", referencePipelineRunId, true); |
| | 343 | | } |
| 0 | 344 | | if (isRecovery != null) |
| | 345 | | { |
| 0 | 346 | | uri.AppendQuery("isRecovery", isRecovery.Value, true); |
| | 347 | | } |
| 0 | 348 | | if (startActivityName != null) |
| | 349 | | { |
| 0 | 350 | | uri.AppendQuery("startActivityName", startActivityName, true); |
| | 351 | | } |
| 0 | 352 | | request.Uri = uri; |
| 0 | 353 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 354 | | if (parameters != null) |
| | 355 | | { |
| 0 | 356 | | var content = new Utf8JsonRequestContent(); |
| 0 | 357 | | content.JsonWriter.WriteStartObject(); |
| 0 | 358 | | foreach (var item in parameters) |
| | 359 | | { |
| 0 | 360 | | content.JsonWriter.WritePropertyName(item.Key); |
| 0 | 361 | | content.JsonWriter.WriteObjectValue(item.Value); |
| | 362 | | } |
| 0 | 363 | | content.JsonWriter.WriteEndObject(); |
| 0 | 364 | | request.Content = content; |
| | 365 | | } |
| 0 | 366 | | return message; |
| | 367 | | } |
| | 368 | |
|
| | 369 | | /// <summary> Creates a run of a pipeline. </summary> |
| | 370 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 371 | | /// <param name="referencePipelineRunId"> The pipeline run identifier. If run ID is specified the parameters of |
| | 372 | | /// <param name="isRecovery"> Recovery mode flag. If recovery mode is set to true, the specified referenced pipe |
| | 373 | | /// <param name="startActivityName"> In recovery mode, the rerun will start from this activity. If not specified |
| | 374 | | /// <param name="parameters"> Parameters of the pipeline run. These parameters will be used only if the runId is |
| | 375 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 376 | | /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception> |
| | 377 | | public async Task<Response<CreateRunResponse>> CreatePipelineRunAsync(string pipelineName, string referencePipel |
| | 378 | | { |
| 0 | 379 | | if (pipelineName == null) |
| | 380 | | { |
| 0 | 381 | | throw new ArgumentNullException(nameof(pipelineName)); |
| | 382 | | } |
| | 383 | |
|
| 0 | 384 | | using var message = CreateCreatePipelineRunRequest(pipelineName, referencePipelineRunId, isRecovery, startAc |
| 0 | 385 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 386 | | switch (message.Response.Status) |
| | 387 | | { |
| | 388 | | case 200: |
| | 389 | | { |
| | 390 | | CreateRunResponse value = default; |
| 0 | 391 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 392 | | value = CreateRunResponse.DeserializeCreateRunResponse(document.RootElement); |
| 0 | 393 | | return Response.FromValue(value, message.Response); |
| | 394 | | } |
| | 395 | | default: |
| 0 | 396 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 397 | | } |
| 0 | 398 | | } |
| | 399 | |
|
| | 400 | | /// <summary> Creates a run of a pipeline. </summary> |
| | 401 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 402 | | /// <param name="referencePipelineRunId"> The pipeline run identifier. If run ID is specified the parameters of |
| | 403 | | /// <param name="isRecovery"> Recovery mode flag. If recovery mode is set to true, the specified referenced pipe |
| | 404 | | /// <param name="startActivityName"> In recovery mode, the rerun will start from this activity. If not specified |
| | 405 | | /// <param name="parameters"> Parameters of the pipeline run. These parameters will be used only if the runId is |
| | 406 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 407 | | /// <exception cref="ArgumentNullException"> <paramref name="pipelineName"/> is null. </exception> |
| | 408 | | public Response<CreateRunResponse> CreatePipelineRun(string pipelineName, string referencePipelineRunId = null, |
| | 409 | | { |
| 0 | 410 | | if (pipelineName == null) |
| | 411 | | { |
| 0 | 412 | | throw new ArgumentNullException(nameof(pipelineName)); |
| | 413 | | } |
| | 414 | |
|
| 0 | 415 | | using var message = CreateCreatePipelineRunRequest(pipelineName, referencePipelineRunId, isRecovery, startAc |
| 0 | 416 | | _pipeline.Send(message, cancellationToken); |
| 0 | 417 | | switch (message.Response.Status) |
| | 418 | | { |
| | 419 | | case 200: |
| | 420 | | { |
| | 421 | | CreateRunResponse value = default; |
| 0 | 422 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 423 | | value = CreateRunResponse.DeserializeCreateRunResponse(document.RootElement); |
| 0 | 424 | | return Response.FromValue(value, message.Response); |
| | 425 | | } |
| | 426 | | default: |
| 0 | 427 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 428 | | } |
| 0 | 429 | | } |
| | 430 | |
|
| | 431 | | internal HttpMessage CreateGetPipelinesByWorkspaceNextPageRequest(string nextLink) |
| | 432 | | { |
| 0 | 433 | | var message = _pipeline.CreateMessage(); |
| 0 | 434 | | var request = message.Request; |
| 0 | 435 | | request.Method = RequestMethod.Get; |
| 0 | 436 | | var uri = new RawRequestUriBuilder(); |
| 0 | 437 | | uri.AppendRaw(endpoint, false); |
| 0 | 438 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 439 | | request.Uri = uri; |
| 0 | 440 | | return message; |
| | 441 | | } |
| | 442 | |
|
| | 443 | | /// <summary> Lists pipelines. </summary> |
| | 444 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 445 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 446 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 447 | | public async Task<Response<PipelineListResponse>> GetPipelinesByWorkspaceNextPageAsync(string nextLink, Cancella |
| | 448 | | { |
| 0 | 449 | | if (nextLink == null) |
| | 450 | | { |
| 0 | 451 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 452 | | } |
| | 453 | |
|
| 0 | 454 | | using var message = CreateGetPipelinesByWorkspaceNextPageRequest(nextLink); |
| 0 | 455 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 456 | | switch (message.Response.Status) |
| | 457 | | { |
| | 458 | | case 200: |
| | 459 | | { |
| | 460 | | PipelineListResponse value = default; |
| 0 | 461 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 462 | | value = PipelineListResponse.DeserializePipelineListResponse(document.RootElement); |
| 0 | 463 | | return Response.FromValue(value, message.Response); |
| | 464 | | } |
| | 465 | | default: |
| 0 | 466 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 467 | | } |
| 0 | 468 | | } |
| | 469 | |
|
| | 470 | | /// <summary> Lists pipelines. </summary> |
| | 471 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 472 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 473 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 474 | | public Response<PipelineListResponse> GetPipelinesByWorkspaceNextPage(string nextLink, CancellationToken cancell |
| | 475 | | { |
| 0 | 476 | | if (nextLink == null) |
| | 477 | | { |
| 0 | 478 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 479 | | } |
| | 480 | |
|
| 0 | 481 | | using var message = CreateGetPipelinesByWorkspaceNextPageRequest(nextLink); |
| 0 | 482 | | _pipeline.Send(message, cancellationToken); |
| 0 | 483 | | switch (message.Response.Status) |
| | 484 | | { |
| | 485 | | case 200: |
| | 486 | | { |
| | 487 | | PipelineListResponse value = default; |
| 0 | 488 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 489 | | value = PipelineListResponse.DeserializePipelineListResponse(document.RootElement); |
| 0 | 490 | | return Response.FromValue(value, message.Response); |
| | 491 | | } |
| | 492 | | default: |
| 0 | 493 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 494 | | } |
| 0 | 495 | | } |
| | 496 | | } |
| | 497 | | } |