1package batch
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"github.com/Azure/go-autorest/autorest"
12	"github.com/Azure/go-autorest/autorest/azure"
13	"github.com/Azure/go-autorest/autorest/date"
14	"github.com/Azure/go-autorest/autorest/validation"
15	"github.com/Azure/go-autorest/tracing"
16	"github.com/gofrs/uuid"
17	"net/http"
18)
19
20// ComputeNodeClient is the a client for issuing REST requests to the Azure Batch service.
21type ComputeNodeClient struct {
22	BaseClient
23}
24
25// NewComputeNodeClient creates an instance of the ComputeNodeClient client.
26func NewComputeNodeClient(batchURL string) ComputeNodeClient {
27	return ComputeNodeClient{New(batchURL)}
28}
29
30// AddUser you can add a user account to a node only when it is in the idle or running state.
31// Parameters:
32// poolID - the ID of the pool that contains the compute node.
33// nodeID - the ID of the machine on which you want to create a user account.
34// userParameter - the user account to be created.
35// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
36// seconds.
37// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
38// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
39// returnClientRequestID - whether the server should return the client-request-id in the response.
40// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
41// time; set it explicitly if you are calling the REST API directly.
42func (client ComputeNodeClient) AddUser(ctx context.Context, poolID string, nodeID string, userParameter ComputeNodeUser, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) {
43	if tracing.IsEnabled() {
44		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.AddUser")
45		defer func() {
46			sc := -1
47			if result.Response != nil {
48				sc = result.Response.StatusCode
49			}
50			tracing.EndSpan(ctx, sc, err)
51		}()
52	}
53	if err := validation.Validate([]validation.Validation{
54		{TargetValue: userParameter,
55			Constraints: []validation.Constraint{{Target: "userParameter.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
56		return result, validation.NewError("batch.ComputeNodeClient", "AddUser", err.Error())
57	}
58
59	req, err := client.AddUserPreparer(ctx, poolID, nodeID, userParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
60	if err != nil {
61		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "AddUser", nil, "Failure preparing request")
62		return
63	}
64
65	resp, err := client.AddUserSender(req)
66	if err != nil {
67		result.Response = resp
68		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "AddUser", resp, "Failure sending request")
69		return
70	}
71
72	result, err = client.AddUserResponder(resp)
73	if err != nil {
74		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "AddUser", resp, "Failure responding to request")
75		return
76	}
77
78	return
79}
80
81// AddUserPreparer prepares the AddUser request.
82func (client ComputeNodeClient) AddUserPreparer(ctx context.Context, poolID string, nodeID string, userParameter ComputeNodeUser, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
83	urlParameters := map[string]interface{}{
84		"batchUrl": client.BatchURL,
85	}
86
87	pathParameters := map[string]interface{}{
88		"nodeId": autorest.Encode("path", nodeID),
89		"poolId": autorest.Encode("path", poolID),
90	}
91
92	const APIVersion = "2018-12-01.8.0"
93	queryParameters := map[string]interface{}{
94		"api-version": APIVersion,
95	}
96	if timeout != nil {
97		queryParameters["timeout"] = autorest.Encode("query", *timeout)
98	} else {
99		queryParameters["timeout"] = autorest.Encode("query", 30)
100	}
101
102	preparer := autorest.CreatePreparer(
103		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
104		autorest.AsPost(),
105		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
106		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/users", pathParameters),
107		autorest.WithJSON(userParameter),
108		autorest.WithQueryParameters(queryParameters))
109	if clientRequestID != nil {
110		preparer = autorest.DecoratePreparer(preparer,
111			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
112	}
113	if returnClientRequestID != nil {
114		preparer = autorest.DecoratePreparer(preparer,
115			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
116	} else {
117		preparer = autorest.DecoratePreparer(preparer,
118			autorest.WithHeader("return-client-request-id", autorest.String(false)))
119	}
120	if ocpDate != nil {
121		preparer = autorest.DecoratePreparer(preparer,
122			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
123	}
124	return preparer.Prepare((&http.Request{}).WithContext(ctx))
125}
126
127// AddUserSender sends the AddUser request. The method will close the
128// http.Response Body if it receives an error.
129func (client ComputeNodeClient) AddUserSender(req *http.Request) (*http.Response, error) {
130	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
131}
132
133// AddUserResponder handles the response to the AddUser request. The method always
134// closes the http.Response Body.
135func (client ComputeNodeClient) AddUserResponder(resp *http.Response) (result autorest.Response, err error) {
136	err = autorest.Respond(
137		resp,
138		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
139		autorest.ByClosing())
140	result.Response = resp
141	return
142}
143
144// DeleteUser you can delete a user account to a node only when it is in the idle or running state.
145// Parameters:
146// poolID - the ID of the pool that contains the compute node.
147// nodeID - the ID of the machine on which you want to delete a user account.
148// userName - the name of the user account to delete.
149// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
150// seconds.
151// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
152// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
153// returnClientRequestID - whether the server should return the client-request-id in the response.
154// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
155// time; set it explicitly if you are calling the REST API directly.
156func (client ComputeNodeClient) DeleteUser(ctx context.Context, poolID string, nodeID string, userName string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) {
157	if tracing.IsEnabled() {
158		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.DeleteUser")
159		defer func() {
160			sc := -1
161			if result.Response != nil {
162				sc = result.Response.StatusCode
163			}
164			tracing.EndSpan(ctx, sc, err)
165		}()
166	}
167	req, err := client.DeleteUserPreparer(ctx, poolID, nodeID, userName, timeout, clientRequestID, returnClientRequestID, ocpDate)
168	if err != nil {
169		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DeleteUser", nil, "Failure preparing request")
170		return
171	}
172
173	resp, err := client.DeleteUserSender(req)
174	if err != nil {
175		result.Response = resp
176		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DeleteUser", resp, "Failure sending request")
177		return
178	}
179
180	result, err = client.DeleteUserResponder(resp)
181	if err != nil {
182		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DeleteUser", resp, "Failure responding to request")
183		return
184	}
185
186	return
187}
188
189// DeleteUserPreparer prepares the DeleteUser request.
190func (client ComputeNodeClient) DeleteUserPreparer(ctx context.Context, poolID string, nodeID string, userName string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
191	urlParameters := map[string]interface{}{
192		"batchUrl": client.BatchURL,
193	}
194
195	pathParameters := map[string]interface{}{
196		"nodeId":   autorest.Encode("path", nodeID),
197		"poolId":   autorest.Encode("path", poolID),
198		"userName": autorest.Encode("path", userName),
199	}
200
201	const APIVersion = "2018-12-01.8.0"
202	queryParameters := map[string]interface{}{
203		"api-version": APIVersion,
204	}
205	if timeout != nil {
206		queryParameters["timeout"] = autorest.Encode("query", *timeout)
207	} else {
208		queryParameters["timeout"] = autorest.Encode("query", 30)
209	}
210
211	preparer := autorest.CreatePreparer(
212		autorest.AsDelete(),
213		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
214		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/users/{userName}", pathParameters),
215		autorest.WithQueryParameters(queryParameters))
216	if clientRequestID != nil {
217		preparer = autorest.DecoratePreparer(preparer,
218			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
219	}
220	if returnClientRequestID != nil {
221		preparer = autorest.DecoratePreparer(preparer,
222			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
223	} else {
224		preparer = autorest.DecoratePreparer(preparer,
225			autorest.WithHeader("return-client-request-id", autorest.String(false)))
226	}
227	if ocpDate != nil {
228		preparer = autorest.DecoratePreparer(preparer,
229			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
230	}
231	return preparer.Prepare((&http.Request{}).WithContext(ctx))
232}
233
234// DeleteUserSender sends the DeleteUser request. The method will close the
235// http.Response Body if it receives an error.
236func (client ComputeNodeClient) DeleteUserSender(req *http.Request) (*http.Response, error) {
237	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
238}
239
240// DeleteUserResponder handles the response to the DeleteUser request. The method always
241// closes the http.Response Body.
242func (client ComputeNodeClient) DeleteUserResponder(resp *http.Response) (result autorest.Response, err error) {
243	err = autorest.Respond(
244		resp,
245		azure.WithErrorUnlessStatusCode(http.StatusOK),
246		autorest.ByClosing())
247	result.Response = resp
248	return
249}
250
251// DisableScheduling you can disable task scheduling on a node only if its current scheduling state is enabled.
252// Parameters:
253// poolID - the ID of the pool that contains the compute node.
254// nodeID - the ID of the compute node on which you want to disable task scheduling.
255// nodeDisableSchedulingParameter - the parameters for the request.
256// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
257// seconds.
258// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
259// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
260// returnClientRequestID - whether the server should return the client-request-id in the response.
261// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
262// time; set it explicitly if you are calling the REST API directly.
263func (client ComputeNodeClient) DisableScheduling(ctx context.Context, poolID string, nodeID string, nodeDisableSchedulingParameter *NodeDisableSchedulingParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) {
264	if tracing.IsEnabled() {
265		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.DisableScheduling")
266		defer func() {
267			sc := -1
268			if result.Response != nil {
269				sc = result.Response.StatusCode
270			}
271			tracing.EndSpan(ctx, sc, err)
272		}()
273	}
274	req, err := client.DisableSchedulingPreparer(ctx, poolID, nodeID, nodeDisableSchedulingParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
275	if err != nil {
276		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DisableScheduling", nil, "Failure preparing request")
277		return
278	}
279
280	resp, err := client.DisableSchedulingSender(req)
281	if err != nil {
282		result.Response = resp
283		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DisableScheduling", resp, "Failure sending request")
284		return
285	}
286
287	result, err = client.DisableSchedulingResponder(resp)
288	if err != nil {
289		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DisableScheduling", resp, "Failure responding to request")
290		return
291	}
292
293	return
294}
295
296// DisableSchedulingPreparer prepares the DisableScheduling request.
297func (client ComputeNodeClient) DisableSchedulingPreparer(ctx context.Context, poolID string, nodeID string, nodeDisableSchedulingParameter *NodeDisableSchedulingParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
298	urlParameters := map[string]interface{}{
299		"batchUrl": client.BatchURL,
300	}
301
302	pathParameters := map[string]interface{}{
303		"nodeId": autorest.Encode("path", nodeID),
304		"poolId": autorest.Encode("path", poolID),
305	}
306
307	const APIVersion = "2018-12-01.8.0"
308	queryParameters := map[string]interface{}{
309		"api-version": APIVersion,
310	}
311	if timeout != nil {
312		queryParameters["timeout"] = autorest.Encode("query", *timeout)
313	} else {
314		queryParameters["timeout"] = autorest.Encode("query", 30)
315	}
316
317	preparer := autorest.CreatePreparer(
318		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
319		autorest.AsPost(),
320		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
321		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/disablescheduling", pathParameters),
322		autorest.WithQueryParameters(queryParameters))
323	if nodeDisableSchedulingParameter != nil {
324		preparer = autorest.DecoratePreparer(preparer,
325			autorest.WithJSON(nodeDisableSchedulingParameter))
326	}
327	if clientRequestID != nil {
328		preparer = autorest.DecoratePreparer(preparer,
329			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
330	}
331	if returnClientRequestID != nil {
332		preparer = autorest.DecoratePreparer(preparer,
333			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
334	} else {
335		preparer = autorest.DecoratePreparer(preparer,
336			autorest.WithHeader("return-client-request-id", autorest.String(false)))
337	}
338	if ocpDate != nil {
339		preparer = autorest.DecoratePreparer(preparer,
340			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
341	}
342	return preparer.Prepare((&http.Request{}).WithContext(ctx))
343}
344
345// DisableSchedulingSender sends the DisableScheduling request. The method will close the
346// http.Response Body if it receives an error.
347func (client ComputeNodeClient) DisableSchedulingSender(req *http.Request) (*http.Response, error) {
348	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
349}
350
351// DisableSchedulingResponder handles the response to the DisableScheduling request. The method always
352// closes the http.Response Body.
353func (client ComputeNodeClient) DisableSchedulingResponder(resp *http.Response) (result autorest.Response, err error) {
354	err = autorest.Respond(
355		resp,
356		azure.WithErrorUnlessStatusCode(http.StatusOK),
357		autorest.ByClosing())
358	result.Response = resp
359	return
360}
361
362// EnableScheduling you can enable task scheduling on a node only if its current scheduling state is disabled
363// Parameters:
364// poolID - the ID of the pool that contains the compute node.
365// nodeID - the ID of the compute node on which you want to enable task scheduling.
366// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
367// seconds.
368// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
369// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
370// returnClientRequestID - whether the server should return the client-request-id in the response.
371// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
372// time; set it explicitly if you are calling the REST API directly.
373func (client ComputeNodeClient) EnableScheduling(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) {
374	if tracing.IsEnabled() {
375		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.EnableScheduling")
376		defer func() {
377			sc := -1
378			if result.Response != nil {
379				sc = result.Response.StatusCode
380			}
381			tracing.EndSpan(ctx, sc, err)
382		}()
383	}
384	req, err := client.EnableSchedulingPreparer(ctx, poolID, nodeID, timeout, clientRequestID, returnClientRequestID, ocpDate)
385	if err != nil {
386		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "EnableScheduling", nil, "Failure preparing request")
387		return
388	}
389
390	resp, err := client.EnableSchedulingSender(req)
391	if err != nil {
392		result.Response = resp
393		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "EnableScheduling", resp, "Failure sending request")
394		return
395	}
396
397	result, err = client.EnableSchedulingResponder(resp)
398	if err != nil {
399		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "EnableScheduling", resp, "Failure responding to request")
400		return
401	}
402
403	return
404}
405
406// EnableSchedulingPreparer prepares the EnableScheduling request.
407func (client ComputeNodeClient) EnableSchedulingPreparer(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
408	urlParameters := map[string]interface{}{
409		"batchUrl": client.BatchURL,
410	}
411
412	pathParameters := map[string]interface{}{
413		"nodeId": autorest.Encode("path", nodeID),
414		"poolId": autorest.Encode("path", poolID),
415	}
416
417	const APIVersion = "2018-12-01.8.0"
418	queryParameters := map[string]interface{}{
419		"api-version": APIVersion,
420	}
421	if timeout != nil {
422		queryParameters["timeout"] = autorest.Encode("query", *timeout)
423	} else {
424		queryParameters["timeout"] = autorest.Encode("query", 30)
425	}
426
427	preparer := autorest.CreatePreparer(
428		autorest.AsPost(),
429		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
430		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/enablescheduling", pathParameters),
431		autorest.WithQueryParameters(queryParameters))
432	if clientRequestID != nil {
433		preparer = autorest.DecoratePreparer(preparer,
434			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
435	}
436	if returnClientRequestID != nil {
437		preparer = autorest.DecoratePreparer(preparer,
438			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
439	} else {
440		preparer = autorest.DecoratePreparer(preparer,
441			autorest.WithHeader("return-client-request-id", autorest.String(false)))
442	}
443	if ocpDate != nil {
444		preparer = autorest.DecoratePreparer(preparer,
445			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
446	}
447	return preparer.Prepare((&http.Request{}).WithContext(ctx))
448}
449
450// EnableSchedulingSender sends the EnableScheduling request. The method will close the
451// http.Response Body if it receives an error.
452func (client ComputeNodeClient) EnableSchedulingSender(req *http.Request) (*http.Response, error) {
453	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
454}
455
456// EnableSchedulingResponder handles the response to the EnableScheduling request. The method always
457// closes the http.Response Body.
458func (client ComputeNodeClient) EnableSchedulingResponder(resp *http.Response) (result autorest.Response, err error) {
459	err = autorest.Respond(
460		resp,
461		azure.WithErrorUnlessStatusCode(http.StatusOK),
462		autorest.ByClosing())
463	result.Response = resp
464	return
465}
466
467// Get sends the get request.
468// Parameters:
469// poolID - the ID of the pool that contains the compute node.
470// nodeID - the ID of the compute node that you want to get information about.
471// selectParameter - an OData $select clause.
472// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
473// seconds.
474// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
475// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
476// returnClientRequestID - whether the server should return the client-request-id in the response.
477// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
478// time; set it explicitly if you are calling the REST API directly.
479func (client ComputeNodeClient) Get(ctx context.Context, poolID string, nodeID string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ComputeNode, err error) {
480	if tracing.IsEnabled() {
481		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.Get")
482		defer func() {
483			sc := -1
484			if result.Response.Response != nil {
485				sc = result.Response.Response.StatusCode
486			}
487			tracing.EndSpan(ctx, sc, err)
488		}()
489	}
490	req, err := client.GetPreparer(ctx, poolID, nodeID, selectParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
491	if err != nil {
492		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Get", nil, "Failure preparing request")
493		return
494	}
495
496	resp, err := client.GetSender(req)
497	if err != nil {
498		result.Response = autorest.Response{Response: resp}
499		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Get", resp, "Failure sending request")
500		return
501	}
502
503	result, err = client.GetResponder(resp)
504	if err != nil {
505		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Get", resp, "Failure responding to request")
506		return
507	}
508
509	return
510}
511
512// GetPreparer prepares the Get request.
513func (client ComputeNodeClient) GetPreparer(ctx context.Context, poolID string, nodeID string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
514	urlParameters := map[string]interface{}{
515		"batchUrl": client.BatchURL,
516	}
517
518	pathParameters := map[string]interface{}{
519		"nodeId": autorest.Encode("path", nodeID),
520		"poolId": autorest.Encode("path", poolID),
521	}
522
523	const APIVersion = "2018-12-01.8.0"
524	queryParameters := map[string]interface{}{
525		"api-version": APIVersion,
526	}
527	if len(selectParameter) > 0 {
528		queryParameters["$select"] = autorest.Encode("query", selectParameter)
529	}
530	if timeout != nil {
531		queryParameters["timeout"] = autorest.Encode("query", *timeout)
532	} else {
533		queryParameters["timeout"] = autorest.Encode("query", 30)
534	}
535
536	preparer := autorest.CreatePreparer(
537		autorest.AsGet(),
538		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
539		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}", pathParameters),
540		autorest.WithQueryParameters(queryParameters))
541	if clientRequestID != nil {
542		preparer = autorest.DecoratePreparer(preparer,
543			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
544	}
545	if returnClientRequestID != nil {
546		preparer = autorest.DecoratePreparer(preparer,
547			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
548	} else {
549		preparer = autorest.DecoratePreparer(preparer,
550			autorest.WithHeader("return-client-request-id", autorest.String(false)))
551	}
552	if ocpDate != nil {
553		preparer = autorest.DecoratePreparer(preparer,
554			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
555	}
556	return preparer.Prepare((&http.Request{}).WithContext(ctx))
557}
558
559// GetSender sends the Get request. The method will close the
560// http.Response Body if it receives an error.
561func (client ComputeNodeClient) GetSender(req *http.Request) (*http.Response, error) {
562	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
563}
564
565// GetResponder handles the response to the Get request. The method always
566// closes the http.Response Body.
567func (client ComputeNodeClient) GetResponder(resp *http.Response) (result ComputeNode, err error) {
568	err = autorest.Respond(
569		resp,
570		azure.WithErrorUnlessStatusCode(http.StatusOK),
571		autorest.ByUnmarshallingJSON(&result),
572		autorest.ByClosing())
573	result.Response = autorest.Response{Response: resp}
574	return
575}
576
577// GetRemoteDesktop before you can access a node by using the RDP file, you must create a user account on the node.
578// This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual
579// machine configuration, see the GetRemoteLoginSettings API.
580// Parameters:
581// poolID - the ID of the pool that contains the compute node.
582// nodeID - the ID of the compute node for which you want to get the Remote Desktop Protocol file.
583// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
584// seconds.
585// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
586// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
587// returnClientRequestID - whether the server should return the client-request-id in the response.
588// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
589// time; set it explicitly if you are calling the REST API directly.
590func (client ComputeNodeClient) GetRemoteDesktop(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ReadCloser, err error) {
591	if tracing.IsEnabled() {
592		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.GetRemoteDesktop")
593		defer func() {
594			sc := -1
595			if result.Response.Response != nil {
596				sc = result.Response.Response.StatusCode
597			}
598			tracing.EndSpan(ctx, sc, err)
599		}()
600	}
601	req, err := client.GetRemoteDesktopPreparer(ctx, poolID, nodeID, timeout, clientRequestID, returnClientRequestID, ocpDate)
602	if err != nil {
603		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteDesktop", nil, "Failure preparing request")
604		return
605	}
606
607	resp, err := client.GetRemoteDesktopSender(req)
608	if err != nil {
609		result.Response = autorest.Response{Response: resp}
610		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteDesktop", resp, "Failure sending request")
611		return
612	}
613
614	result, err = client.GetRemoteDesktopResponder(resp)
615	if err != nil {
616		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteDesktop", resp, "Failure responding to request")
617		return
618	}
619
620	return
621}
622
623// GetRemoteDesktopPreparer prepares the GetRemoteDesktop request.
624func (client ComputeNodeClient) GetRemoteDesktopPreparer(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
625	urlParameters := map[string]interface{}{
626		"batchUrl": client.BatchURL,
627	}
628
629	pathParameters := map[string]interface{}{
630		"nodeId": autorest.Encode("path", nodeID),
631		"poolId": autorest.Encode("path", poolID),
632	}
633
634	const APIVersion = "2018-12-01.8.0"
635	queryParameters := map[string]interface{}{
636		"api-version": APIVersion,
637	}
638	if timeout != nil {
639		queryParameters["timeout"] = autorest.Encode("query", *timeout)
640	} else {
641		queryParameters["timeout"] = autorest.Encode("query", 30)
642	}
643
644	preparer := autorest.CreatePreparer(
645		autorest.AsGet(),
646		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
647		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/rdp", pathParameters),
648		autorest.WithQueryParameters(queryParameters))
649	if clientRequestID != nil {
650		preparer = autorest.DecoratePreparer(preparer,
651			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
652	}
653	if returnClientRequestID != nil {
654		preparer = autorest.DecoratePreparer(preparer,
655			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
656	} else {
657		preparer = autorest.DecoratePreparer(preparer,
658			autorest.WithHeader("return-client-request-id", autorest.String(false)))
659	}
660	if ocpDate != nil {
661		preparer = autorest.DecoratePreparer(preparer,
662			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
663	}
664	return preparer.Prepare((&http.Request{}).WithContext(ctx))
665}
666
667// GetRemoteDesktopSender sends the GetRemoteDesktop request. The method will close the
668// http.Response Body if it receives an error.
669func (client ComputeNodeClient) GetRemoteDesktopSender(req *http.Request) (*http.Response, error) {
670	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
671}
672
673// GetRemoteDesktopResponder handles the response to the GetRemoteDesktop request. The method always
674// closes the http.Response Body.
675func (client ComputeNodeClient) GetRemoteDesktopResponder(resp *http.Response) (result ReadCloser, err error) {
676	result.Value = &resp.Body
677	err = autorest.Respond(
678		resp,
679		azure.WithErrorUnlessStatusCode(http.StatusOK))
680	result.Response = autorest.Response{Response: resp}
681	return
682}
683
684// GetRemoteLoginSettings before you can remotely login to a node using the remote login settings, you must create a
685// user account on the node. This API can be invoked only on pools created with the virtual machine configuration
686// property. For pools created with a cloud service configuration, see the GetRemoteDesktop API.
687// Parameters:
688// poolID - the ID of the pool that contains the compute node.
689// nodeID - the ID of the compute node for which to obtain the remote login settings.
690// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
691// seconds.
692// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
693// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
694// returnClientRequestID - whether the server should return the client-request-id in the response.
695// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
696// time; set it explicitly if you are calling the REST API directly.
697func (client ComputeNodeClient) GetRemoteLoginSettings(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ComputeNodeGetRemoteLoginSettingsResult, err error) {
698	if tracing.IsEnabled() {
699		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.GetRemoteLoginSettings")
700		defer func() {
701			sc := -1
702			if result.Response.Response != nil {
703				sc = result.Response.Response.StatusCode
704			}
705			tracing.EndSpan(ctx, sc, err)
706		}()
707	}
708	req, err := client.GetRemoteLoginSettingsPreparer(ctx, poolID, nodeID, timeout, clientRequestID, returnClientRequestID, ocpDate)
709	if err != nil {
710		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteLoginSettings", nil, "Failure preparing request")
711		return
712	}
713
714	resp, err := client.GetRemoteLoginSettingsSender(req)
715	if err != nil {
716		result.Response = autorest.Response{Response: resp}
717		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteLoginSettings", resp, "Failure sending request")
718		return
719	}
720
721	result, err = client.GetRemoteLoginSettingsResponder(resp)
722	if err != nil {
723		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteLoginSettings", resp, "Failure responding to request")
724		return
725	}
726
727	return
728}
729
730// GetRemoteLoginSettingsPreparer prepares the GetRemoteLoginSettings request.
731func (client ComputeNodeClient) GetRemoteLoginSettingsPreparer(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
732	urlParameters := map[string]interface{}{
733		"batchUrl": client.BatchURL,
734	}
735
736	pathParameters := map[string]interface{}{
737		"nodeId": autorest.Encode("path", nodeID),
738		"poolId": autorest.Encode("path", poolID),
739	}
740
741	const APIVersion = "2018-12-01.8.0"
742	queryParameters := map[string]interface{}{
743		"api-version": APIVersion,
744	}
745	if timeout != nil {
746		queryParameters["timeout"] = autorest.Encode("query", *timeout)
747	} else {
748		queryParameters["timeout"] = autorest.Encode("query", 30)
749	}
750
751	preparer := autorest.CreatePreparer(
752		autorest.AsGet(),
753		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
754		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/remoteloginsettings", pathParameters),
755		autorest.WithQueryParameters(queryParameters))
756	if clientRequestID != nil {
757		preparer = autorest.DecoratePreparer(preparer,
758			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
759	}
760	if returnClientRequestID != nil {
761		preparer = autorest.DecoratePreparer(preparer,
762			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
763	} else {
764		preparer = autorest.DecoratePreparer(preparer,
765			autorest.WithHeader("return-client-request-id", autorest.String(false)))
766	}
767	if ocpDate != nil {
768		preparer = autorest.DecoratePreparer(preparer,
769			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
770	}
771	return preparer.Prepare((&http.Request{}).WithContext(ctx))
772}
773
774// GetRemoteLoginSettingsSender sends the GetRemoteLoginSettings request. The method will close the
775// http.Response Body if it receives an error.
776func (client ComputeNodeClient) GetRemoteLoginSettingsSender(req *http.Request) (*http.Response, error) {
777	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
778}
779
780// GetRemoteLoginSettingsResponder handles the response to the GetRemoteLoginSettings request. The method always
781// closes the http.Response Body.
782func (client ComputeNodeClient) GetRemoteLoginSettingsResponder(resp *http.Response) (result ComputeNodeGetRemoteLoginSettingsResult, err error) {
783	err = autorest.Respond(
784		resp,
785		azure.WithErrorUnlessStatusCode(http.StatusOK),
786		autorest.ByUnmarshallingJSON(&result),
787		autorest.ByClosing())
788	result.Response = autorest.Response{Response: resp}
789	return
790}
791
792// List sends the list request.
793// Parameters:
794// poolID - the ID of the pool from which you want to list nodes.
795// filter - an OData $filter clause. For more information on constructing this filter, see
796// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool.
797// selectParameter - an OData $select clause.
798// maxResults - the maximum number of items to return in the response. A maximum of 1000 nodes can be returned.
799// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
800// seconds.
801// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
802// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
803// returnClientRequestID - whether the server should return the client-request-id in the response.
804// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
805// time; set it explicitly if you are calling the REST API directly.
806func (client ComputeNodeClient) List(ctx context.Context, poolID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ComputeNodeListResultPage, err error) {
807	if tracing.IsEnabled() {
808		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.List")
809		defer func() {
810			sc := -1
811			if result.cnlr.Response.Response != nil {
812				sc = result.cnlr.Response.Response.StatusCode
813			}
814			tracing.EndSpan(ctx, sc, err)
815		}()
816	}
817	if err := validation.Validate([]validation.Validation{
818		{TargetValue: maxResults,
819			Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false,
820				Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil},
821					{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
822				}}}}}); err != nil {
823		return result, validation.NewError("batch.ComputeNodeClient", "List", err.Error())
824	}
825
826	result.fn = client.listNextResults
827	req, err := client.ListPreparer(ctx, poolID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate)
828	if err != nil {
829		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "List", nil, "Failure preparing request")
830		return
831	}
832
833	resp, err := client.ListSender(req)
834	if err != nil {
835		result.cnlr.Response = autorest.Response{Response: resp}
836		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "List", resp, "Failure sending request")
837		return
838	}
839
840	result.cnlr, err = client.ListResponder(resp)
841	if err != nil {
842		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "List", resp, "Failure responding to request")
843		return
844	}
845	if result.cnlr.hasNextLink() && result.cnlr.IsEmpty() {
846		err = result.NextWithContext(ctx)
847		return
848	}
849
850	return
851}
852
853// ListPreparer prepares the List request.
854func (client ComputeNodeClient) ListPreparer(ctx context.Context, poolID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
855	urlParameters := map[string]interface{}{
856		"batchUrl": client.BatchURL,
857	}
858
859	pathParameters := map[string]interface{}{
860		"poolId": autorest.Encode("path", poolID),
861	}
862
863	const APIVersion = "2018-12-01.8.0"
864	queryParameters := map[string]interface{}{
865		"api-version": APIVersion,
866	}
867	if len(filter) > 0 {
868		queryParameters["$filter"] = autorest.Encode("query", filter)
869	}
870	if len(selectParameter) > 0 {
871		queryParameters["$select"] = autorest.Encode("query", selectParameter)
872	}
873	if maxResults != nil {
874		queryParameters["maxresults"] = autorest.Encode("query", *maxResults)
875	} else {
876		queryParameters["maxresults"] = autorest.Encode("query", 1000)
877	}
878	if timeout != nil {
879		queryParameters["timeout"] = autorest.Encode("query", *timeout)
880	} else {
881		queryParameters["timeout"] = autorest.Encode("query", 30)
882	}
883
884	preparer := autorest.CreatePreparer(
885		autorest.AsGet(),
886		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
887		autorest.WithPathParameters("/pools/{poolId}/nodes", pathParameters),
888		autorest.WithQueryParameters(queryParameters))
889	if clientRequestID != nil {
890		preparer = autorest.DecoratePreparer(preparer,
891			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
892	}
893	if returnClientRequestID != nil {
894		preparer = autorest.DecoratePreparer(preparer,
895			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
896	} else {
897		preparer = autorest.DecoratePreparer(preparer,
898			autorest.WithHeader("return-client-request-id", autorest.String(false)))
899	}
900	if ocpDate != nil {
901		preparer = autorest.DecoratePreparer(preparer,
902			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
903	}
904	return preparer.Prepare((&http.Request{}).WithContext(ctx))
905}
906
907// ListSender sends the List request. The method will close the
908// http.Response Body if it receives an error.
909func (client ComputeNodeClient) ListSender(req *http.Request) (*http.Response, error) {
910	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
911}
912
913// ListResponder handles the response to the List request. The method always
914// closes the http.Response Body.
915func (client ComputeNodeClient) ListResponder(resp *http.Response) (result ComputeNodeListResult, err error) {
916	err = autorest.Respond(
917		resp,
918		azure.WithErrorUnlessStatusCode(http.StatusOK),
919		autorest.ByUnmarshallingJSON(&result),
920		autorest.ByClosing())
921	result.Response = autorest.Response{Response: resp}
922	return
923}
924
925// listNextResults retrieves the next set of results, if any.
926func (client ComputeNodeClient) listNextResults(ctx context.Context, lastResults ComputeNodeListResult) (result ComputeNodeListResult, err error) {
927	req, err := lastResults.computeNodeListResultPreparer(ctx)
928	if err != nil {
929		return result, autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "listNextResults", nil, "Failure preparing next results request")
930	}
931	if req == nil {
932		return
933	}
934	resp, err := client.ListSender(req)
935	if err != nil {
936		result.Response = autorest.Response{Response: resp}
937		return result, autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "listNextResults", resp, "Failure sending next results request")
938	}
939	result, err = client.ListResponder(resp)
940	if err != nil {
941		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "listNextResults", resp, "Failure responding to next results request")
942	}
943	return
944}
945
946// ListComplete enumerates all values, automatically crossing page boundaries as required.
947func (client ComputeNodeClient) ListComplete(ctx context.Context, poolID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ComputeNodeListResultIterator, err error) {
948	if tracing.IsEnabled() {
949		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.List")
950		defer func() {
951			sc := -1
952			if result.Response().Response.Response != nil {
953				sc = result.page.Response().Response.Response.StatusCode
954			}
955			tracing.EndSpan(ctx, sc, err)
956		}()
957	}
958	result.page, err = client.List(ctx, poolID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate)
959	return
960}
961
962// Reboot you can restart a node only if it is in an idle or running state.
963// Parameters:
964// poolID - the ID of the pool that contains the compute node.
965// nodeID - the ID of the compute node that you want to restart.
966// nodeRebootParameter - the parameters for the request.
967// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
968// seconds.
969// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
970// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
971// returnClientRequestID - whether the server should return the client-request-id in the response.
972// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
973// time; set it explicitly if you are calling the REST API directly.
974func (client ComputeNodeClient) Reboot(ctx context.Context, poolID string, nodeID string, nodeRebootParameter *NodeRebootParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) {
975	if tracing.IsEnabled() {
976		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.Reboot")
977		defer func() {
978			sc := -1
979			if result.Response != nil {
980				sc = result.Response.StatusCode
981			}
982			tracing.EndSpan(ctx, sc, err)
983		}()
984	}
985	req, err := client.RebootPreparer(ctx, poolID, nodeID, nodeRebootParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
986	if err != nil {
987		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reboot", nil, "Failure preparing request")
988		return
989	}
990
991	resp, err := client.RebootSender(req)
992	if err != nil {
993		result.Response = resp
994		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reboot", resp, "Failure sending request")
995		return
996	}
997
998	result, err = client.RebootResponder(resp)
999	if err != nil {
1000		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reboot", resp, "Failure responding to request")
1001		return
1002	}
1003
1004	return
1005}
1006
1007// RebootPreparer prepares the Reboot request.
1008func (client ComputeNodeClient) RebootPreparer(ctx context.Context, poolID string, nodeID string, nodeRebootParameter *NodeRebootParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
1009	urlParameters := map[string]interface{}{
1010		"batchUrl": client.BatchURL,
1011	}
1012
1013	pathParameters := map[string]interface{}{
1014		"nodeId": autorest.Encode("path", nodeID),
1015		"poolId": autorest.Encode("path", poolID),
1016	}
1017
1018	const APIVersion = "2018-12-01.8.0"
1019	queryParameters := map[string]interface{}{
1020		"api-version": APIVersion,
1021	}
1022	if timeout != nil {
1023		queryParameters["timeout"] = autorest.Encode("query", *timeout)
1024	} else {
1025		queryParameters["timeout"] = autorest.Encode("query", 30)
1026	}
1027
1028	preparer := autorest.CreatePreparer(
1029		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
1030		autorest.AsPost(),
1031		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
1032		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/reboot", pathParameters),
1033		autorest.WithQueryParameters(queryParameters))
1034	if nodeRebootParameter != nil {
1035		preparer = autorest.DecoratePreparer(preparer,
1036			autorest.WithJSON(nodeRebootParameter))
1037	}
1038	if clientRequestID != nil {
1039		preparer = autorest.DecoratePreparer(preparer,
1040			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
1041	}
1042	if returnClientRequestID != nil {
1043		preparer = autorest.DecoratePreparer(preparer,
1044			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
1045	} else {
1046		preparer = autorest.DecoratePreparer(preparer,
1047			autorest.WithHeader("return-client-request-id", autorest.String(false)))
1048	}
1049	if ocpDate != nil {
1050		preparer = autorest.DecoratePreparer(preparer,
1051			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
1052	}
1053	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1054}
1055
1056// RebootSender sends the Reboot request. The method will close the
1057// http.Response Body if it receives an error.
1058func (client ComputeNodeClient) RebootSender(req *http.Request) (*http.Response, error) {
1059	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1060}
1061
1062// RebootResponder handles the response to the Reboot request. The method always
1063// closes the http.Response Body.
1064func (client ComputeNodeClient) RebootResponder(resp *http.Response) (result autorest.Response, err error) {
1065	err = autorest.Respond(
1066		resp,
1067		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1068		autorest.ByClosing())
1069	result.Response = resp
1070	return
1071}
1072
1073// Reimage you can reinstall the operating system on a node only if it is in an idle or running state. This API can be
1074// invoked only on pools created with the cloud service configuration property.
1075// Parameters:
1076// poolID - the ID of the pool that contains the compute node.
1077// nodeID - the ID of the compute node that you want to restart.
1078// nodeReimageParameter - the parameters for the request.
1079// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
1080// seconds.
1081// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
1082// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
1083// returnClientRequestID - whether the server should return the client-request-id in the response.
1084// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
1085// time; set it explicitly if you are calling the REST API directly.
1086func (client ComputeNodeClient) Reimage(ctx context.Context, poolID string, nodeID string, nodeReimageParameter *NodeReimageParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) {
1087	if tracing.IsEnabled() {
1088		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.Reimage")
1089		defer func() {
1090			sc := -1
1091			if result.Response != nil {
1092				sc = result.Response.StatusCode
1093			}
1094			tracing.EndSpan(ctx, sc, err)
1095		}()
1096	}
1097	req, err := client.ReimagePreparer(ctx, poolID, nodeID, nodeReimageParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
1098	if err != nil {
1099		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reimage", nil, "Failure preparing request")
1100		return
1101	}
1102
1103	resp, err := client.ReimageSender(req)
1104	if err != nil {
1105		result.Response = resp
1106		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reimage", resp, "Failure sending request")
1107		return
1108	}
1109
1110	result, err = client.ReimageResponder(resp)
1111	if err != nil {
1112		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reimage", resp, "Failure responding to request")
1113		return
1114	}
1115
1116	return
1117}
1118
1119// ReimagePreparer prepares the Reimage request.
1120func (client ComputeNodeClient) ReimagePreparer(ctx context.Context, poolID string, nodeID string, nodeReimageParameter *NodeReimageParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
1121	urlParameters := map[string]interface{}{
1122		"batchUrl": client.BatchURL,
1123	}
1124
1125	pathParameters := map[string]interface{}{
1126		"nodeId": autorest.Encode("path", nodeID),
1127		"poolId": autorest.Encode("path", poolID),
1128	}
1129
1130	const APIVersion = "2018-12-01.8.0"
1131	queryParameters := map[string]interface{}{
1132		"api-version": APIVersion,
1133	}
1134	if timeout != nil {
1135		queryParameters["timeout"] = autorest.Encode("query", *timeout)
1136	} else {
1137		queryParameters["timeout"] = autorest.Encode("query", 30)
1138	}
1139
1140	preparer := autorest.CreatePreparer(
1141		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
1142		autorest.AsPost(),
1143		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
1144		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/reimage", pathParameters),
1145		autorest.WithQueryParameters(queryParameters))
1146	if nodeReimageParameter != nil {
1147		preparer = autorest.DecoratePreparer(preparer,
1148			autorest.WithJSON(nodeReimageParameter))
1149	}
1150	if clientRequestID != nil {
1151		preparer = autorest.DecoratePreparer(preparer,
1152			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
1153	}
1154	if returnClientRequestID != nil {
1155		preparer = autorest.DecoratePreparer(preparer,
1156			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
1157	} else {
1158		preparer = autorest.DecoratePreparer(preparer,
1159			autorest.WithHeader("return-client-request-id", autorest.String(false)))
1160	}
1161	if ocpDate != nil {
1162		preparer = autorest.DecoratePreparer(preparer,
1163			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
1164	}
1165	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1166}
1167
1168// ReimageSender sends the Reimage request. The method will close the
1169// http.Response Body if it receives an error.
1170func (client ComputeNodeClient) ReimageSender(req *http.Request) (*http.Response, error) {
1171	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1172}
1173
1174// ReimageResponder handles the response to the Reimage request. The method always
1175// closes the http.Response Body.
1176func (client ComputeNodeClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) {
1177	err = autorest.Respond(
1178		resp,
1179		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1180		autorest.ByClosing())
1181	result.Response = resp
1182	return
1183}
1184
1185// UpdateUser this operation replaces of all the updatable properties of the account. For example, if the expiryTime
1186// element is not specified, the current value is replaced with the default value, not left unmodified. You can update
1187// a user account on a node only when it is in the idle or running state.
1188// Parameters:
1189// poolID - the ID of the pool that contains the compute node.
1190// nodeID - the ID of the machine on which you want to update a user account.
1191// userName - the name of the user account to update.
1192// nodeUpdateUserParameter - the parameters for the request.
1193// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
1194// seconds.
1195// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
1196// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
1197// returnClientRequestID - whether the server should return the client-request-id in the response.
1198// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
1199// time; set it explicitly if you are calling the REST API directly.
1200func (client ComputeNodeClient) UpdateUser(ctx context.Context, poolID string, nodeID string, userName string, nodeUpdateUserParameter NodeUpdateUserParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) {
1201	if tracing.IsEnabled() {
1202		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.UpdateUser")
1203		defer func() {
1204			sc := -1
1205			if result.Response != nil {
1206				sc = result.Response.StatusCode
1207			}
1208			tracing.EndSpan(ctx, sc, err)
1209		}()
1210	}
1211	req, err := client.UpdateUserPreparer(ctx, poolID, nodeID, userName, nodeUpdateUserParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
1212	if err != nil {
1213		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UpdateUser", nil, "Failure preparing request")
1214		return
1215	}
1216
1217	resp, err := client.UpdateUserSender(req)
1218	if err != nil {
1219		result.Response = resp
1220		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UpdateUser", resp, "Failure sending request")
1221		return
1222	}
1223
1224	result, err = client.UpdateUserResponder(resp)
1225	if err != nil {
1226		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UpdateUser", resp, "Failure responding to request")
1227		return
1228	}
1229
1230	return
1231}
1232
1233// UpdateUserPreparer prepares the UpdateUser request.
1234func (client ComputeNodeClient) UpdateUserPreparer(ctx context.Context, poolID string, nodeID string, userName string, nodeUpdateUserParameter NodeUpdateUserParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
1235	urlParameters := map[string]interface{}{
1236		"batchUrl": client.BatchURL,
1237	}
1238
1239	pathParameters := map[string]interface{}{
1240		"nodeId":   autorest.Encode("path", nodeID),
1241		"poolId":   autorest.Encode("path", poolID),
1242		"userName": autorest.Encode("path", userName),
1243	}
1244
1245	const APIVersion = "2018-12-01.8.0"
1246	queryParameters := map[string]interface{}{
1247		"api-version": APIVersion,
1248	}
1249	if timeout != nil {
1250		queryParameters["timeout"] = autorest.Encode("query", *timeout)
1251	} else {
1252		queryParameters["timeout"] = autorest.Encode("query", 30)
1253	}
1254
1255	preparer := autorest.CreatePreparer(
1256		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
1257		autorest.AsPut(),
1258		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
1259		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/users/{userName}", pathParameters),
1260		autorest.WithJSON(nodeUpdateUserParameter),
1261		autorest.WithQueryParameters(queryParameters))
1262	if clientRequestID != nil {
1263		preparer = autorest.DecoratePreparer(preparer,
1264			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
1265	}
1266	if returnClientRequestID != nil {
1267		preparer = autorest.DecoratePreparer(preparer,
1268			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
1269	} else {
1270		preparer = autorest.DecoratePreparer(preparer,
1271			autorest.WithHeader("return-client-request-id", autorest.String(false)))
1272	}
1273	if ocpDate != nil {
1274		preparer = autorest.DecoratePreparer(preparer,
1275			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
1276	}
1277	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1278}
1279
1280// UpdateUserSender sends the UpdateUser request. The method will close the
1281// http.Response Body if it receives an error.
1282func (client ComputeNodeClient) UpdateUserSender(req *http.Request) (*http.Response, error) {
1283	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1284}
1285
1286// UpdateUserResponder handles the response to the UpdateUser request. The method always
1287// closes the http.Response Body.
1288func (client ComputeNodeClient) UpdateUserResponder(resp *http.Response) (result autorest.Response, err error) {
1289	err = autorest.Respond(
1290		resp,
1291		azure.WithErrorUnlessStatusCode(http.StatusOK),
1292		autorest.ByClosing())
1293	result.Response = resp
1294	return
1295}
1296
1297// UploadBatchServiceLogs this is for gathering Azure Batch service log files in an automated fashion from nodes if you
1298// are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared
1299// with Azure support to aid in debugging issues with the Batch service.
1300// Parameters:
1301// poolID - the ID of the pool that contains the compute node.
1302// nodeID - the ID of the compute node from which you want to upload the Azure Batch service log files.
1303// uploadBatchServiceLogsConfiguration - the Azure Batch service log files upload configuration.
1304// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30
1305// seconds.
1306// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as
1307// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
1308// returnClientRequestID - whether the server should return the client-request-id in the response.
1309// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock
1310// time; set it explicitly if you are calling the REST API directly.
1311func (client ComputeNodeClient) UploadBatchServiceLogs(ctx context.Context, poolID string, nodeID string, uploadBatchServiceLogsConfiguration UploadBatchServiceLogsConfiguration, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result UploadBatchServiceLogsResult, err error) {
1312	if tracing.IsEnabled() {
1313		ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.UploadBatchServiceLogs")
1314		defer func() {
1315			sc := -1
1316			if result.Response.Response != nil {
1317				sc = result.Response.Response.StatusCode
1318			}
1319			tracing.EndSpan(ctx, sc, err)
1320		}()
1321	}
1322	if err := validation.Validate([]validation.Validation{
1323		{TargetValue: uploadBatchServiceLogsConfiguration,
1324			Constraints: []validation.Constraint{{Target: "uploadBatchServiceLogsConfiguration.ContainerURL", Name: validation.Null, Rule: true, Chain: nil},
1325				{Target: "uploadBatchServiceLogsConfiguration.StartTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
1326		return result, validation.NewError("batch.ComputeNodeClient", "UploadBatchServiceLogs", err.Error())
1327	}
1328
1329	req, err := client.UploadBatchServiceLogsPreparer(ctx, poolID, nodeID, uploadBatchServiceLogsConfiguration, timeout, clientRequestID, returnClientRequestID, ocpDate)
1330	if err != nil {
1331		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UploadBatchServiceLogs", nil, "Failure preparing request")
1332		return
1333	}
1334
1335	resp, err := client.UploadBatchServiceLogsSender(req)
1336	if err != nil {
1337		result.Response = autorest.Response{Response: resp}
1338		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UploadBatchServiceLogs", resp, "Failure sending request")
1339		return
1340	}
1341
1342	result, err = client.UploadBatchServiceLogsResponder(resp)
1343	if err != nil {
1344		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UploadBatchServiceLogs", resp, "Failure responding to request")
1345		return
1346	}
1347
1348	return
1349}
1350
1351// UploadBatchServiceLogsPreparer prepares the UploadBatchServiceLogs request.
1352func (client ComputeNodeClient) UploadBatchServiceLogsPreparer(ctx context.Context, poolID string, nodeID string, uploadBatchServiceLogsConfiguration UploadBatchServiceLogsConfiguration, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
1353	urlParameters := map[string]interface{}{
1354		"batchUrl": client.BatchURL,
1355	}
1356
1357	pathParameters := map[string]interface{}{
1358		"nodeId": autorest.Encode("path", nodeID),
1359		"poolId": autorest.Encode("path", poolID),
1360	}
1361
1362	const APIVersion = "2018-12-01.8.0"
1363	queryParameters := map[string]interface{}{
1364		"api-version": APIVersion,
1365	}
1366	if timeout != nil {
1367		queryParameters["timeout"] = autorest.Encode("query", *timeout)
1368	} else {
1369		queryParameters["timeout"] = autorest.Encode("query", 30)
1370	}
1371
1372	preparer := autorest.CreatePreparer(
1373		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
1374		autorest.AsPost(),
1375		autorest.WithCustomBaseURL("{batchUrl}", urlParameters),
1376		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/uploadbatchservicelogs", pathParameters),
1377		autorest.WithJSON(uploadBatchServiceLogsConfiguration),
1378		autorest.WithQueryParameters(queryParameters))
1379	if clientRequestID != nil {
1380		preparer = autorest.DecoratePreparer(preparer,
1381			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
1382	}
1383	if returnClientRequestID != nil {
1384		preparer = autorest.DecoratePreparer(preparer,
1385			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
1386	} else {
1387		preparer = autorest.DecoratePreparer(preparer,
1388			autorest.WithHeader("return-client-request-id", autorest.String(false)))
1389	}
1390	if ocpDate != nil {
1391		preparer = autorest.DecoratePreparer(preparer,
1392			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
1393	}
1394	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1395}
1396
1397// UploadBatchServiceLogsSender sends the UploadBatchServiceLogs request. The method will close the
1398// http.Response Body if it receives an error.
1399func (client ComputeNodeClient) UploadBatchServiceLogsSender(req *http.Request) (*http.Response, error) {
1400	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1401}
1402
1403// UploadBatchServiceLogsResponder handles the response to the UploadBatchServiceLogs request. The method always
1404// closes the http.Response Body.
1405func (client ComputeNodeClient) UploadBatchServiceLogsResponder(resp *http.Response) (result UploadBatchServiceLogsResult, err error) {
1406	err = autorest.Respond(
1407		resp,
1408		azure.WithErrorUnlessStatusCode(http.StatusOK),
1409		autorest.ByUnmarshallingJSON(&result),
1410		autorest.ByClosing())
1411	result.Response = autorest.Response{Response: resp}
1412	return
1413}
1414