| | 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.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Analytics.Synapse.Artifacts.Models; |
| | 14 | | using Azure.Core; |
| | 15 | | using Azure.Core.Pipeline; |
| 0 | 16 | |
|
| | 17 | | namespace Azure.Analytics.Synapse.Artifacts |
| 0 | 18 | | { |
| | 19 | | /// <summary> The Pipeline service client. </summary> |
| | 20 | | public partial class PipelineClient |
| | 21 | | { |
| | 22 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 23 | | private readonly HttpPipeline _pipeline; |
| 12 | 24 | | internal PipelineRestClient RestClient { get; } |
| 4 | 25 | | /// <summary> Initializes a new instance of PipelineClient for mocking. </summary> |
| 12 | 26 | | protected PipelineClient() |
| 4 | 27 | | { |
| 8 | 28 | | } |
| 4 | 29 | | /// <summary> Initializes a new instance of PipelineClient. </summary> |
| | 30 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 31 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 32 | | /// <param name="endpoint"> The workspace development endpoint, for example https://myworkspace.dev.azuresynapse |
| | 33 | | /// <param name="apiVersion"> Api Version. </param> |
| 8 | 34 | | internal PipelineClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiV |
| | 35 | | { |
| 8 | 36 | | RestClient = new PipelineRestClient(clientDiagnostics, pipeline, endpoint, apiVersion); |
| 8 | 37 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 38 | | _pipeline = pipeline; |
| 8 | 39 | | } |
| | 40 | |
|
| | 41 | | /// <summary> Creates or updates a pipeline. </summary> |
| | 42 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 43 | | /// <param name="pipeline"> Pipeline resource definition. </param> |
| | 44 | | /// <param name="ifMatch"> ETag of the pipeline entity. Should only be specified for update, for which it shoul |
| | 45 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 46 | | public virtual async Task<Response<PipelineResource>> CreateOrUpdatePipelineAsync(string pipelineName, PipelineR |
| | 47 | | { |
| 0 | 48 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.CreateOrUpdatePipeline"); |
| 0 | 49 | | scope.Start(); |
| | 50 | | try |
| | 51 | | { |
| 0 | 52 | | return await RestClient.CreateOrUpdatePipelineAsync(pipelineName, pipeline, ifMatch, cancellationToken). |
| | 53 | | } |
| 0 | 54 | | catch (Exception e) |
| | 55 | | { |
| 0 | 56 | | scope.Failed(e); |
| 0 | 57 | | throw; |
| | 58 | | } |
| 0 | 59 | | } |
| | 60 | |
|
| | 61 | | /// <summary> Creates or updates a pipeline. </summary> |
| | 62 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 63 | | /// <param name="pipeline"> Pipeline resource definition. </param> |
| | 64 | | /// <param name="ifMatch"> ETag of the pipeline entity. Should only be specified for update, for which it shoul |
| | 65 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 66 | | public virtual Response<PipelineResource> CreateOrUpdatePipeline(string pipelineName, PipelineResource pipeline, |
| | 67 | | { |
| 0 | 68 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.CreateOrUpdatePipeline"); |
| 0 | 69 | | scope.Start(); |
| | 70 | | try |
| | 71 | | { |
| 0 | 72 | | return RestClient.CreateOrUpdatePipeline(pipelineName, pipeline, ifMatch, cancellationToken); |
| | 73 | | } |
| 0 | 74 | | catch (Exception e) |
| | 75 | | { |
| 0 | 76 | | scope.Failed(e); |
| 0 | 77 | | throw; |
| | 78 | | } |
| 0 | 79 | | } |
| | 80 | |
|
| | 81 | | /// <summary> Gets a pipeline. </summary> |
| | 82 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 83 | | /// <param name="ifNoneMatch"> ETag of the pipeline entity. Should only be specified for get. If the ETag matche |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | public virtual async Task<Response<PipelineResource>> GetPipelineAsync(string pipelineName, string ifNoneMatch = |
| | 86 | | { |
| 2 | 87 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipeline"); |
| 2 | 88 | | scope.Start(); |
| | 89 | | try |
| | 90 | | { |
| 2 | 91 | | return await RestClient.GetPipelineAsync(pipelineName, ifNoneMatch, cancellationToken).ConfigureAwait(fa |
| | 92 | | } |
| 0 | 93 | | catch (Exception e) |
| | 94 | | { |
| 0 | 95 | | scope.Failed(e); |
| 0 | 96 | | throw; |
| | 97 | | } |
| 2 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Gets a pipeline. </summary> |
| | 101 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 102 | | /// <param name="ifNoneMatch"> ETag of the pipeline entity. Should only be specified for get. If the ETag matche |
| | 103 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 104 | | public virtual Response<PipelineResource> GetPipeline(string pipelineName, string ifNoneMatch = null, Cancellati |
| | 105 | | { |
| 2 | 106 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipeline"); |
| 2 | 107 | | scope.Start(); |
| | 108 | | try |
| | 109 | | { |
| 2 | 110 | | return RestClient.GetPipeline(pipelineName, ifNoneMatch, cancellationToken); |
| | 111 | | } |
| 0 | 112 | | catch (Exception e) |
| | 113 | | { |
| 0 | 114 | | scope.Failed(e); |
| 0 | 115 | | throw; |
| | 116 | | } |
| 2 | 117 | | } |
| | 118 | |
|
| | 119 | | /// <summary> Deletes a pipeline. </summary> |
| | 120 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 121 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 122 | | public virtual async Task<Response> DeletePipelineAsync(string pipelineName, CancellationToken cancellationToken |
| | 123 | | { |
| 0 | 124 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.DeletePipeline"); |
| 0 | 125 | | scope.Start(); |
| | 126 | | try |
| | 127 | | { |
| 0 | 128 | | return await RestClient.DeletePipelineAsync(pipelineName, cancellationToken).ConfigureAwait(false); |
| | 129 | | } |
| 0 | 130 | | catch (Exception e) |
| | 131 | | { |
| 0 | 132 | | scope.Failed(e); |
| 0 | 133 | | throw; |
| | 134 | | } |
| 0 | 135 | | } |
| | 136 | |
|
| | 137 | | /// <summary> Deletes a pipeline. </summary> |
| | 138 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 139 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 140 | | public virtual Response DeletePipeline(string pipelineName, CancellationToken cancellationToken = default) |
| | 141 | | { |
| 0 | 142 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.DeletePipeline"); |
| 0 | 143 | | scope.Start(); |
| | 144 | | try |
| | 145 | | { |
| 0 | 146 | | return RestClient.DeletePipeline(pipelineName, cancellationToken); |
| | 147 | | } |
| 0 | 148 | | catch (Exception e) |
| | 149 | | { |
| 0 | 150 | | scope.Failed(e); |
| 0 | 151 | | throw; |
| | 152 | | } |
| 0 | 153 | | } |
| | 154 | |
|
| | 155 | | /// <summary> Creates a run of a pipeline. </summary> |
| | 156 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 157 | | /// <param name="referencePipelineRunId"> The pipeline run identifier. If run ID is specified the parameters of |
| | 158 | | /// <param name="isRecovery"> Recovery mode flag. If recovery mode is set to true, the specified referenced pipe |
| | 159 | | /// <param name="startActivityName"> In recovery mode, the rerun will start from this activity. If not specified |
| | 160 | | /// <param name="parameters"> Parameters of the pipeline run. These parameters will be used only if the runId is |
| | 161 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 162 | | public virtual async Task<Response<CreateRunResponse>> CreatePipelineRunAsync(string pipelineName, string refere |
| | 163 | | { |
| 0 | 164 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.CreatePipelineRun"); |
| 0 | 165 | | scope.Start(); |
| | 166 | | try |
| | 167 | | { |
| 0 | 168 | | return await RestClient.CreatePipelineRunAsync(pipelineName, referencePipelineRunId, isRecovery, startAc |
| | 169 | | } |
| 0 | 170 | | catch (Exception e) |
| | 171 | | { |
| 0 | 172 | | scope.Failed(e); |
| 0 | 173 | | throw; |
| | 174 | | } |
| 0 | 175 | | } |
| | 176 | |
|
| | 177 | | /// <summary> Creates a run of a pipeline. </summary> |
| | 178 | | /// <param name="pipelineName"> The pipeline name. </param> |
| | 179 | | /// <param name="referencePipelineRunId"> The pipeline run identifier. If run ID is specified the parameters of |
| | 180 | | /// <param name="isRecovery"> Recovery mode flag. If recovery mode is set to true, the specified referenced pipe |
| | 181 | | /// <param name="startActivityName"> In recovery mode, the rerun will start from this activity. If not specified |
| | 182 | | /// <param name="parameters"> Parameters of the pipeline run. These parameters will be used only if the runId is |
| | 183 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 184 | | public virtual Response<CreateRunResponse> CreatePipelineRun(string pipelineName, string referencePipelineRunId |
| | 185 | | { |
| 0 | 186 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.CreatePipelineRun"); |
| 0 | 187 | | scope.Start(); |
| | 188 | | try |
| | 189 | | { |
| 0 | 190 | | return RestClient.CreatePipelineRun(pipelineName, referencePipelineRunId, isRecovery, startActivityName, |
| | 191 | | } |
| 0 | 192 | | catch (Exception e) |
| | 193 | | { |
| 0 | 194 | | scope.Failed(e); |
| 0 | 195 | | throw; |
| | 196 | | } |
| 0 | 197 | | } |
| | 198 | |
|
| | 199 | | /// <summary> Lists pipelines. </summary> |
| | 200 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 201 | | public virtual AsyncPageable<PipelineResource> GetPipelinesByWorkspaceAsync(CancellationToken cancellationToken |
| | 202 | | { |
| | 203 | | async Task<Page<PipelineResource>> FirstPageFunc(int? pageSizeHint) |
| | 204 | | { |
| 2 | 205 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipelinesByWorkspace"); |
| 2 | 206 | | scope.Start(); |
| | 207 | | try |
| | 208 | | { |
| 2 | 209 | | var response = await RestClient.GetPipelinesByWorkspaceAsync(cancellationToken).ConfigureAwait(false |
| 2 | 210 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 211 | | } |
| 0 | 212 | | catch (Exception e) |
| | 213 | | { |
| 0 | 214 | | scope.Failed(e); |
| 0 | 215 | | throw; |
| | 216 | | } |
| 2 | 217 | | } |
| | 218 | | async Task<Page<PipelineResource>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 219 | | { |
| 0 | 220 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipelinesByWorkspace"); |
| 0 | 221 | | scope.Start(); |
| | 222 | | try |
| | 223 | | { |
| 0 | 224 | | var response = await RestClient.GetPipelinesByWorkspaceNextPageAsync(nextLink, cancellationToken).Co |
| 0 | 225 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 226 | | } |
| 0 | 227 | | catch (Exception e) |
| | 228 | | { |
| 0 | 229 | | scope.Failed(e); |
| 0 | 230 | | throw; |
| | 231 | | } |
| 0 | 232 | | } |
| 2 | 233 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 234 | | } |
| | 235 | |
|
| | 236 | | /// <summary> Lists pipelines. </summary> |
| | 237 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 238 | | public virtual Pageable<PipelineResource> GetPipelinesByWorkspace(CancellationToken cancellationToken = default) |
| | 239 | | { |
| | 240 | | Page<PipelineResource> FirstPageFunc(int? pageSizeHint) |
| | 241 | | { |
| 2 | 242 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipelinesByWorkspace"); |
| 2 | 243 | | scope.Start(); |
| | 244 | | try |
| | 245 | | { |
| 2 | 246 | | var response = RestClient.GetPipelinesByWorkspace(cancellationToken); |
| 2 | 247 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 248 | | } |
| 0 | 249 | | catch (Exception e) |
| | 250 | | { |
| 0 | 251 | | scope.Failed(e); |
| 0 | 252 | | throw; |
| | 253 | | } |
| 2 | 254 | | } |
| | 255 | | Page<PipelineResource> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 256 | | { |
| 0 | 257 | | using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipelinesByWorkspace"); |
| 0 | 258 | | scope.Start(); |
| | 259 | | try |
| | 260 | | { |
| 0 | 261 | | var response = RestClient.GetPipelinesByWorkspaceNextPage(nextLink, cancellationToken); |
| 0 | 262 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 263 | | } |
| 0 | 264 | | catch (Exception e) |
| | 265 | | { |
| 0 | 266 | | scope.Failed(e); |
| 0 | 267 | | throw; |
| | 268 | | } |
| 0 | 269 | | } |
| 2 | 270 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 271 | | } |
| | 272 | | } |
| | 273 | | } |