1package batch
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/date"
25	"github.com/Azure/go-autorest/autorest/validation"
26	"github.com/satori/go.uuid"
27	"net/http"
28)
29
30// ComputeNodeClient is the a client for issuing REST requests to the Azure Batch service.
31type ComputeNodeClient struct {
32	BaseClient
33}
34
35// NewComputeNodeClient creates an instance of the ComputeNodeClient client.
36func NewComputeNodeClient() ComputeNodeClient {
37	return NewComputeNodeClientWithBaseURI(DefaultBaseURI)
38}
39
40// NewComputeNodeClientWithBaseURI creates an instance of the ComputeNodeClient client.
41func NewComputeNodeClientWithBaseURI(baseURI string) ComputeNodeClient {
42	return ComputeNodeClient{NewWithBaseURI(baseURI)}
43}
44
45// AddUser you can add a user account to a node only when it is in the idle or running state.
46//
47// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the machine on which you want
48// to create a user account. userParameter is the user account to be created. timeout is the maximum time that the
49// server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is the
50// caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g.
51// 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. returnClientRequestID is whether the server should return the
52// client-request-id in the response. ocpDate is the time the request was issued. Client libraries typically set
53// this to the current system clock time; set it explicitly if you are calling the REST API directly.
54func (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) {
55	if err := validation.Validate([]validation.Validation{
56		{TargetValue: userParameter,
57			Constraints: []validation.Constraint{{Target: "userParameter.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
58		return result, validation.NewError("batch.ComputeNodeClient", "AddUser", err.Error())
59	}
60
61	req, err := client.AddUserPreparer(ctx, poolID, nodeID, userParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
62	if err != nil {
63		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "AddUser", nil, "Failure preparing request")
64		return
65	}
66
67	resp, err := client.AddUserSender(req)
68	if err != nil {
69		result.Response = resp
70		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "AddUser", resp, "Failure sending request")
71		return
72	}
73
74	result, err = client.AddUserResponder(resp)
75	if err != nil {
76		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "AddUser", resp, "Failure responding to request")
77	}
78
79	return
80}
81
82// AddUserPreparer prepares the AddUser request.
83func (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) {
84	pathParameters := map[string]interface{}{
85		"nodeId": autorest.Encode("path", nodeID),
86		"poolId": autorest.Encode("path", poolID),
87	}
88
89	const APIVersion = "2017-06-01.5.1"
90	queryParameters := map[string]interface{}{
91		"api-version": APIVersion,
92	}
93	if timeout != nil {
94		queryParameters["timeout"] = autorest.Encode("query", *timeout)
95	} else {
96		queryParameters["timeout"] = autorest.Encode("query", 30)
97	}
98
99	preparer := autorest.CreatePreparer(
100		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
101		autorest.AsPost(),
102		autorest.WithBaseURL(client.BaseURI),
103		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/users", pathParameters),
104		autorest.WithJSON(userParameter),
105		autorest.WithQueryParameters(queryParameters))
106	if clientRequestID != nil {
107		preparer = autorest.DecoratePreparer(preparer,
108			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
109	}
110	if returnClientRequestID != nil {
111		preparer = autorest.DecoratePreparer(preparer,
112			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
113	} else {
114		preparer = autorest.DecoratePreparer(preparer,
115			autorest.WithHeader("return-client-request-id", autorest.String(false)))
116	}
117	if ocpDate != nil {
118		preparer = autorest.DecoratePreparer(preparer,
119			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
120	}
121	return preparer.Prepare((&http.Request{}).WithContext(ctx))
122}
123
124// AddUserSender sends the AddUser request. The method will close the
125// http.Response Body if it receives an error.
126func (client ComputeNodeClient) AddUserSender(req *http.Request) (*http.Response, error) {
127	return autorest.SendWithSender(client, req,
128		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
129}
130
131// AddUserResponder handles the response to the AddUser request. The method always
132// closes the http.Response Body.
133func (client ComputeNodeClient) AddUserResponder(resp *http.Response) (result autorest.Response, err error) {
134	err = autorest.Respond(
135		resp,
136		client.ByInspecting(),
137		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
138		autorest.ByClosing())
139	result.Response = resp
140	return
141}
142
143// DeleteUser you can delete a user account to a node only when it is in the idle or running state.
144//
145// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the machine on which you want
146// to delete a user account. userName is the name of the user account to delete. timeout is the maximum time that
147// the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is the
148// caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g.
149// 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. returnClientRequestID is whether the server should return the
150// client-request-id in the response. ocpDate is the time the request was issued. Client libraries typically set
151// this to the current system clock time; set it explicitly if you are calling the REST API directly.
152func (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) {
153	req, err := client.DeleteUserPreparer(ctx, poolID, nodeID, userName, timeout, clientRequestID, returnClientRequestID, ocpDate)
154	if err != nil {
155		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DeleteUser", nil, "Failure preparing request")
156		return
157	}
158
159	resp, err := client.DeleteUserSender(req)
160	if err != nil {
161		result.Response = resp
162		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DeleteUser", resp, "Failure sending request")
163		return
164	}
165
166	result, err = client.DeleteUserResponder(resp)
167	if err != nil {
168		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DeleteUser", resp, "Failure responding to request")
169	}
170
171	return
172}
173
174// DeleteUserPreparer prepares the DeleteUser request.
175func (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) {
176	pathParameters := map[string]interface{}{
177		"nodeId":   autorest.Encode("path", nodeID),
178		"poolId":   autorest.Encode("path", poolID),
179		"userName": autorest.Encode("path", userName),
180	}
181
182	const APIVersion = "2017-06-01.5.1"
183	queryParameters := map[string]interface{}{
184		"api-version": APIVersion,
185	}
186	if timeout != nil {
187		queryParameters["timeout"] = autorest.Encode("query", *timeout)
188	} else {
189		queryParameters["timeout"] = autorest.Encode("query", 30)
190	}
191
192	preparer := autorest.CreatePreparer(
193		autorest.AsDelete(),
194		autorest.WithBaseURL(client.BaseURI),
195		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/users/{userName}", pathParameters),
196		autorest.WithQueryParameters(queryParameters))
197	if clientRequestID != nil {
198		preparer = autorest.DecoratePreparer(preparer,
199			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
200	}
201	if returnClientRequestID != nil {
202		preparer = autorest.DecoratePreparer(preparer,
203			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
204	} else {
205		preparer = autorest.DecoratePreparer(preparer,
206			autorest.WithHeader("return-client-request-id", autorest.String(false)))
207	}
208	if ocpDate != nil {
209		preparer = autorest.DecoratePreparer(preparer,
210			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
211	}
212	return preparer.Prepare((&http.Request{}).WithContext(ctx))
213}
214
215// DeleteUserSender sends the DeleteUser request. The method will close the
216// http.Response Body if it receives an error.
217func (client ComputeNodeClient) DeleteUserSender(req *http.Request) (*http.Response, error) {
218	return autorest.SendWithSender(client, req,
219		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
220}
221
222// DeleteUserResponder handles the response to the DeleteUser request. The method always
223// closes the http.Response Body.
224func (client ComputeNodeClient) DeleteUserResponder(resp *http.Response) (result autorest.Response, err error) {
225	err = autorest.Respond(
226		resp,
227		client.ByInspecting(),
228		azure.WithErrorUnlessStatusCode(http.StatusOK),
229		autorest.ByClosing())
230	result.Response = resp
231	return
232}
233
234// DisableScheduling you can disable task scheduling on a node only if its current scheduling state is enabled.
235//
236// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node on which you
237// want to disable task scheduling. nodeDisableSchedulingParameter is the parameters for the request. timeout is
238// the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds.
239// clientRequestID is the caller-generated request identity, in the form of a GUID with no decoration such as curly
240// braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. returnClientRequestID is whether the server should return the
241// client-request-id in the response. ocpDate is the time the request was issued. Client libraries typically set
242// this to the current system clock time; set it explicitly if you are calling the REST API directly.
243func (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) {
244	req, err := client.DisableSchedulingPreparer(ctx, poolID, nodeID, nodeDisableSchedulingParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
245	if err != nil {
246		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DisableScheduling", nil, "Failure preparing request")
247		return
248	}
249
250	resp, err := client.DisableSchedulingSender(req)
251	if err != nil {
252		result.Response = resp
253		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DisableScheduling", resp, "Failure sending request")
254		return
255	}
256
257	result, err = client.DisableSchedulingResponder(resp)
258	if err != nil {
259		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DisableScheduling", resp, "Failure responding to request")
260	}
261
262	return
263}
264
265// DisableSchedulingPreparer prepares the DisableScheduling request.
266func (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) {
267	pathParameters := map[string]interface{}{
268		"nodeId": autorest.Encode("path", nodeID),
269		"poolId": autorest.Encode("path", poolID),
270	}
271
272	const APIVersion = "2017-06-01.5.1"
273	queryParameters := map[string]interface{}{
274		"api-version": APIVersion,
275	}
276	if timeout != nil {
277		queryParameters["timeout"] = autorest.Encode("query", *timeout)
278	} else {
279		queryParameters["timeout"] = autorest.Encode("query", 30)
280	}
281
282	preparer := autorest.CreatePreparer(
283		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
284		autorest.AsPost(),
285		autorest.WithBaseURL(client.BaseURI),
286		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/disablescheduling", pathParameters),
287		autorest.WithQueryParameters(queryParameters))
288	if nodeDisableSchedulingParameter != nil {
289		preparer = autorest.DecoratePreparer(preparer,
290			autorest.WithJSON(nodeDisableSchedulingParameter))
291	}
292	if clientRequestID != nil {
293		preparer = autorest.DecoratePreparer(preparer,
294			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
295	}
296	if returnClientRequestID != nil {
297		preparer = autorest.DecoratePreparer(preparer,
298			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
299	} else {
300		preparer = autorest.DecoratePreparer(preparer,
301			autorest.WithHeader("return-client-request-id", autorest.String(false)))
302	}
303	if ocpDate != nil {
304		preparer = autorest.DecoratePreparer(preparer,
305			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
306	}
307	return preparer.Prepare((&http.Request{}).WithContext(ctx))
308}
309
310// DisableSchedulingSender sends the DisableScheduling request. The method will close the
311// http.Response Body if it receives an error.
312func (client ComputeNodeClient) DisableSchedulingSender(req *http.Request) (*http.Response, error) {
313	return autorest.SendWithSender(client, req,
314		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
315}
316
317// DisableSchedulingResponder handles the response to the DisableScheduling request. The method always
318// closes the http.Response Body.
319func (client ComputeNodeClient) DisableSchedulingResponder(resp *http.Response) (result autorest.Response, err error) {
320	err = autorest.Respond(
321		resp,
322		client.ByInspecting(),
323		azure.WithErrorUnlessStatusCode(http.StatusOK),
324		autorest.ByClosing())
325	result.Response = resp
326	return
327}
328
329// EnableScheduling you can enable task scheduling on a node only if its current scheduling state is disabled
330//
331// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node on which you
332// want to enable task scheduling. timeout is the maximum time that the server can spend processing the request, in
333// seconds. The default is 30 seconds. clientRequestID is the caller-generated request identity, in the form of a
334// GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. returnClientRequestID
335// is whether the server should return the client-request-id in the response. ocpDate is the time the request was
336// issued. Client libraries typically set this to the current system clock time; set it explicitly if you are
337// calling the REST API directly.
338func (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) {
339	req, err := client.EnableSchedulingPreparer(ctx, poolID, nodeID, timeout, clientRequestID, returnClientRequestID, ocpDate)
340	if err != nil {
341		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "EnableScheduling", nil, "Failure preparing request")
342		return
343	}
344
345	resp, err := client.EnableSchedulingSender(req)
346	if err != nil {
347		result.Response = resp
348		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "EnableScheduling", resp, "Failure sending request")
349		return
350	}
351
352	result, err = client.EnableSchedulingResponder(resp)
353	if err != nil {
354		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "EnableScheduling", resp, "Failure responding to request")
355	}
356
357	return
358}
359
360// EnableSchedulingPreparer prepares the EnableScheduling request.
361func (client ComputeNodeClient) EnableSchedulingPreparer(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
362	pathParameters := map[string]interface{}{
363		"nodeId": autorest.Encode("path", nodeID),
364		"poolId": autorest.Encode("path", poolID),
365	}
366
367	const APIVersion = "2017-06-01.5.1"
368	queryParameters := map[string]interface{}{
369		"api-version": APIVersion,
370	}
371	if timeout != nil {
372		queryParameters["timeout"] = autorest.Encode("query", *timeout)
373	} else {
374		queryParameters["timeout"] = autorest.Encode("query", 30)
375	}
376
377	preparer := autorest.CreatePreparer(
378		autorest.AsPost(),
379		autorest.WithBaseURL(client.BaseURI),
380		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/enablescheduling", pathParameters),
381		autorest.WithQueryParameters(queryParameters))
382	if clientRequestID != nil {
383		preparer = autorest.DecoratePreparer(preparer,
384			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
385	}
386	if returnClientRequestID != nil {
387		preparer = autorest.DecoratePreparer(preparer,
388			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
389	} else {
390		preparer = autorest.DecoratePreparer(preparer,
391			autorest.WithHeader("return-client-request-id", autorest.String(false)))
392	}
393	if ocpDate != nil {
394		preparer = autorest.DecoratePreparer(preparer,
395			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
396	}
397	return preparer.Prepare((&http.Request{}).WithContext(ctx))
398}
399
400// EnableSchedulingSender sends the EnableScheduling request. The method will close the
401// http.Response Body if it receives an error.
402func (client ComputeNodeClient) EnableSchedulingSender(req *http.Request) (*http.Response, error) {
403	return autorest.SendWithSender(client, req,
404		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
405}
406
407// EnableSchedulingResponder handles the response to the EnableScheduling request. The method always
408// closes the http.Response Body.
409func (client ComputeNodeClient) EnableSchedulingResponder(resp *http.Response) (result autorest.Response, err error) {
410	err = autorest.Respond(
411		resp,
412		client.ByInspecting(),
413		azure.WithErrorUnlessStatusCode(http.StatusOK),
414		autorest.ByClosing())
415	result.Response = resp
416	return
417}
418
419// Get sends the get request.
420//
421// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that you want
422// to get information about. selectParameter is an OData $select clause. timeout is the maximum time that the
423// server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is the
424// caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g.
425// 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. returnClientRequestID is whether the server should return the
426// client-request-id in the response. ocpDate is the time the request was issued. Client libraries typically set
427// this to the current system clock time; set it explicitly if you are calling the REST API directly.
428func (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) {
429	req, err := client.GetPreparer(ctx, poolID, nodeID, selectParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
430	if err != nil {
431		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Get", nil, "Failure preparing request")
432		return
433	}
434
435	resp, err := client.GetSender(req)
436	if err != nil {
437		result.Response = autorest.Response{Response: resp}
438		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Get", resp, "Failure sending request")
439		return
440	}
441
442	result, err = client.GetResponder(resp)
443	if err != nil {
444		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Get", resp, "Failure responding to request")
445	}
446
447	return
448}
449
450// GetPreparer prepares the Get request.
451func (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) {
452	pathParameters := map[string]interface{}{
453		"nodeId": autorest.Encode("path", nodeID),
454		"poolId": autorest.Encode("path", poolID),
455	}
456
457	const APIVersion = "2017-06-01.5.1"
458	queryParameters := map[string]interface{}{
459		"api-version": APIVersion,
460	}
461	if len(selectParameter) > 0 {
462		queryParameters["$select"] = autorest.Encode("query", selectParameter)
463	}
464	if timeout != nil {
465		queryParameters["timeout"] = autorest.Encode("query", *timeout)
466	} else {
467		queryParameters["timeout"] = autorest.Encode("query", 30)
468	}
469
470	preparer := autorest.CreatePreparer(
471		autorest.AsGet(),
472		autorest.WithBaseURL(client.BaseURI),
473		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}", pathParameters),
474		autorest.WithQueryParameters(queryParameters))
475	if clientRequestID != nil {
476		preparer = autorest.DecoratePreparer(preparer,
477			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
478	}
479	if returnClientRequestID != nil {
480		preparer = autorest.DecoratePreparer(preparer,
481			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
482	} else {
483		preparer = autorest.DecoratePreparer(preparer,
484			autorest.WithHeader("return-client-request-id", autorest.String(false)))
485	}
486	if ocpDate != nil {
487		preparer = autorest.DecoratePreparer(preparer,
488			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
489	}
490	return preparer.Prepare((&http.Request{}).WithContext(ctx))
491}
492
493// GetSender sends the Get request. The method will close the
494// http.Response Body if it receives an error.
495func (client ComputeNodeClient) GetSender(req *http.Request) (*http.Response, error) {
496	return autorest.SendWithSender(client, req,
497		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
498}
499
500// GetResponder handles the response to the Get request. The method always
501// closes the http.Response Body.
502func (client ComputeNodeClient) GetResponder(resp *http.Response) (result ComputeNode, err error) {
503	err = autorest.Respond(
504		resp,
505		client.ByInspecting(),
506		azure.WithErrorUnlessStatusCode(http.StatusOK),
507		autorest.ByUnmarshallingJSON(&result),
508		autorest.ByClosing())
509	result.Response = autorest.Response{Response: resp}
510	return
511}
512
513// GetRemoteDesktop before you can access a node by using the RDP file, you must create a user account on the node.
514// This API can only be invoked on pools created with a cloud service configuration. For pools created with a virtual
515// machine configuration, see the GetRemoteLoginSettings API.
516//
517// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node for which you
518// want to get the Remote Desktop Protocol file. timeout is the maximum time that the server can spend processing
519// the request, in seconds. The default is 30 seconds. clientRequestID is the caller-generated request identity, in
520// the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
521// returnClientRequestID is whether the server should return the client-request-id in the response. ocpDate is the
522// time the request was issued. Client libraries typically set this to the current system clock time; set it
523// explicitly if you are calling the REST API directly.
524func (client ComputeNodeClient) GetRemoteDesktop(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ReadCloser, err error) {
525	req, err := client.GetRemoteDesktopPreparer(ctx, poolID, nodeID, timeout, clientRequestID, returnClientRequestID, ocpDate)
526	if err != nil {
527		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteDesktop", nil, "Failure preparing request")
528		return
529	}
530
531	resp, err := client.GetRemoteDesktopSender(req)
532	if err != nil {
533		result.Response = autorest.Response{Response: resp}
534		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteDesktop", resp, "Failure sending request")
535		return
536	}
537
538	result, err = client.GetRemoteDesktopResponder(resp)
539	if err != nil {
540		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteDesktop", resp, "Failure responding to request")
541	}
542
543	return
544}
545
546// GetRemoteDesktopPreparer prepares the GetRemoteDesktop request.
547func (client ComputeNodeClient) GetRemoteDesktopPreparer(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
548	pathParameters := map[string]interface{}{
549		"nodeId": autorest.Encode("path", nodeID),
550		"poolId": autorest.Encode("path", poolID),
551	}
552
553	const APIVersion = "2017-06-01.5.1"
554	queryParameters := map[string]interface{}{
555		"api-version": APIVersion,
556	}
557	if timeout != nil {
558		queryParameters["timeout"] = autorest.Encode("query", *timeout)
559	} else {
560		queryParameters["timeout"] = autorest.Encode("query", 30)
561	}
562
563	preparer := autorest.CreatePreparer(
564		autorest.AsGet(),
565		autorest.WithBaseURL(client.BaseURI),
566		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/rdp", pathParameters),
567		autorest.WithQueryParameters(queryParameters))
568	if clientRequestID != nil {
569		preparer = autorest.DecoratePreparer(preparer,
570			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
571	}
572	if returnClientRequestID != nil {
573		preparer = autorest.DecoratePreparer(preparer,
574			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
575	} else {
576		preparer = autorest.DecoratePreparer(preparer,
577			autorest.WithHeader("return-client-request-id", autorest.String(false)))
578	}
579	if ocpDate != nil {
580		preparer = autorest.DecoratePreparer(preparer,
581			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
582	}
583	return preparer.Prepare((&http.Request{}).WithContext(ctx))
584}
585
586// GetRemoteDesktopSender sends the GetRemoteDesktop request. The method will close the
587// http.Response Body if it receives an error.
588func (client ComputeNodeClient) GetRemoteDesktopSender(req *http.Request) (*http.Response, error) {
589	return autorest.SendWithSender(client, req,
590		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
591}
592
593// GetRemoteDesktopResponder handles the response to the GetRemoteDesktop request. The method always
594// closes the http.Response Body.
595func (client ComputeNodeClient) GetRemoteDesktopResponder(resp *http.Response) (result ReadCloser, err error) {
596	result.Value = &resp.Body
597	err = autorest.Respond(
598		resp,
599		client.ByInspecting(),
600		azure.WithErrorUnlessStatusCode(http.StatusOK))
601	result.Response = autorest.Response{Response: resp}
602	return
603}
604
605// GetRemoteLoginSettings before you can remotely login to a node using the remote login settings, you must create a
606// user account on the node. This API can be invoked only on pools created with the virtual machine configuration
607// property. For pools created with a cloud service configuration, see the GetRemoteDesktop API.
608//
609// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node for which to
610// obtain the remote login settings. timeout is the maximum time that the server can spend processing the request,
611// in seconds. The default is 30 seconds. clientRequestID is the caller-generated request identity, in the form of
612// a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. returnClientRequestID
613// is whether the server should return the client-request-id in the response. ocpDate is the time the request was
614// issued. Client libraries typically set this to the current system clock time; set it explicitly if you are
615// calling the REST API directly.
616func (client ComputeNodeClient) GetRemoteLoginSettings(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ComputeNodeGetRemoteLoginSettingsResult, err error) {
617	req, err := client.GetRemoteLoginSettingsPreparer(ctx, poolID, nodeID, timeout, clientRequestID, returnClientRequestID, ocpDate)
618	if err != nil {
619		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteLoginSettings", nil, "Failure preparing request")
620		return
621	}
622
623	resp, err := client.GetRemoteLoginSettingsSender(req)
624	if err != nil {
625		result.Response = autorest.Response{Response: resp}
626		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteLoginSettings", resp, "Failure sending request")
627		return
628	}
629
630	result, err = client.GetRemoteLoginSettingsResponder(resp)
631	if err != nil {
632		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteLoginSettings", resp, "Failure responding to request")
633	}
634
635	return
636}
637
638// GetRemoteLoginSettingsPreparer prepares the GetRemoteLoginSettings request.
639func (client ComputeNodeClient) GetRemoteLoginSettingsPreparer(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) {
640	pathParameters := map[string]interface{}{
641		"nodeId": autorest.Encode("path", nodeID),
642		"poolId": autorest.Encode("path", poolID),
643	}
644
645	const APIVersion = "2017-06-01.5.1"
646	queryParameters := map[string]interface{}{
647		"api-version": APIVersion,
648	}
649	if timeout != nil {
650		queryParameters["timeout"] = autorest.Encode("query", *timeout)
651	} else {
652		queryParameters["timeout"] = autorest.Encode("query", 30)
653	}
654
655	preparer := autorest.CreatePreparer(
656		autorest.AsGet(),
657		autorest.WithBaseURL(client.BaseURI),
658		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/remoteloginsettings", pathParameters),
659		autorest.WithQueryParameters(queryParameters))
660	if clientRequestID != nil {
661		preparer = autorest.DecoratePreparer(preparer,
662			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
663	}
664	if returnClientRequestID != nil {
665		preparer = autorest.DecoratePreparer(preparer,
666			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
667	} else {
668		preparer = autorest.DecoratePreparer(preparer,
669			autorest.WithHeader("return-client-request-id", autorest.String(false)))
670	}
671	if ocpDate != nil {
672		preparer = autorest.DecoratePreparer(preparer,
673			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
674	}
675	return preparer.Prepare((&http.Request{}).WithContext(ctx))
676}
677
678// GetRemoteLoginSettingsSender sends the GetRemoteLoginSettings request. The method will close the
679// http.Response Body if it receives an error.
680func (client ComputeNodeClient) GetRemoteLoginSettingsSender(req *http.Request) (*http.Response, error) {
681	return autorest.SendWithSender(client, req,
682		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
683}
684
685// GetRemoteLoginSettingsResponder handles the response to the GetRemoteLoginSettings request. The method always
686// closes the http.Response Body.
687func (client ComputeNodeClient) GetRemoteLoginSettingsResponder(resp *http.Response) (result ComputeNodeGetRemoteLoginSettingsResult, err error) {
688	err = autorest.Respond(
689		resp,
690		client.ByInspecting(),
691		azure.WithErrorUnlessStatusCode(http.StatusOK),
692		autorest.ByUnmarshallingJSON(&result),
693		autorest.ByClosing())
694	result.Response = autorest.Response{Response: resp}
695	return
696}
697
698// List sends the list request.
699//
700// poolID is the ID of the pool from which you want to list nodes. filter is an OData $filter clause..
701// selectParameter is an OData $select clause. maxResults is the maximum number of items to return in the response.
702// A maximum of 1000 nodes can be returned. timeout is the maximum time that the server can spend processing the
703// request, in seconds. The default is 30 seconds. clientRequestID is the caller-generated request identity, in the
704// form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.
705// returnClientRequestID is whether the server should return the client-request-id in the response. ocpDate is the
706// time the request was issued. Client libraries typically set this to the current system clock time; set it
707// explicitly if you are calling the REST API directly.
708func (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) {
709	if err := validation.Validate([]validation.Validation{
710		{TargetValue: maxResults,
711			Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false,
712				Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: 1000, Chain: nil},
713					{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
714				}}}}}); err != nil {
715		return result, validation.NewError("batch.ComputeNodeClient", "List", err.Error())
716	}
717
718	result.fn = client.listNextResults
719	req, err := client.ListPreparer(ctx, poolID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate)
720	if err != nil {
721		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "List", nil, "Failure preparing request")
722		return
723	}
724
725	resp, err := client.ListSender(req)
726	if err != nil {
727		result.cnlr.Response = autorest.Response{Response: resp}
728		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "List", resp, "Failure sending request")
729		return
730	}
731
732	result.cnlr, err = client.ListResponder(resp)
733	if err != nil {
734		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "List", resp, "Failure responding to request")
735	}
736
737	return
738}
739
740// ListPreparer prepares the List request.
741func (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) {
742	pathParameters := map[string]interface{}{
743		"poolId": autorest.Encode("path", poolID),
744	}
745
746	const APIVersion = "2017-06-01.5.1"
747	queryParameters := map[string]interface{}{
748		"api-version": APIVersion,
749	}
750	if len(filter) > 0 {
751		queryParameters["$filter"] = autorest.Encode("query", filter)
752	}
753	if len(selectParameter) > 0 {
754		queryParameters["$select"] = autorest.Encode("query", selectParameter)
755	}
756	if maxResults != nil {
757		queryParameters["maxresults"] = autorest.Encode("query", *maxResults)
758	} else {
759		queryParameters["maxresults"] = autorest.Encode("query", 1000)
760	}
761	if timeout != nil {
762		queryParameters["timeout"] = autorest.Encode("query", *timeout)
763	} else {
764		queryParameters["timeout"] = autorest.Encode("query", 30)
765	}
766
767	preparer := autorest.CreatePreparer(
768		autorest.AsGet(),
769		autorest.WithBaseURL(client.BaseURI),
770		autorest.WithPathParameters("/pools/{poolId}/nodes", pathParameters),
771		autorest.WithQueryParameters(queryParameters))
772	if clientRequestID != nil {
773		preparer = autorest.DecoratePreparer(preparer,
774			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
775	}
776	if returnClientRequestID != nil {
777		preparer = autorest.DecoratePreparer(preparer,
778			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
779	} else {
780		preparer = autorest.DecoratePreparer(preparer,
781			autorest.WithHeader("return-client-request-id", autorest.String(false)))
782	}
783	if ocpDate != nil {
784		preparer = autorest.DecoratePreparer(preparer,
785			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
786	}
787	return preparer.Prepare((&http.Request{}).WithContext(ctx))
788}
789
790// ListSender sends the List request. The method will close the
791// http.Response Body if it receives an error.
792func (client ComputeNodeClient) ListSender(req *http.Request) (*http.Response, error) {
793	return autorest.SendWithSender(client, req,
794		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
795}
796
797// ListResponder handles the response to the List request. The method always
798// closes the http.Response Body.
799func (client ComputeNodeClient) ListResponder(resp *http.Response) (result ComputeNodeListResult, err error) {
800	err = autorest.Respond(
801		resp,
802		client.ByInspecting(),
803		azure.WithErrorUnlessStatusCode(http.StatusOK),
804		autorest.ByUnmarshallingJSON(&result),
805		autorest.ByClosing())
806	result.Response = autorest.Response{Response: resp}
807	return
808}
809
810// listNextResults retrieves the next set of results, if any.
811func (client ComputeNodeClient) listNextResults(lastResults ComputeNodeListResult) (result ComputeNodeListResult, err error) {
812	req, err := lastResults.computeNodeListResultPreparer()
813	if err != nil {
814		return result, autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "listNextResults", nil, "Failure preparing next results request")
815	}
816	if req == nil {
817		return
818	}
819	resp, err := client.ListSender(req)
820	if err != nil {
821		result.Response = autorest.Response{Response: resp}
822		return result, autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "listNextResults", resp, "Failure sending next results request")
823	}
824	result, err = client.ListResponder(resp)
825	if err != nil {
826		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "listNextResults", resp, "Failure responding to next results request")
827	}
828	return
829}
830
831// ListComplete enumerates all values, automatically crossing page boundaries as required.
832func (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) {
833	result.page, err = client.List(ctx, poolID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate)
834	return
835}
836
837// Reboot you can restart a node only if it is in an idle or running state.
838//
839// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that you want
840// to restart. nodeRebootParameter is the parameters for the request. timeout is the maximum time that the server
841// can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is the caller-generated
842// request identity, in the form of a GUID with no decoration such as curly braces, e.g.
843// 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. returnClientRequestID is whether the server should return the
844// client-request-id in the response. ocpDate is the time the request was issued. Client libraries typically set
845// this to the current system clock time; set it explicitly if you are calling the REST API directly.
846func (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) {
847	req, err := client.RebootPreparer(ctx, poolID, nodeID, nodeRebootParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
848	if err != nil {
849		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reboot", nil, "Failure preparing request")
850		return
851	}
852
853	resp, err := client.RebootSender(req)
854	if err != nil {
855		result.Response = resp
856		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reboot", resp, "Failure sending request")
857		return
858	}
859
860	result, err = client.RebootResponder(resp)
861	if err != nil {
862		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reboot", resp, "Failure responding to request")
863	}
864
865	return
866}
867
868// RebootPreparer prepares the Reboot request.
869func (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) {
870	pathParameters := map[string]interface{}{
871		"nodeId": autorest.Encode("path", nodeID),
872		"poolId": autorest.Encode("path", poolID),
873	}
874
875	const APIVersion = "2017-06-01.5.1"
876	queryParameters := map[string]interface{}{
877		"api-version": APIVersion,
878	}
879	if timeout != nil {
880		queryParameters["timeout"] = autorest.Encode("query", *timeout)
881	} else {
882		queryParameters["timeout"] = autorest.Encode("query", 30)
883	}
884
885	preparer := autorest.CreatePreparer(
886		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
887		autorest.AsPost(),
888		autorest.WithBaseURL(client.BaseURI),
889		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/reboot", pathParameters),
890		autorest.WithQueryParameters(queryParameters))
891	if nodeRebootParameter != nil {
892		preparer = autorest.DecoratePreparer(preparer,
893			autorest.WithJSON(nodeRebootParameter))
894	}
895	if clientRequestID != nil {
896		preparer = autorest.DecoratePreparer(preparer,
897			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
898	}
899	if returnClientRequestID != nil {
900		preparer = autorest.DecoratePreparer(preparer,
901			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
902	} else {
903		preparer = autorest.DecoratePreparer(preparer,
904			autorest.WithHeader("return-client-request-id", autorest.String(false)))
905	}
906	if ocpDate != nil {
907		preparer = autorest.DecoratePreparer(preparer,
908			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
909	}
910	return preparer.Prepare((&http.Request{}).WithContext(ctx))
911}
912
913// RebootSender sends the Reboot request. The method will close the
914// http.Response Body if it receives an error.
915func (client ComputeNodeClient) RebootSender(req *http.Request) (*http.Response, error) {
916	return autorest.SendWithSender(client, req,
917		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
918}
919
920// RebootResponder handles the response to the Reboot request. The method always
921// closes the http.Response Body.
922func (client ComputeNodeClient) RebootResponder(resp *http.Response) (result autorest.Response, err error) {
923	err = autorest.Respond(
924		resp,
925		client.ByInspecting(),
926		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
927		autorest.ByClosing())
928	result.Response = resp
929	return
930}
931
932// Reimage you can reinstall the operating system on a node only if it is in an idle or running state. This API can be
933// invoked only on pools created with the cloud service configuration property.
934//
935// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that you want
936// to restart. nodeReimageParameter is the parameters for the request. timeout is the maximum time that the server
937// can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is the caller-generated
938// request identity, in the form of a GUID with no decoration such as curly braces, e.g.
939// 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. returnClientRequestID is whether the server should return the
940// client-request-id in the response. ocpDate is the time the request was issued. Client libraries typically set
941// this to the current system clock time; set it explicitly if you are calling the REST API directly.
942func (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) {
943	req, err := client.ReimagePreparer(ctx, poolID, nodeID, nodeReimageParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
944	if err != nil {
945		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reimage", nil, "Failure preparing request")
946		return
947	}
948
949	resp, err := client.ReimageSender(req)
950	if err != nil {
951		result.Response = resp
952		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reimage", resp, "Failure sending request")
953		return
954	}
955
956	result, err = client.ReimageResponder(resp)
957	if err != nil {
958		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reimage", resp, "Failure responding to request")
959	}
960
961	return
962}
963
964// ReimagePreparer prepares the Reimage request.
965func (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) {
966	pathParameters := map[string]interface{}{
967		"nodeId": autorest.Encode("path", nodeID),
968		"poolId": autorest.Encode("path", poolID),
969	}
970
971	const APIVersion = "2017-06-01.5.1"
972	queryParameters := map[string]interface{}{
973		"api-version": APIVersion,
974	}
975	if timeout != nil {
976		queryParameters["timeout"] = autorest.Encode("query", *timeout)
977	} else {
978		queryParameters["timeout"] = autorest.Encode("query", 30)
979	}
980
981	preparer := autorest.CreatePreparer(
982		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
983		autorest.AsPost(),
984		autorest.WithBaseURL(client.BaseURI),
985		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/reimage", pathParameters),
986		autorest.WithQueryParameters(queryParameters))
987	if nodeReimageParameter != nil {
988		preparer = autorest.DecoratePreparer(preparer,
989			autorest.WithJSON(nodeReimageParameter))
990	}
991	if clientRequestID != nil {
992		preparer = autorest.DecoratePreparer(preparer,
993			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
994	}
995	if returnClientRequestID != nil {
996		preparer = autorest.DecoratePreparer(preparer,
997			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
998	} else {
999		preparer = autorest.DecoratePreparer(preparer,
1000			autorest.WithHeader("return-client-request-id", autorest.String(false)))
1001	}
1002	if ocpDate != nil {
1003		preparer = autorest.DecoratePreparer(preparer,
1004			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
1005	}
1006	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1007}
1008
1009// ReimageSender sends the Reimage request. The method will close the
1010// http.Response Body if it receives an error.
1011func (client ComputeNodeClient) ReimageSender(req *http.Request) (*http.Response, error) {
1012	return autorest.SendWithSender(client, req,
1013		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1014}
1015
1016// ReimageResponder handles the response to the Reimage request. The method always
1017// closes the http.Response Body.
1018func (client ComputeNodeClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) {
1019	err = autorest.Respond(
1020		resp,
1021		client.ByInspecting(),
1022		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1023		autorest.ByClosing())
1024	result.Response = resp
1025	return
1026}
1027
1028// UpdateUser this operation replaces of all the updateable properties of the account. For example, if the expiryTime
1029// element is not specified, the current value is replaced with the default value, not left unmodified. You can update
1030// a user account on a node only when it is in the idle or running state.
1031//
1032// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the machine on which you want
1033// to update a user account. userName is the name of the user account to update. nodeUpdateUserParameter is the
1034// parameters for the request. timeout is the maximum time that the server can spend processing the request, in
1035// seconds. The default is 30 seconds. clientRequestID is the caller-generated request identity, in the form of a
1036// GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. returnClientRequestID
1037// is whether the server should return the client-request-id in the response. ocpDate is the time the request was
1038// issued. Client libraries typically set this to the current system clock time; set it explicitly if you are
1039// calling the REST API directly.
1040func (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) {
1041	req, err := client.UpdateUserPreparer(ctx, poolID, nodeID, userName, nodeUpdateUserParameter, timeout, clientRequestID, returnClientRequestID, ocpDate)
1042	if err != nil {
1043		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UpdateUser", nil, "Failure preparing request")
1044		return
1045	}
1046
1047	resp, err := client.UpdateUserSender(req)
1048	if err != nil {
1049		result.Response = resp
1050		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UpdateUser", resp, "Failure sending request")
1051		return
1052	}
1053
1054	result, err = client.UpdateUserResponder(resp)
1055	if err != nil {
1056		err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UpdateUser", resp, "Failure responding to request")
1057	}
1058
1059	return
1060}
1061
1062// UpdateUserPreparer prepares the UpdateUser request.
1063func (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) {
1064	pathParameters := map[string]interface{}{
1065		"nodeId":   autorest.Encode("path", nodeID),
1066		"poolId":   autorest.Encode("path", poolID),
1067		"userName": autorest.Encode("path", userName),
1068	}
1069
1070	const APIVersion = "2017-06-01.5.1"
1071	queryParameters := map[string]interface{}{
1072		"api-version": APIVersion,
1073	}
1074	if timeout != nil {
1075		queryParameters["timeout"] = autorest.Encode("query", *timeout)
1076	} else {
1077		queryParameters["timeout"] = autorest.Encode("query", 30)
1078	}
1079
1080	preparer := autorest.CreatePreparer(
1081		autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"),
1082		autorest.AsPut(),
1083		autorest.WithBaseURL(client.BaseURI),
1084		autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/users/{userName}", pathParameters),
1085		autorest.WithJSON(nodeUpdateUserParameter),
1086		autorest.WithQueryParameters(queryParameters))
1087	if clientRequestID != nil {
1088		preparer = autorest.DecoratePreparer(preparer,
1089			autorest.WithHeader("client-request-id", autorest.String(clientRequestID)))
1090	}
1091	if returnClientRequestID != nil {
1092		preparer = autorest.DecoratePreparer(preparer,
1093			autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID)))
1094	} else {
1095		preparer = autorest.DecoratePreparer(preparer,
1096			autorest.WithHeader("return-client-request-id", autorest.String(false)))
1097	}
1098	if ocpDate != nil {
1099		preparer = autorest.DecoratePreparer(preparer,
1100			autorest.WithHeader("ocp-date", autorest.String(ocpDate)))
1101	}
1102	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1103}
1104
1105// UpdateUserSender sends the UpdateUser request. The method will close the
1106// http.Response Body if it receives an error.
1107func (client ComputeNodeClient) UpdateUserSender(req *http.Request) (*http.Response, error) {
1108	return autorest.SendWithSender(client, req,
1109		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1110}
1111
1112// UpdateUserResponder handles the response to the UpdateUser request. The method always
1113// closes the http.Response Body.
1114func (client ComputeNodeClient) UpdateUserResponder(resp *http.Response) (result autorest.Response, err error) {
1115	err = autorest.Respond(
1116		resp,
1117		client.ByInspecting(),
1118		azure.WithErrorUnlessStatusCode(http.StatusOK),
1119		autorest.ByClosing())
1120	result.Response = resp
1121	return
1122}
1123