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