| | 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.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Analytics.Synapse.Artifacts.Models; |
| | 13 | | using Azure.Core; |
| | 14 | | using Azure.Core.Pipeline; |
| | 15 | |
|
| 0 | 16 | | namespace Azure.Analytics.Synapse.Artifacts |
| | 17 | | { |
| 0 | 18 | | /// <summary> The DataFlow service client. </summary> |
| | 19 | | public partial class DataFlowClient |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal DataFlowRestClient RestClient { get; } |
| 0 | 24 | | /// <summary> Initializes a new instance of DataFlowClient for mocking. </summary> |
| 0 | 25 | | protected DataFlowClient() |
| 0 | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of DataFlowClient. </summary> |
| 0 | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="endpoint"> The workspace development endpoint, for example https://myworkspace.dev.azuresynapse |
| | 32 | | /// <param name="apiVersion"> Api Version. </param> |
| 0 | 33 | | internal DataFlowClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiV |
| | 34 | | { |
| 0 | 35 | | RestClient = new DataFlowRestClient(clientDiagnostics, pipeline, endpoint, apiVersion); |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Creates or updates a data flow. </summary> |
| | 41 | | /// <param name="dataFlowName"> The data flow name. </param> |
| | 42 | | /// <param name="dataFlow"> Data flow resource definition. </param> |
| | 43 | | /// <param name="ifMatch"> ETag of the data flow entity. Should only be specified for update, for which it shoul |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<DataFlowResource>> CreateOrUpdateDataFlowAsync(string dataFlowName, DataFlowR |
| | 46 | | { |
| 0 | 47 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.CreateOrUpdateDataFlow"); |
| 0 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 0 | 51 | | return await RestClient.CreateOrUpdateDataFlowAsync(dataFlowName, dataFlow, ifMatch, cancellationToken). |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Creates or updates a data flow. </summary> |
| | 61 | | /// <param name="dataFlowName"> The data flow name. </param> |
| | 62 | | /// <param name="dataFlow"> Data flow resource definition. </param> |
| | 63 | | /// <param name="ifMatch"> ETag of the data flow entity. Should only be specified for update, for which it shoul |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<DataFlowResource> CreateOrUpdateDataFlow(string dataFlowName, DataFlowResource dataFlow, |
| | 66 | | { |
| 0 | 67 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.CreateOrUpdateDataFlow"); |
| 0 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 0 | 71 | | return RestClient.CreateOrUpdateDataFlow(dataFlowName, dataFlow, ifMatch, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 0 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Gets a data flow. </summary> |
| | 81 | | /// <param name="dataFlowName"> The data flow name. </param> |
| | 82 | | /// <param name="ifNoneMatch"> ETag of the data flow entity. Should only be specified for get. If the ETag match |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public virtual async Task<Response<DataFlowResource>> GetDataFlowAsync(string dataFlowName, string ifNoneMatch = |
| | 85 | | { |
| 0 | 86 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.GetDataFlow"); |
| 0 | 87 | | scope.Start(); |
| | 88 | | try |
| | 89 | | { |
| 0 | 90 | | return await RestClient.GetDataFlowAsync(dataFlowName, ifNoneMatch, cancellationToken).ConfigureAwait(fa |
| | 91 | | } |
| 0 | 92 | | catch (Exception e) |
| | 93 | | { |
| 0 | 94 | | scope.Failed(e); |
| 0 | 95 | | throw; |
| | 96 | | } |
| 0 | 97 | | } |
| | 98 | |
|
| | 99 | | /// <summary> Gets a data flow. </summary> |
| | 100 | | /// <param name="dataFlowName"> The data flow name. </param> |
| | 101 | | /// <param name="ifNoneMatch"> ETag of the data flow entity. Should only be specified for get. If the ETag match |
| | 102 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 103 | | public virtual Response<DataFlowResource> GetDataFlow(string dataFlowName, string ifNoneMatch = null, Cancellati |
| | 104 | | { |
| 0 | 105 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.GetDataFlow"); |
| 0 | 106 | | scope.Start(); |
| | 107 | | try |
| | 108 | | { |
| 0 | 109 | | return RestClient.GetDataFlow(dataFlowName, ifNoneMatch, cancellationToken); |
| | 110 | | } |
| 0 | 111 | | catch (Exception e) |
| | 112 | | { |
| 0 | 113 | | scope.Failed(e); |
| 0 | 114 | | throw; |
| | 115 | | } |
| 0 | 116 | | } |
| | 117 | |
|
| | 118 | | /// <summary> Deletes a data flow. </summary> |
| | 119 | | /// <param name="dataFlowName"> The data flow name. </param> |
| | 120 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 121 | | public virtual async Task<Response> DeleteDataFlowAsync(string dataFlowName, CancellationToken cancellationToken |
| | 122 | | { |
| 0 | 123 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.DeleteDataFlow"); |
| 0 | 124 | | scope.Start(); |
| | 125 | | try |
| | 126 | | { |
| 0 | 127 | | return await RestClient.DeleteDataFlowAsync(dataFlowName, cancellationToken).ConfigureAwait(false); |
| | 128 | | } |
| 0 | 129 | | catch (Exception e) |
| | 130 | | { |
| 0 | 131 | | scope.Failed(e); |
| 0 | 132 | | throw; |
| | 133 | | } |
| 0 | 134 | | } |
| | 135 | |
|
| | 136 | | /// <summary> Deletes a data flow. </summary> |
| | 137 | | /// <param name="dataFlowName"> The data flow name. </param> |
| | 138 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 139 | | public virtual Response DeleteDataFlow(string dataFlowName, CancellationToken cancellationToken = default) |
| | 140 | | { |
| 0 | 141 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.DeleteDataFlow"); |
| 0 | 142 | | scope.Start(); |
| | 143 | | try |
| | 144 | | { |
| 0 | 145 | | return RestClient.DeleteDataFlow(dataFlowName, cancellationToken); |
| | 146 | | } |
| 0 | 147 | | catch (Exception e) |
| | 148 | | { |
| 0 | 149 | | scope.Failed(e); |
| 0 | 150 | | throw; |
| | 151 | | } |
| 0 | 152 | | } |
| | 153 | |
|
| | 154 | | /// <summary> Lists data flows. </summary> |
| | 155 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 156 | | public virtual AsyncPageable<DataFlowResource> GetDataFlowsByWorkspaceAsync(CancellationToken cancellationToken |
| | 157 | | { |
| | 158 | | async Task<Page<DataFlowResource>> FirstPageFunc(int? pageSizeHint) |
| | 159 | | { |
| 0 | 160 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.GetDataFlowsByWorkspace"); |
| 0 | 161 | | scope.Start(); |
| | 162 | | try |
| | 163 | | { |
| 0 | 164 | | var response = await RestClient.GetDataFlowsByWorkspaceAsync(cancellationToken).ConfigureAwait(false |
| 0 | 165 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 166 | | } |
| 0 | 167 | | catch (Exception e) |
| | 168 | | { |
| 0 | 169 | | scope.Failed(e); |
| 0 | 170 | | throw; |
| | 171 | | } |
| 0 | 172 | | } |
| | 173 | | async Task<Page<DataFlowResource>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 174 | | { |
| 0 | 175 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.GetDataFlowsByWorkspace"); |
| 0 | 176 | | scope.Start(); |
| | 177 | | try |
| | 178 | | { |
| 0 | 179 | | var response = await RestClient.GetDataFlowsByWorkspaceNextPageAsync(nextLink, cancellationToken).Co |
| 0 | 180 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 181 | | } |
| 0 | 182 | | catch (Exception e) |
| | 183 | | { |
| 0 | 184 | | scope.Failed(e); |
| 0 | 185 | | throw; |
| | 186 | | } |
| 0 | 187 | | } |
| 0 | 188 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 189 | | } |
| | 190 | |
|
| | 191 | | /// <summary> Lists data flows. </summary> |
| | 192 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 193 | | public virtual Pageable<DataFlowResource> GetDataFlowsByWorkspace(CancellationToken cancellationToken = default) |
| | 194 | | { |
| | 195 | | Page<DataFlowResource> FirstPageFunc(int? pageSizeHint) |
| | 196 | | { |
| 0 | 197 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.GetDataFlowsByWorkspace"); |
| 0 | 198 | | scope.Start(); |
| | 199 | | try |
| | 200 | | { |
| 0 | 201 | | var response = RestClient.GetDataFlowsByWorkspace(cancellationToken); |
| 0 | 202 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 203 | | } |
| 0 | 204 | | catch (Exception e) |
| | 205 | | { |
| 0 | 206 | | scope.Failed(e); |
| 0 | 207 | | throw; |
| | 208 | | } |
| 0 | 209 | | } |
| | 210 | | Page<DataFlowResource> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 211 | | { |
| 0 | 212 | | using var scope = _clientDiagnostics.CreateScope("DataFlowClient.GetDataFlowsByWorkspace"); |
| 0 | 213 | | scope.Start(); |
| | 214 | | try |
| | 215 | | { |
| 0 | 216 | | var response = RestClient.GetDataFlowsByWorkspaceNextPage(nextLink, cancellationToken); |
| 0 | 217 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 218 | | } |
| 0 | 219 | | catch (Exception e) |
| | 220 | | { |
| 0 | 221 | | scope.Failed(e); |
| 0 | 222 | | throw; |
| | 223 | | } |
| 0 | 224 | | } |
| 0 | 225 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 226 | | } |
| | 227 | | } |
| | 228 | | } |