| | 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.Text.Json; |
| | 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; |
| | 16 | |
|
| | 17 | | namespace Azure.Analytics.Synapse.Artifacts |
| | 18 | | { |
| | 19 | | internal partial class SparkJobDefinitionRestClient |
| | 20 | | { |
| | 21 | | private string endpoint; |
| | 22 | | private string apiVersion; |
| | 23 | | private ClientDiagnostics _clientDiagnostics; |
| | 24 | | private HttpPipeline _pipeline; |
| | 25 | |
|
| | 26 | | /// <summary> Initializes a new instance of SparkJobDefinitionRestClient. </summary> |
| | 27 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 28 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 29 | | /// <param name="endpoint"> The workspace development endpoint, for example https://myworkspace.dev.azuresynapse |
| | 30 | | /// <param name="apiVersion"> Api Version. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="apiVersion"/> is nul |
| 0 | 32 | | public SparkJobDefinitionRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, |
| | 33 | | { |
| 0 | 34 | | if (endpoint == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(endpoint)); |
| | 37 | | } |
| 0 | 38 | | if (apiVersion == null) |
| | 39 | | { |
| 0 | 40 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 41 | | } |
| | 42 | |
|
| 0 | 43 | | this.endpoint = endpoint; |
| 0 | 44 | | this.apiVersion = apiVersion; |
| 0 | 45 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 46 | | _pipeline = pipeline; |
| 0 | 47 | | } |
| | 48 | |
|
| | 49 | | internal HttpMessage CreateGetSparkJobDefinitionsByWorkspaceRequest() |
| | 50 | | { |
| 0 | 51 | | var message = _pipeline.CreateMessage(); |
| 0 | 52 | | var request = message.Request; |
| 0 | 53 | | request.Method = RequestMethod.Get; |
| 0 | 54 | | var uri = new RawRequestUriBuilder(); |
| 0 | 55 | | uri.AppendRaw(endpoint, false); |
| 0 | 56 | | uri.AppendPath("/sparkJobDefinitions", false); |
| 0 | 57 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 58 | | request.Uri = uri; |
| 0 | 59 | | return message; |
| | 60 | | } |
| | 61 | |
|
| | 62 | | /// <summary> Lists spark job definitions. </summary> |
| | 63 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 64 | | public async Task<Response<SparkJobDefinitionsListResponse>> GetSparkJobDefinitionsByWorkspaceAsync(Cancellation |
| | 65 | | { |
| 0 | 66 | | using var message = CreateGetSparkJobDefinitionsByWorkspaceRequest(); |
| 0 | 67 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 68 | | switch (message.Response.Status) |
| | 69 | | { |
| | 70 | | case 200: |
| | 71 | | { |
| | 72 | | SparkJobDefinitionsListResponse value = default; |
| 0 | 73 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 74 | | value = SparkJobDefinitionsListResponse.DeserializeSparkJobDefinitionsListResponse(document.Root |
| 0 | 75 | | return Response.FromValue(value, message.Response); |
| | 76 | | } |
| | 77 | | default: |
| 0 | 78 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 79 | | } |
| 0 | 80 | | } |
| | 81 | |
|
| | 82 | | /// <summary> Lists spark job definitions. </summary> |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public Response<SparkJobDefinitionsListResponse> GetSparkJobDefinitionsByWorkspace(CancellationToken cancellatio |
| | 85 | | { |
| 0 | 86 | | using var message = CreateGetSparkJobDefinitionsByWorkspaceRequest(); |
| 0 | 87 | | _pipeline.Send(message, cancellationToken); |
| 0 | 88 | | switch (message.Response.Status) |
| | 89 | | { |
| | 90 | | case 200: |
| | 91 | | { |
| | 92 | | SparkJobDefinitionsListResponse value = default; |
| 0 | 93 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 94 | | value = SparkJobDefinitionsListResponse.DeserializeSparkJobDefinitionsListResponse(document.Root |
| 0 | 95 | | return Response.FromValue(value, message.Response); |
| | 96 | | } |
| | 97 | | default: |
| 0 | 98 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 99 | | } |
| 0 | 100 | | } |
| | 101 | |
|
| | 102 | | internal HttpMessage CreateCreateOrUpdateSparkJobDefinitionRequest(string sparkJobDefinitionName, SparkJobDefini |
| | 103 | | { |
| 0 | 104 | | var message = _pipeline.CreateMessage(); |
| 0 | 105 | | var request = message.Request; |
| 0 | 106 | | request.Method = RequestMethod.Put; |
| 0 | 107 | | var uri = new RawRequestUriBuilder(); |
| 0 | 108 | | uri.AppendRaw(endpoint, false); |
| 0 | 109 | | uri.AppendPath("/sparkJobDefinitions/", false); |
| 0 | 110 | | uri.AppendPath(sparkJobDefinitionName, true); |
| 0 | 111 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 112 | | request.Uri = uri; |
| 0 | 113 | | if (ifMatch != null) |
| | 114 | | { |
| 0 | 115 | | request.Headers.Add("If-Match", ifMatch); |
| | 116 | | } |
| 0 | 117 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 118 | | var content = new Utf8JsonRequestContent(); |
| 0 | 119 | | content.JsonWriter.WriteObjectValue(sparkJobDefinition); |
| 0 | 120 | | request.Content = content; |
| 0 | 121 | | return message; |
| | 122 | | } |
| | 123 | |
|
| | 124 | | /// <summary> Creates or updates a Spark Job Definition. </summary> |
| | 125 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 126 | | /// <param name="sparkJobDefinition"> Spark Job Definition resource definition. </param> |
| | 127 | | /// <param name="ifMatch"> ETag of the Spark Job Definition entity. Should only be specified for update, for wh |
| | 128 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 129 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> or <paramref name="sparkJ |
| | 130 | | public async Task<Response<SparkJobDefinitionResource>> CreateOrUpdateSparkJobDefinitionAsync(string sparkJobDef |
| | 131 | | { |
| 0 | 132 | | if (sparkJobDefinitionName == null) |
| | 133 | | { |
| 0 | 134 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 135 | | } |
| 0 | 136 | | if (sparkJobDefinition == null) |
| | 137 | | { |
| 0 | 138 | | throw new ArgumentNullException(nameof(sparkJobDefinition)); |
| | 139 | | } |
| | 140 | |
|
| 0 | 141 | | using var message = CreateCreateOrUpdateSparkJobDefinitionRequest(sparkJobDefinitionName, sparkJobDefinition |
| 0 | 142 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 143 | | switch (message.Response.Status) |
| | 144 | | { |
| | 145 | | case 200: |
| | 146 | | { |
| | 147 | | SparkJobDefinitionResource value = default; |
| 0 | 148 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 149 | | value = SparkJobDefinitionResource.DeserializeSparkJobDefinitionResource(document.RootElement); |
| 0 | 150 | | return Response.FromValue(value, message.Response); |
| | 151 | | } |
| | 152 | | default: |
| 0 | 153 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 154 | | } |
| 0 | 155 | | } |
| | 156 | |
|
| | 157 | | /// <summary> Creates or updates a Spark Job Definition. </summary> |
| | 158 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 159 | | /// <param name="sparkJobDefinition"> Spark Job Definition resource definition. </param> |
| | 160 | | /// <param name="ifMatch"> ETag of the Spark Job Definition entity. Should only be specified for update, for wh |
| | 161 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 162 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> or <paramref name="sparkJ |
| | 163 | | public Response<SparkJobDefinitionResource> CreateOrUpdateSparkJobDefinition(string sparkJobDefinitionName, Spar |
| | 164 | | { |
| 0 | 165 | | if (sparkJobDefinitionName == null) |
| | 166 | | { |
| 0 | 167 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 168 | | } |
| 0 | 169 | | if (sparkJobDefinition == null) |
| | 170 | | { |
| 0 | 171 | | throw new ArgumentNullException(nameof(sparkJobDefinition)); |
| | 172 | | } |
| | 173 | |
|
| 0 | 174 | | using var message = CreateCreateOrUpdateSparkJobDefinitionRequest(sparkJobDefinitionName, sparkJobDefinition |
| 0 | 175 | | _pipeline.Send(message, cancellationToken); |
| 0 | 176 | | switch (message.Response.Status) |
| | 177 | | { |
| | 178 | | case 200: |
| | 179 | | { |
| | 180 | | SparkJobDefinitionResource value = default; |
| 0 | 181 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 182 | | value = SparkJobDefinitionResource.DeserializeSparkJobDefinitionResource(document.RootElement); |
| 0 | 183 | | return Response.FromValue(value, message.Response); |
| | 184 | | } |
| | 185 | | default: |
| 0 | 186 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 187 | | } |
| 0 | 188 | | } |
| | 189 | |
|
| | 190 | | internal HttpMessage CreateGetSparkJobDefinitionRequest(string sparkJobDefinitionName, string ifNoneMatch) |
| | 191 | | { |
| 0 | 192 | | var message = _pipeline.CreateMessage(); |
| 0 | 193 | | var request = message.Request; |
| 0 | 194 | | request.Method = RequestMethod.Get; |
| 0 | 195 | | var uri = new RawRequestUriBuilder(); |
| 0 | 196 | | uri.AppendRaw(endpoint, false); |
| 0 | 197 | | uri.AppendPath("/sparkJobDefinitions/", false); |
| 0 | 198 | | uri.AppendPath(sparkJobDefinitionName, true); |
| 0 | 199 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 200 | | request.Uri = uri; |
| 0 | 201 | | if (ifNoneMatch != null) |
| | 202 | | { |
| 0 | 203 | | request.Headers.Add("If-None-Match", ifNoneMatch); |
| | 204 | | } |
| 0 | 205 | | return message; |
| | 206 | | } |
| | 207 | |
|
| | 208 | | /// <summary> Gets a Spark Job Definition. </summary> |
| | 209 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 210 | | /// <param name="ifNoneMatch"> ETag of the Spark Job Definition entity. Should only be specified for get. If the |
| | 211 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 212 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception> |
| | 213 | | public async Task<Response<SparkJobDefinitionResource>> GetSparkJobDefinitionAsync(string sparkJobDefinitionName |
| | 214 | | { |
| 0 | 215 | | if (sparkJobDefinitionName == null) |
| | 216 | | { |
| 0 | 217 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 218 | | } |
| | 219 | |
|
| 0 | 220 | | using var message = CreateGetSparkJobDefinitionRequest(sparkJobDefinitionName, ifNoneMatch); |
| 0 | 221 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 222 | | switch (message.Response.Status) |
| | 223 | | { |
| | 224 | | case 200: |
| | 225 | | { |
| | 226 | | SparkJobDefinitionResource value = default; |
| 0 | 227 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 228 | | value = SparkJobDefinitionResource.DeserializeSparkJobDefinitionResource(document.RootElement); |
| 0 | 229 | | return Response.FromValue(value, message.Response); |
| | 230 | | } |
| | 231 | | case 304: |
| 0 | 232 | | return Response.FromValue<SparkJobDefinitionResource>(null, message.Response); |
| | 233 | | default: |
| 0 | 234 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 235 | | } |
| 0 | 236 | | } |
| | 237 | |
|
| | 238 | | /// <summary> Gets a Spark Job Definition. </summary> |
| | 239 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 240 | | /// <param name="ifNoneMatch"> ETag of the Spark Job Definition entity. Should only be specified for get. If the |
| | 241 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 242 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception> |
| | 243 | | public Response<SparkJobDefinitionResource> GetSparkJobDefinition(string sparkJobDefinitionName, string ifNoneMa |
| | 244 | | { |
| 0 | 245 | | if (sparkJobDefinitionName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 248 | | } |
| | 249 | |
|
| 0 | 250 | | using var message = CreateGetSparkJobDefinitionRequest(sparkJobDefinitionName, ifNoneMatch); |
| 0 | 251 | | _pipeline.Send(message, cancellationToken); |
| 0 | 252 | | switch (message.Response.Status) |
| | 253 | | { |
| | 254 | | case 200: |
| | 255 | | { |
| | 256 | | SparkJobDefinitionResource value = default; |
| 0 | 257 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 258 | | value = SparkJobDefinitionResource.DeserializeSparkJobDefinitionResource(document.RootElement); |
| 0 | 259 | | return Response.FromValue(value, message.Response); |
| | 260 | | } |
| | 261 | | case 304: |
| 0 | 262 | | return Response.FromValue<SparkJobDefinitionResource>(null, message.Response); |
| | 263 | | default: |
| 0 | 264 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 265 | | } |
| 0 | 266 | | } |
| | 267 | |
|
| | 268 | | internal HttpMessage CreateDeleteSparkJobDefinitionRequest(string sparkJobDefinitionName) |
| | 269 | | { |
| 0 | 270 | | var message = _pipeline.CreateMessage(); |
| 0 | 271 | | var request = message.Request; |
| 0 | 272 | | request.Method = RequestMethod.Delete; |
| 0 | 273 | | var uri = new RawRequestUriBuilder(); |
| 0 | 274 | | uri.AppendRaw(endpoint, false); |
| 0 | 275 | | uri.AppendPath("/sparkJobDefinitions/", false); |
| 0 | 276 | | uri.AppendPath(sparkJobDefinitionName, true); |
| 0 | 277 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 278 | | request.Uri = uri; |
| 0 | 279 | | return message; |
| | 280 | | } |
| | 281 | |
|
| | 282 | | /// <summary> Deletes a Spark Job Definition. </summary> |
| | 283 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 284 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 285 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception> |
| | 286 | | public async Task<Response> DeleteSparkJobDefinitionAsync(string sparkJobDefinitionName, CancellationToken cance |
| | 287 | | { |
| 0 | 288 | | if (sparkJobDefinitionName == null) |
| | 289 | | { |
| 0 | 290 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 291 | | } |
| | 292 | |
|
| 0 | 293 | | using var message = CreateDeleteSparkJobDefinitionRequest(sparkJobDefinitionName); |
| 0 | 294 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 295 | | switch (message.Response.Status) |
| | 296 | | { |
| | 297 | | case 200: |
| | 298 | | case 204: |
| 0 | 299 | | return message.Response; |
| | 300 | | default: |
| 0 | 301 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 302 | | } |
| 0 | 303 | | } |
| | 304 | |
|
| | 305 | | /// <summary> Deletes a Spark Job Definition. </summary> |
| | 306 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 307 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 308 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception> |
| | 309 | | public Response DeleteSparkJobDefinition(string sparkJobDefinitionName, CancellationToken cancellationToken = de |
| | 310 | | { |
| 0 | 311 | | if (sparkJobDefinitionName == null) |
| | 312 | | { |
| 0 | 313 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 314 | | } |
| | 315 | |
|
| 0 | 316 | | using var message = CreateDeleteSparkJobDefinitionRequest(sparkJobDefinitionName); |
| 0 | 317 | | _pipeline.Send(message, cancellationToken); |
| 0 | 318 | | switch (message.Response.Status) |
| | 319 | | { |
| | 320 | | case 200: |
| | 321 | | case 204: |
| 0 | 322 | | return message.Response; |
| | 323 | | default: |
| 0 | 324 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 325 | | } |
| 0 | 326 | | } |
| | 327 | |
|
| | 328 | | internal HttpMessage CreateExecuteSparkJobDefinitionRequest(string sparkJobDefinitionName) |
| | 329 | | { |
| 0 | 330 | | var message = _pipeline.CreateMessage(); |
| 0 | 331 | | var request = message.Request; |
| 0 | 332 | | request.Method = RequestMethod.Post; |
| 0 | 333 | | var uri = new RawRequestUriBuilder(); |
| 0 | 334 | | uri.AppendRaw(endpoint, false); |
| 0 | 335 | | uri.AppendPath("/sparkJobDefinitions/", false); |
| 0 | 336 | | uri.AppendPath(sparkJobDefinitionName, true); |
| 0 | 337 | | uri.AppendPath("/execute", false); |
| 0 | 338 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 339 | | request.Uri = uri; |
| 0 | 340 | | return message; |
| | 341 | | } |
| | 342 | |
|
| | 343 | | /// <summary> Executes the spark job definition. </summary> |
| | 344 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 345 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 346 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception> |
| | 347 | | public async Task<Response> ExecuteSparkJobDefinitionAsync(string sparkJobDefinitionName, CancellationToken canc |
| | 348 | | { |
| 0 | 349 | | if (sparkJobDefinitionName == null) |
| | 350 | | { |
| 0 | 351 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 352 | | } |
| | 353 | |
|
| 0 | 354 | | using var message = CreateExecuteSparkJobDefinitionRequest(sparkJobDefinitionName); |
| 0 | 355 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 356 | | switch (message.Response.Status) |
| | 357 | | { |
| | 358 | | case 200: |
| | 359 | | case 202: |
| 0 | 360 | | return message.Response; |
| | 361 | | default: |
| 0 | 362 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 363 | | } |
| 0 | 364 | | } |
| | 365 | |
|
| | 366 | | /// <summary> Executes the spark job definition. </summary> |
| | 367 | | /// <param name="sparkJobDefinitionName"> The spark job definition name. </param> |
| | 368 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 369 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception> |
| | 370 | | public Response ExecuteSparkJobDefinition(string sparkJobDefinitionName, CancellationToken cancellationToken = d |
| | 371 | | { |
| 0 | 372 | | if (sparkJobDefinitionName == null) |
| | 373 | | { |
| 0 | 374 | | throw new ArgumentNullException(nameof(sparkJobDefinitionName)); |
| | 375 | | } |
| | 376 | |
|
| 0 | 377 | | using var message = CreateExecuteSparkJobDefinitionRequest(sparkJobDefinitionName); |
| 0 | 378 | | _pipeline.Send(message, cancellationToken); |
| 0 | 379 | | switch (message.Response.Status) |
| | 380 | | { |
| | 381 | | case 200: |
| | 382 | | case 202: |
| 0 | 383 | | return message.Response; |
| | 384 | | default: |
| 0 | 385 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 386 | | } |
| 0 | 387 | | } |
| | 388 | |
|
| | 389 | | internal HttpMessage CreateDebugSparkJobDefinitionRequest(SparkJobDefinitionResource sparkJobDefinitionAzureReso |
| | 390 | | { |
| 0 | 391 | | var message = _pipeline.CreateMessage(); |
| 0 | 392 | | var request = message.Request; |
| 0 | 393 | | request.Method = RequestMethod.Post; |
| 0 | 394 | | var uri = new RawRequestUriBuilder(); |
| 0 | 395 | | uri.AppendRaw(endpoint, false); |
| 0 | 396 | | uri.AppendPath("/debugSparkJobDefinition", false); |
| 0 | 397 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 398 | | request.Uri = uri; |
| 0 | 399 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 400 | | var content = new Utf8JsonRequestContent(); |
| 0 | 401 | | content.JsonWriter.WriteObjectValue(sparkJobDefinitionAzureResource); |
| 0 | 402 | | request.Content = content; |
| 0 | 403 | | return message; |
| | 404 | | } |
| | 405 | |
|
| | 406 | | /// <summary> Debug the spark job definition. </summary> |
| | 407 | | /// <param name="sparkJobDefinitionAzureResource"> Spark Job Definition resource definition. </param> |
| | 408 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 409 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionAzureResource"/> is null. </excep |
| | 410 | | public async Task<Response> DebugSparkJobDefinitionAsync(SparkJobDefinitionResource sparkJobDefinitionAzureResou |
| | 411 | | { |
| 0 | 412 | | if (sparkJobDefinitionAzureResource == null) |
| | 413 | | { |
| 0 | 414 | | throw new ArgumentNullException(nameof(sparkJobDefinitionAzureResource)); |
| | 415 | | } |
| | 416 | |
|
| 0 | 417 | | using var message = CreateDebugSparkJobDefinitionRequest(sparkJobDefinitionAzureResource); |
| 0 | 418 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 419 | | switch (message.Response.Status) |
| | 420 | | { |
| | 421 | | case 200: |
| | 422 | | case 202: |
| 0 | 423 | | return message.Response; |
| | 424 | | default: |
| 0 | 425 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 426 | | } |
| 0 | 427 | | } |
| | 428 | |
|
| | 429 | | /// <summary> Debug the spark job definition. </summary> |
| | 430 | | /// <param name="sparkJobDefinitionAzureResource"> Spark Job Definition resource definition. </param> |
| | 431 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 432 | | /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionAzureResource"/> is null. </excep |
| | 433 | | public Response DebugSparkJobDefinition(SparkJobDefinitionResource sparkJobDefinitionAzureResource, Cancellation |
| | 434 | | { |
| 0 | 435 | | if (sparkJobDefinitionAzureResource == null) |
| | 436 | | { |
| 0 | 437 | | throw new ArgumentNullException(nameof(sparkJobDefinitionAzureResource)); |
| | 438 | | } |
| | 439 | |
|
| 0 | 440 | | using var message = CreateDebugSparkJobDefinitionRequest(sparkJobDefinitionAzureResource); |
| 0 | 441 | | _pipeline.Send(message, cancellationToken); |
| 0 | 442 | | switch (message.Response.Status) |
| | 443 | | { |
| | 444 | | case 200: |
| | 445 | | case 202: |
| 0 | 446 | | return message.Response; |
| | 447 | | default: |
| 0 | 448 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 449 | | } |
| 0 | 450 | | } |
| | 451 | |
|
| | 452 | | internal HttpMessage CreateGetSparkJobDefinitionsByWorkspaceNextPageRequest(string nextLink) |
| | 453 | | { |
| 0 | 454 | | var message = _pipeline.CreateMessage(); |
| 0 | 455 | | var request = message.Request; |
| 0 | 456 | | request.Method = RequestMethod.Get; |
| 0 | 457 | | var uri = new RawRequestUriBuilder(); |
| 0 | 458 | | uri.AppendRaw(endpoint, false); |
| 0 | 459 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 460 | | request.Uri = uri; |
| 0 | 461 | | return message; |
| | 462 | | } |
| | 463 | |
|
| | 464 | | /// <summary> Lists spark job definitions. </summary> |
| | 465 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 466 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 467 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 468 | | public async Task<Response<SparkJobDefinitionsListResponse>> GetSparkJobDefinitionsByWorkspaceNextPageAsync(stri |
| | 469 | | { |
| 0 | 470 | | if (nextLink == null) |
| | 471 | | { |
| 0 | 472 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 473 | | } |
| | 474 | |
|
| 0 | 475 | | using var message = CreateGetSparkJobDefinitionsByWorkspaceNextPageRequest(nextLink); |
| 0 | 476 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 477 | | switch (message.Response.Status) |
| | 478 | | { |
| | 479 | | case 200: |
| | 480 | | { |
| | 481 | | SparkJobDefinitionsListResponse value = default; |
| 0 | 482 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 483 | | value = SparkJobDefinitionsListResponse.DeserializeSparkJobDefinitionsListResponse(document.Root |
| 0 | 484 | | return Response.FromValue(value, message.Response); |
| | 485 | | } |
| | 486 | | default: |
| 0 | 487 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 488 | | } |
| 0 | 489 | | } |
| | 490 | |
|
| | 491 | | /// <summary> Lists spark job definitions. </summary> |
| | 492 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 493 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 494 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 495 | | public Response<SparkJobDefinitionsListResponse> GetSparkJobDefinitionsByWorkspaceNextPage(string nextLink, Canc |
| | 496 | | { |
| 0 | 497 | | if (nextLink == null) |
| | 498 | | { |
| 0 | 499 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 500 | | } |
| | 501 | |
|
| 0 | 502 | | using var message = CreateGetSparkJobDefinitionsByWorkspaceNextPageRequest(nextLink); |
| 0 | 503 | | _pipeline.Send(message, cancellationToken); |
| 0 | 504 | | switch (message.Response.Status) |
| | 505 | | { |
| | 506 | | case 200: |
| | 507 | | { |
| | 508 | | SparkJobDefinitionsListResponse value = default; |
| 0 | 509 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 510 | | value = SparkJobDefinitionsListResponse.DeserializeSparkJobDefinitionsListResponse(document.Root |
| 0 | 511 | | return Response.FromValue(value, message.Response); |
| | 512 | | } |
| | 513 | | default: |
| 0 | 514 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 515 | | } |
| 0 | 516 | | } |
| | 517 | | } |
| | 518 | | } |