| | 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 SparkJobDefinition service client. </summary> |
| | 19 | | public partial class SparkJobDefinitionClient |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal SparkJobDefinitionRestClient RestClient { get; } |
| 0 | 24 | | /// <summary> Initializes a new instance of SparkJobDefinitionClient for mocking. </summary> |
| 0 | 25 | | protected SparkJobDefinitionClient() |
| 0 | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of SparkJobDefinitionClient. </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 SparkJobDefinitionClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, s |
| | 34 | | { |
| 0 | 35 | | RestClient = new SparkJobDefinitionRestClient(clientDiagnostics, pipeline, endpoint, apiVersion); |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Creates or updates a Spark Job Definition. </summary> |
| | 41 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 42 | | /// <param name="sparkJobDefinition"> Spark Job Definition resource definition. </param> |
| | 43 | | /// <param name="ifMatch"> ETag of the Spark Job Definition entity. Should only be specified for update, for wh |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<SparkJobDefinitionResource>> CreateOrUpdateSparkJobDefinitionAsync(string spa |
| | 46 | | { |
| 0 | 47 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.CreateOrUpdateSparkJobDefinition" |
| 0 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 0 | 51 | | return await RestClient.CreateOrUpdateSparkJobDefinitionAsync(sparkJobDefinitionName, sparkJobDefinition |
| | 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 Spark Job Definition. </summary> |
| | 61 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 62 | | /// <param name="sparkJobDefinition"> Spark Job Definition resource definition. </param> |
| | 63 | | /// <param name="ifMatch"> ETag of the Spark Job Definition entity. Should only be specified for update, for wh |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<SparkJobDefinitionResource> CreateOrUpdateSparkJobDefinition(string sparkJobDefinitionNa |
| | 66 | | { |
| 0 | 67 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.CreateOrUpdateSparkJobDefinition" |
| 0 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 0 | 71 | | return RestClient.CreateOrUpdateSparkJobDefinition(sparkJobDefinitionName, sparkJobDefinition, ifMatch, |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 0 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Gets a Spark Job Definition. </summary> |
| | 81 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 82 | | /// <param name="ifNoneMatch"> ETag of the Spark Job Definition entity. Should only be specified for get. If the |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public virtual async Task<Response<SparkJobDefinitionResource>> GetSparkJobDefinitionAsync(string sparkJobDefini |
| | 85 | | { |
| 0 | 86 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinition"); |
| 0 | 87 | | scope.Start(); |
| | 88 | | try |
| | 89 | | { |
| 0 | 90 | | return await RestClient.GetSparkJobDefinitionAsync(sparkJobDefinitionName, ifNoneMatch, cancellationToke |
| | 91 | | } |
| 0 | 92 | | catch (Exception e) |
| | 93 | | { |
| 0 | 94 | | scope.Failed(e); |
| 0 | 95 | | throw; |
| | 96 | | } |
| 0 | 97 | | } |
| | 98 | |
|
| | 99 | | /// <summary> Gets a Spark Job Definition. </summary> |
| | 100 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 101 | | /// <param name="ifNoneMatch"> ETag of the Spark Job Definition entity. Should only be specified for get. If the |
| | 102 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 103 | | public virtual Response<SparkJobDefinitionResource> GetSparkJobDefinition(string sparkJobDefinitionName, string |
| | 104 | | { |
| 0 | 105 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinition"); |
| 0 | 106 | | scope.Start(); |
| | 107 | | try |
| | 108 | | { |
| 0 | 109 | | return RestClient.GetSparkJobDefinition(sparkJobDefinitionName, 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 Spark Job Definition. </summary> |
| | 119 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 120 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 121 | | public virtual async Task<Response> DeleteSparkJobDefinitionAsync(string sparkJobDefinitionName, CancellationTok |
| | 122 | | { |
| 0 | 123 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.DeleteSparkJobDefinition"); |
| 0 | 124 | | scope.Start(); |
| | 125 | | try |
| | 126 | | { |
| 0 | 127 | | return await RestClient.DeleteSparkJobDefinitionAsync(sparkJobDefinitionName, cancellationToken).Configu |
| | 128 | | } |
| 0 | 129 | | catch (Exception e) |
| | 130 | | { |
| 0 | 131 | | scope.Failed(e); |
| 0 | 132 | | throw; |
| | 133 | | } |
| 0 | 134 | | } |
| | 135 | |
|
| | 136 | | /// <summary> Deletes a Spark Job Definition. </summary> |
| | 137 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 138 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 139 | | public virtual Response DeleteSparkJobDefinition(string sparkJobDefinitionName, CancellationToken cancellationTo |
| | 140 | | { |
| 0 | 141 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.DeleteSparkJobDefinition"); |
| 0 | 142 | | scope.Start(); |
| | 143 | | try |
| | 144 | | { |
| 0 | 145 | | return RestClient.DeleteSparkJobDefinition(sparkJobDefinitionName, cancellationToken); |
| | 146 | | } |
| 0 | 147 | | catch (Exception e) |
| | 148 | | { |
| 0 | 149 | | scope.Failed(e); |
| 0 | 150 | | throw; |
| | 151 | | } |
| 0 | 152 | | } |
| | 153 | |
|
| | 154 | | /// <summary> Lists spark job definitions. </summary> |
| | 155 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 156 | | public virtual AsyncPageable<SparkJobDefinitionResource> GetSparkJobDefinitionsByWorkspaceAsync(CancellationToke |
| | 157 | | { |
| | 158 | | async Task<Page<SparkJobDefinitionResource>> FirstPageFunc(int? pageSizeHint) |
| | 159 | | { |
| 0 | 160 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinitionsByWorks |
| 0 | 161 | | scope.Start(); |
| | 162 | | try |
| | 163 | | { |
| 0 | 164 | | var response = await RestClient.GetSparkJobDefinitionsByWorkspaceAsync(cancellationToken).ConfigureA |
| 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<SparkJobDefinitionResource>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 174 | | { |
| 0 | 175 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinitionsByWorks |
| 0 | 176 | | scope.Start(); |
| | 177 | | try |
| | 178 | | { |
| 0 | 179 | | var response = await RestClient.GetSparkJobDefinitionsByWorkspaceNextPageAsync(nextLink, cancellatio |
| 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 spark job definitions. </summary> |
| | 192 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 193 | | public virtual Pageable<SparkJobDefinitionResource> GetSparkJobDefinitionsByWorkspace(CancellationToken cancella |
| | 194 | | { |
| | 195 | | Page<SparkJobDefinitionResource> FirstPageFunc(int? pageSizeHint) |
| | 196 | | { |
| 0 | 197 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinitionsByWorks |
| 0 | 198 | | scope.Start(); |
| | 199 | | try |
| | 200 | | { |
| 0 | 201 | | var response = RestClient.GetSparkJobDefinitionsByWorkspace(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<SparkJobDefinitionResource> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 211 | | { |
| 0 | 212 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinitionsByWorks |
| 0 | 213 | | scope.Start(); |
| | 214 | | try |
| | 215 | | { |
| 0 | 216 | | var response = RestClient.GetSparkJobDefinitionsByWorkspaceNextPage(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 | | /// <summary> Executes the spark job definition. </summary> |
| | 229 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 230 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 231 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception> |
| | 232 | | public virtual async Task<SparkJobDefinitionExecuteSparkJobDefinitionOperation> StartExecuteSparkJobDefinitionAs |
| | 233 | | { |
| 0 | 234 | | if (sparkJobDefinitionName == null) |
| | 235 | | { |
| 0 | 236 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 237 | | } |
| | 238 | |
|
| 0 | 239 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.StartExecuteSparkJobDefinition"); |
| 0 | 240 | | scope.Start(); |
| | 241 | | try |
| | 242 | | { |
| 0 | 243 | | var originalResponse = await RestClient.ExecuteSparkJobDefinitionAsync(sparkJobDefinitionName, cancellat |
| 0 | 244 | | return new SparkJobDefinitionExecuteSparkJobDefinitionOperation(_clientDiagnostics, _pipeline, RestClien |
| | 245 | | } |
| 0 | 246 | | catch (Exception e) |
| | 247 | | { |
| 0 | 248 | | scope.Failed(e); |
| 0 | 249 | | throw; |
| | 250 | | } |
| 0 | 251 | | } |
| | 252 | |
|
| | 253 | | /// <summary> Executes the spark job definition. </summary> |
| | 254 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 255 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 256 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception> |
| | 257 | | public virtual SparkJobDefinitionExecuteSparkJobDefinitionOperation StartExecuteSparkJobDefinition(string sparkJ |
| | 258 | | { |
| 0 | 259 | | if (sparkJobDefinitionName == null) |
| | 260 | | { |
| 0 | 261 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 262 | | } |
| | 263 | |
|
| 0 | 264 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.StartExecuteSparkJobDefinition"); |
| 0 | 265 | | scope.Start(); |
| | 266 | | try |
| | 267 | | { |
| 0 | 268 | | var originalResponse = RestClient.ExecuteSparkJobDefinition(sparkJobDefinitionName, cancellationToken); |
| 0 | 269 | | return new SparkJobDefinitionExecuteSparkJobDefinitionOperation(_clientDiagnostics, _pipeline, RestClien |
| | 270 | | } |
| 0 | 271 | | catch (Exception e) |
| | 272 | | { |
| 0 | 273 | | scope.Failed(e); |
| 0 | 274 | | throw; |
| | 275 | | } |
| 0 | 276 | | } |
| | 277 | |
|
| | 278 | | /// <summary> Debug the spark job definition. </summary> |
| | 279 | | /// <param name="sparkJobDefinitionAzureResource"> Spark Job Definition resource definition. </param> |
| | 280 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 281 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionAzureResource"/> is null. </excep |
| | 282 | | public virtual async Task<SparkJobDefinitionDebugSparkJobDefinitionOperation> StartDebugSparkJobDefinitionAsync( |
| | 283 | | { |
| 0 | 284 | | if (sparkJobDefinitionAzureResource == null) |
| | 285 | | { |
| 0 | 286 | | throw new ArgumentNullException(nameof(sparkJobDefinitionAzureResource)); |
| | 287 | | } |
| | 288 | |
|
| 0 | 289 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.StartDebugSparkJobDefinition"); |
| 0 | 290 | | scope.Start(); |
| | 291 | | try |
| | 292 | | { |
| 0 | 293 | | var originalResponse = await RestClient.DebugSparkJobDefinitionAsync(sparkJobDefinitionAzureResource, ca |
| 0 | 294 | | return new SparkJobDefinitionDebugSparkJobDefinitionOperation(_clientDiagnostics, _pipeline, RestClient. |
| | 295 | | } |
| 0 | 296 | | catch (Exception e) |
| | 297 | | { |
| 0 | 298 | | scope.Failed(e); |
| 0 | 299 | | throw; |
| | 300 | | } |
| 0 | 301 | | } |
| | 302 | |
|
| | 303 | | /// <summary> Debug the spark job definition. </summary> |
| | 304 | | /// <param name="sparkJobDefinitionAzureResource"> Spark Job Definition resource definition. </param> |
| | 305 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 306 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionAzureResource"/> is null. </excep |
| | 307 | | public virtual SparkJobDefinitionDebugSparkJobDefinitionOperation StartDebugSparkJobDefinition(SparkJobDefinitio |
| | 308 | | { |
| 0 | 309 | | if (sparkJobDefinitionAzureResource == null) |
| | 310 | | { |
| 0 | 311 | | throw new ArgumentNullException(nameof(sparkJobDefinitionAzureResource)); |
| | 312 | | } |
| | 313 | |
|
| 0 | 314 | | using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.StartDebugSparkJobDefinition"); |
| 0 | 315 | | scope.Start(); |
| | 316 | | try |
| | 317 | | { |
| 0 | 318 | | var originalResponse = RestClient.DebugSparkJobDefinition(sparkJobDefinitionAzureResource, cancellationT |
| 0 | 319 | | return new SparkJobDefinitionDebugSparkJobDefinitionOperation(_clientDiagnostics, _pipeline, RestClient. |
| | 320 | | } |
| 0 | 321 | | catch (Exception e) |
| | 322 | | { |
| 0 | 323 | | scope.Failed(e); |
| 0 | 324 | | throw; |
| | 325 | | } |
| 0 | 326 | | } |
| | 327 | | } |
| | 328 | | } |