1package databoxedge
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"github.com/Azure/go-autorest/autorest"
12	"github.com/Azure/go-autorest/autorest/azure"
13	"github.com/Azure/go-autorest/autorest/validation"
14	"github.com/Azure/go-autorest/tracing"
15	"net/http"
16)
17
18// DevicesClient is the client for the Devices methods of the Databoxedge service.
19type DevicesClient struct {
20	BaseClient
21}
22
23// NewDevicesClient creates an instance of the DevicesClient client.
24func NewDevicesClient(subscriptionID string) DevicesClient {
25	return NewDevicesClientWithBaseURI(DefaultBaseURI, subscriptionID)
26}
27
28// NewDevicesClientWithBaseURI creates an instance of the DevicesClient client using a custom endpoint.  Use this when
29// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
30func NewDevicesClientWithBaseURI(baseURI string, subscriptionID string) DevicesClient {
31	return DevicesClient{NewWithBaseURI(baseURI, subscriptionID)}
32}
33
34// CreateOrUpdate creates or updates a Data Box Edge/Data Box Gateway resource.
35// Parameters:
36// deviceName - the device name.
37// dataBoxEdgeDevice - the resource object.
38// resourceGroupName - the resource group name.
39func (client DevicesClient) CreateOrUpdate(ctx context.Context, deviceName string, dataBoxEdgeDevice Device, resourceGroupName string) (result DevicesCreateOrUpdateFuture, err error) {
40	if tracing.IsEnabled() {
41		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.CreateOrUpdate")
42		defer func() {
43			sc := -1
44			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
45				sc = result.FutureAPI.Response().StatusCode
46			}
47			tracing.EndSpan(ctx, sc, err)
48		}()
49	}
50	if err := validation.Validate([]validation.Validation{
51		{TargetValue: dataBoxEdgeDevice,
52			Constraints: []validation.Constraint{{Target: "dataBoxEdgeDevice.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
53		return result, validation.NewError("databoxedge.DevicesClient", "CreateOrUpdate", err.Error())
54	}
55
56	req, err := client.CreateOrUpdatePreparer(ctx, deviceName, dataBoxEdgeDevice, resourceGroupName)
57	if err != nil {
58		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "CreateOrUpdate", nil, "Failure preparing request")
59		return
60	}
61
62	result, err = client.CreateOrUpdateSender(req)
63	if err != nil {
64		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "CreateOrUpdate", nil, "Failure sending request")
65		return
66	}
67
68	return
69}
70
71// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
72func (client DevicesClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, dataBoxEdgeDevice Device, resourceGroupName string) (*http.Request, error) {
73	pathParameters := map[string]interface{}{
74		"deviceName":        autorest.Encode("path", deviceName),
75		"resourceGroupName": autorest.Encode("path", resourceGroupName),
76		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
77	}
78
79	const APIVersion = "2020-12-01"
80	queryParameters := map[string]interface{}{
81		"api-version": APIVersion,
82	}
83
84	dataBoxEdgeDevice.Kind = ""
85	dataBoxEdgeDevice.DeviceProperties = nil
86	preparer := autorest.CreatePreparer(
87		autorest.AsContentType("application/json; charset=utf-8"),
88		autorest.AsPut(),
89		autorest.WithBaseURL(client.BaseURI),
90		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", pathParameters),
91		autorest.WithJSON(dataBoxEdgeDevice),
92		autorest.WithQueryParameters(queryParameters))
93	return preparer.Prepare((&http.Request{}).WithContext(ctx))
94}
95
96// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
97// http.Response Body if it receives an error.
98func (client DevicesClient) CreateOrUpdateSender(req *http.Request) (future DevicesCreateOrUpdateFuture, err error) {
99	var resp *http.Response
100	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
101	if err != nil {
102		return
103	}
104	var azf azure.Future
105	azf, err = azure.NewFutureFromResponse(resp)
106	future.FutureAPI = &azf
107	future.Result = future.result
108	return
109}
110
111// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
112// closes the http.Response Body.
113func (client DevicesClient) CreateOrUpdateResponder(resp *http.Response) (result Device, err error) {
114	err = autorest.Respond(
115		resp,
116		azure.WithErrorUnlessStatusCode(http.StatusOK),
117		autorest.ByUnmarshallingJSON(&result),
118		autorest.ByClosing())
119	result.Response = autorest.Response{Response: resp}
120	return
121}
122
123// CreateOrUpdateSecuritySettings updates the security settings on a Data Box Edge/Data Box Gateway device.
124// Parameters:
125// deviceName - the device name.
126// securitySettings - the security settings.
127// resourceGroupName - the resource group name.
128func (client DevicesClient) CreateOrUpdateSecuritySettings(ctx context.Context, deviceName string, securitySettings SecuritySettings, resourceGroupName string) (result DevicesCreateOrUpdateSecuritySettingsFuture, err error) {
129	if tracing.IsEnabled() {
130		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.CreateOrUpdateSecuritySettings")
131		defer func() {
132			sc := -1
133			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
134				sc = result.FutureAPI.Response().StatusCode
135			}
136			tracing.EndSpan(ctx, sc, err)
137		}()
138	}
139	if err := validation.Validate([]validation.Validation{
140		{TargetValue: securitySettings,
141			Constraints: []validation.Constraint{{Target: "securitySettings.SecuritySettingsProperties", Name: validation.Null, Rule: true,
142				Chain: []validation.Constraint{{Target: "securitySettings.SecuritySettingsProperties.DeviceAdminPassword", Name: validation.Null, Rule: true,
143					Chain: []validation.Constraint{{Target: "securitySettings.SecuritySettingsProperties.DeviceAdminPassword.Value", Name: validation.Null, Rule: true, Chain: nil}}},
144				}}}}}); err != nil {
145		return result, validation.NewError("databoxedge.DevicesClient", "CreateOrUpdateSecuritySettings", err.Error())
146	}
147
148	req, err := client.CreateOrUpdateSecuritySettingsPreparer(ctx, deviceName, securitySettings, resourceGroupName)
149	if err != nil {
150		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "CreateOrUpdateSecuritySettings", nil, "Failure preparing request")
151		return
152	}
153
154	result, err = client.CreateOrUpdateSecuritySettingsSender(req)
155	if err != nil {
156		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "CreateOrUpdateSecuritySettings", nil, "Failure sending request")
157		return
158	}
159
160	return
161}
162
163// CreateOrUpdateSecuritySettingsPreparer prepares the CreateOrUpdateSecuritySettings request.
164func (client DevicesClient) CreateOrUpdateSecuritySettingsPreparer(ctx context.Context, deviceName string, securitySettings SecuritySettings, resourceGroupName string) (*http.Request, error) {
165	pathParameters := map[string]interface{}{
166		"deviceName":        autorest.Encode("path", deviceName),
167		"resourceGroupName": autorest.Encode("path", resourceGroupName),
168		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
169	}
170
171	const APIVersion = "2020-12-01"
172	queryParameters := map[string]interface{}{
173		"api-version": APIVersion,
174	}
175
176	preparer := autorest.CreatePreparer(
177		autorest.AsContentType("application/json; charset=utf-8"),
178		autorest.AsPost(),
179		autorest.WithBaseURL(client.BaseURI),
180		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update", pathParameters),
181		autorest.WithJSON(securitySettings),
182		autorest.WithQueryParameters(queryParameters))
183	return preparer.Prepare((&http.Request{}).WithContext(ctx))
184}
185
186// CreateOrUpdateSecuritySettingsSender sends the CreateOrUpdateSecuritySettings request. The method will close the
187// http.Response Body if it receives an error.
188func (client DevicesClient) CreateOrUpdateSecuritySettingsSender(req *http.Request) (future DevicesCreateOrUpdateSecuritySettingsFuture, err error) {
189	var resp *http.Response
190	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
191	if err != nil {
192		return
193	}
194	var azf azure.Future
195	azf, err = azure.NewFutureFromResponse(resp)
196	future.FutureAPI = &azf
197	future.Result = future.result
198	return
199}
200
201// CreateOrUpdateSecuritySettingsResponder handles the response to the CreateOrUpdateSecuritySettings request. The method always
202// closes the http.Response Body.
203func (client DevicesClient) CreateOrUpdateSecuritySettingsResponder(resp *http.Response) (result autorest.Response, err error) {
204	err = autorest.Respond(
205		resp,
206		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
207		autorest.ByClosing())
208	result.Response = resp
209	return
210}
211
212// Delete deletes the Data Box Edge/Data Box Gateway device.
213// Parameters:
214// deviceName - the device name.
215// resourceGroupName - the resource group name.
216func (client DevicesClient) Delete(ctx context.Context, deviceName string, resourceGroupName string) (result DevicesDeleteFuture, err error) {
217	if tracing.IsEnabled() {
218		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.Delete")
219		defer func() {
220			sc := -1
221			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
222				sc = result.FutureAPI.Response().StatusCode
223			}
224			tracing.EndSpan(ctx, sc, err)
225		}()
226	}
227	req, err := client.DeletePreparer(ctx, deviceName, resourceGroupName)
228	if err != nil {
229		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Delete", nil, "Failure preparing request")
230		return
231	}
232
233	result, err = client.DeleteSender(req)
234	if err != nil {
235		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Delete", nil, "Failure sending request")
236		return
237	}
238
239	return
240}
241
242// DeletePreparer prepares the Delete request.
243func (client DevicesClient) DeletePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) {
244	pathParameters := map[string]interface{}{
245		"deviceName":        autorest.Encode("path", deviceName),
246		"resourceGroupName": autorest.Encode("path", resourceGroupName),
247		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
248	}
249
250	const APIVersion = "2020-12-01"
251	queryParameters := map[string]interface{}{
252		"api-version": APIVersion,
253	}
254
255	preparer := autorest.CreatePreparer(
256		autorest.AsDelete(),
257		autorest.WithBaseURL(client.BaseURI),
258		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", pathParameters),
259		autorest.WithQueryParameters(queryParameters))
260	return preparer.Prepare((&http.Request{}).WithContext(ctx))
261}
262
263// DeleteSender sends the Delete request. The method will close the
264// http.Response Body if it receives an error.
265func (client DevicesClient) DeleteSender(req *http.Request) (future DevicesDeleteFuture, err error) {
266	var resp *http.Response
267	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
268	if err != nil {
269		return
270	}
271	var azf azure.Future
272	azf, err = azure.NewFutureFromResponse(resp)
273	future.FutureAPI = &azf
274	future.Result = future.result
275	return
276}
277
278// DeleteResponder handles the response to the Delete request. The method always
279// closes the http.Response Body.
280func (client DevicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
281	err = autorest.Respond(
282		resp,
283		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
284		autorest.ByClosing())
285	result.Response = resp
286	return
287}
288
289// DownloadUpdates sends the download updates request.
290// Parameters:
291// deviceName - the device name.
292// resourceGroupName - the resource group name.
293func (client DevicesClient) DownloadUpdates(ctx context.Context, deviceName string, resourceGroupName string) (result DevicesDownloadUpdatesFuture, err error) {
294	if tracing.IsEnabled() {
295		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.DownloadUpdates")
296		defer func() {
297			sc := -1
298			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
299				sc = result.FutureAPI.Response().StatusCode
300			}
301			tracing.EndSpan(ctx, sc, err)
302		}()
303	}
304	req, err := client.DownloadUpdatesPreparer(ctx, deviceName, resourceGroupName)
305	if err != nil {
306		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "DownloadUpdates", nil, "Failure preparing request")
307		return
308	}
309
310	result, err = client.DownloadUpdatesSender(req)
311	if err != nil {
312		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "DownloadUpdates", nil, "Failure sending request")
313		return
314	}
315
316	return
317}
318
319// DownloadUpdatesPreparer prepares the DownloadUpdates request.
320func (client DevicesClient) DownloadUpdatesPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) {
321	pathParameters := map[string]interface{}{
322		"deviceName":        autorest.Encode("path", deviceName),
323		"resourceGroupName": autorest.Encode("path", resourceGroupName),
324		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
325	}
326
327	const APIVersion = "2020-12-01"
328	queryParameters := map[string]interface{}{
329		"api-version": APIVersion,
330	}
331
332	preparer := autorest.CreatePreparer(
333		autorest.AsPost(),
334		autorest.WithBaseURL(client.BaseURI),
335		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates", pathParameters),
336		autorest.WithQueryParameters(queryParameters))
337	return preparer.Prepare((&http.Request{}).WithContext(ctx))
338}
339
340// DownloadUpdatesSender sends the DownloadUpdates request. The method will close the
341// http.Response Body if it receives an error.
342func (client DevicesClient) DownloadUpdatesSender(req *http.Request) (future DevicesDownloadUpdatesFuture, err error) {
343	var resp *http.Response
344	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
345	if err != nil {
346		return
347	}
348	var azf azure.Future
349	azf, err = azure.NewFutureFromResponse(resp)
350	future.FutureAPI = &azf
351	future.Result = future.result
352	return
353}
354
355// DownloadUpdatesResponder handles the response to the DownloadUpdates request. The method always
356// closes the http.Response Body.
357func (client DevicesClient) DownloadUpdatesResponder(resp *http.Response) (result autorest.Response, err error) {
358	err = autorest.Respond(
359		resp,
360		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
361		autorest.ByClosing())
362	result.Response = resp
363	return
364}
365
366// GenerateCertificate generates certificate for activation key.
367// Parameters:
368// deviceName - the device name.
369// resourceGroupName - the resource group name.
370func (client DevicesClient) GenerateCertificate(ctx context.Context, deviceName string, resourceGroupName string) (result GenerateCertResponse, err error) {
371	if tracing.IsEnabled() {
372		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.GenerateCertificate")
373		defer func() {
374			sc := -1
375			if result.Response.Response != nil {
376				sc = result.Response.Response.StatusCode
377			}
378			tracing.EndSpan(ctx, sc, err)
379		}()
380	}
381	req, err := client.GenerateCertificatePreparer(ctx, deviceName, resourceGroupName)
382	if err != nil {
383		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GenerateCertificate", nil, "Failure preparing request")
384		return
385	}
386
387	resp, err := client.GenerateCertificateSender(req)
388	if err != nil {
389		result.Response = autorest.Response{Response: resp}
390		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GenerateCertificate", resp, "Failure sending request")
391		return
392	}
393
394	result, err = client.GenerateCertificateResponder(resp)
395	if err != nil {
396		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GenerateCertificate", resp, "Failure responding to request")
397		return
398	}
399
400	return
401}
402
403// GenerateCertificatePreparer prepares the GenerateCertificate request.
404func (client DevicesClient) GenerateCertificatePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) {
405	pathParameters := map[string]interface{}{
406		"deviceName":        autorest.Encode("path", deviceName),
407		"resourceGroupName": autorest.Encode("path", resourceGroupName),
408		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
409	}
410
411	const APIVersion = "2020-12-01"
412	queryParameters := map[string]interface{}{
413		"api-version": APIVersion,
414	}
415
416	preparer := autorest.CreatePreparer(
417		autorest.AsPost(),
418		autorest.WithBaseURL(client.BaseURI),
419		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate", pathParameters),
420		autorest.WithQueryParameters(queryParameters))
421	return preparer.Prepare((&http.Request{}).WithContext(ctx))
422}
423
424// GenerateCertificateSender sends the GenerateCertificate request. The method will close the
425// http.Response Body if it receives an error.
426func (client DevicesClient) GenerateCertificateSender(req *http.Request) (*http.Response, error) {
427	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
428}
429
430// GenerateCertificateResponder handles the response to the GenerateCertificate request. The method always
431// closes the http.Response Body.
432func (client DevicesClient) GenerateCertificateResponder(resp *http.Response) (result GenerateCertResponse, err error) {
433	err = autorest.Respond(
434		resp,
435		azure.WithErrorUnlessStatusCode(http.StatusOK),
436		autorest.ByUnmarshallingJSON(&result),
437		autorest.ByClosing())
438	result.Response = autorest.Response{Response: resp}
439	return
440}
441
442// Get gets the properties of the Data Box Edge/Data Box Gateway device.
443// Parameters:
444// deviceName - the device name.
445// resourceGroupName - the resource group name.
446func (client DevicesClient) Get(ctx context.Context, deviceName string, resourceGroupName string) (result Device, err error) {
447	if tracing.IsEnabled() {
448		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.Get")
449		defer func() {
450			sc := -1
451			if result.Response.Response != nil {
452				sc = result.Response.Response.StatusCode
453			}
454			tracing.EndSpan(ctx, sc, err)
455		}()
456	}
457	req, err := client.GetPreparer(ctx, deviceName, resourceGroupName)
458	if err != nil {
459		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Get", nil, "Failure preparing request")
460		return
461	}
462
463	resp, err := client.GetSender(req)
464	if err != nil {
465		result.Response = autorest.Response{Response: resp}
466		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Get", resp, "Failure sending request")
467		return
468	}
469
470	result, err = client.GetResponder(resp)
471	if err != nil {
472		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Get", resp, "Failure responding to request")
473		return
474	}
475
476	return
477}
478
479// GetPreparer prepares the Get request.
480func (client DevicesClient) GetPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) {
481	pathParameters := map[string]interface{}{
482		"deviceName":        autorest.Encode("path", deviceName),
483		"resourceGroupName": autorest.Encode("path", resourceGroupName),
484		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
485	}
486
487	const APIVersion = "2020-12-01"
488	queryParameters := map[string]interface{}{
489		"api-version": APIVersion,
490	}
491
492	preparer := autorest.CreatePreparer(
493		autorest.AsGet(),
494		autorest.WithBaseURL(client.BaseURI),
495		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", pathParameters),
496		autorest.WithQueryParameters(queryParameters))
497	return preparer.Prepare((&http.Request{}).WithContext(ctx))
498}
499
500// GetSender sends the Get request. The method will close the
501// http.Response Body if it receives an error.
502func (client DevicesClient) GetSender(req *http.Request) (*http.Response, error) {
503	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
504}
505
506// GetResponder handles the response to the Get request. The method always
507// closes the http.Response Body.
508func (client DevicesClient) GetResponder(resp *http.Response) (result Device, err error) {
509	err = autorest.Respond(
510		resp,
511		azure.WithErrorUnlessStatusCode(http.StatusOK),
512		autorest.ByUnmarshallingJSON(&result),
513		autorest.ByClosing())
514	result.Response = autorest.Response{Response: resp}
515	return
516}
517
518// GetExtendedInformation gets additional information for the specified Azure Stack Edge/Data Box Gateway device.
519// Parameters:
520// deviceName - the device name.
521// resourceGroupName - the resource group name.
522func (client DevicesClient) GetExtendedInformation(ctx context.Context, deviceName string, resourceGroupName string) (result DeviceExtendedInfo, err error) {
523	if tracing.IsEnabled() {
524		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.GetExtendedInformation")
525		defer func() {
526			sc := -1
527			if result.Response.Response != nil {
528				sc = result.Response.Response.StatusCode
529			}
530			tracing.EndSpan(ctx, sc, err)
531		}()
532	}
533	req, err := client.GetExtendedInformationPreparer(ctx, deviceName, resourceGroupName)
534	if err != nil {
535		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetExtendedInformation", nil, "Failure preparing request")
536		return
537	}
538
539	resp, err := client.GetExtendedInformationSender(req)
540	if err != nil {
541		result.Response = autorest.Response{Response: resp}
542		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetExtendedInformation", resp, "Failure sending request")
543		return
544	}
545
546	result, err = client.GetExtendedInformationResponder(resp)
547	if err != nil {
548		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetExtendedInformation", resp, "Failure responding to request")
549		return
550	}
551
552	return
553}
554
555// GetExtendedInformationPreparer prepares the GetExtendedInformation request.
556func (client DevicesClient) GetExtendedInformationPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) {
557	pathParameters := map[string]interface{}{
558		"deviceName":        autorest.Encode("path", deviceName),
559		"resourceGroupName": autorest.Encode("path", resourceGroupName),
560		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
561	}
562
563	const APIVersion = "2020-12-01"
564	queryParameters := map[string]interface{}{
565		"api-version": APIVersion,
566	}
567
568	preparer := autorest.CreatePreparer(
569		autorest.AsPost(),
570		autorest.WithBaseURL(client.BaseURI),
571		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation", pathParameters),
572		autorest.WithQueryParameters(queryParameters))
573	return preparer.Prepare((&http.Request{}).WithContext(ctx))
574}
575
576// GetExtendedInformationSender sends the GetExtendedInformation request. The method will close the
577// http.Response Body if it receives an error.
578func (client DevicesClient) GetExtendedInformationSender(req *http.Request) (*http.Response, error) {
579	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
580}
581
582// GetExtendedInformationResponder handles the response to the GetExtendedInformation request. The method always
583// closes the http.Response Body.
584func (client DevicesClient) GetExtendedInformationResponder(resp *http.Response) (result DeviceExtendedInfo, err error) {
585	err = autorest.Respond(
586		resp,
587		azure.WithErrorUnlessStatusCode(http.StatusOK),
588		autorest.ByUnmarshallingJSON(&result),
589		autorest.ByClosing())
590	result.Response = autorest.Response{Response: resp}
591	return
592}
593
594// GetNetworkSettings gets the network settings of the specified Data Box Edge/Data Box Gateway device.
595// Parameters:
596// deviceName - the device name.
597// resourceGroupName - the resource group name.
598func (client DevicesClient) GetNetworkSettings(ctx context.Context, deviceName string, resourceGroupName string) (result NetworkSettings, err error) {
599	if tracing.IsEnabled() {
600		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.GetNetworkSettings")
601		defer func() {
602			sc := -1
603			if result.Response.Response != nil {
604				sc = result.Response.Response.StatusCode
605			}
606			tracing.EndSpan(ctx, sc, err)
607		}()
608	}
609	req, err := client.GetNetworkSettingsPreparer(ctx, deviceName, resourceGroupName)
610	if err != nil {
611		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetNetworkSettings", nil, "Failure preparing request")
612		return
613	}
614
615	resp, err := client.GetNetworkSettingsSender(req)
616	if err != nil {
617		result.Response = autorest.Response{Response: resp}
618		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetNetworkSettings", resp, "Failure sending request")
619		return
620	}
621
622	result, err = client.GetNetworkSettingsResponder(resp)
623	if err != nil {
624		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetNetworkSettings", resp, "Failure responding to request")
625		return
626	}
627
628	return
629}
630
631// GetNetworkSettingsPreparer prepares the GetNetworkSettings request.
632func (client DevicesClient) GetNetworkSettingsPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) {
633	pathParameters := map[string]interface{}{
634		"deviceName":        autorest.Encode("path", deviceName),
635		"resourceGroupName": autorest.Encode("path", resourceGroupName),
636		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
637	}
638
639	const APIVersion = "2020-12-01"
640	queryParameters := map[string]interface{}{
641		"api-version": APIVersion,
642	}
643
644	preparer := autorest.CreatePreparer(
645		autorest.AsGet(),
646		autorest.WithBaseURL(client.BaseURI),
647		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default", pathParameters),
648		autorest.WithQueryParameters(queryParameters))
649	return preparer.Prepare((&http.Request{}).WithContext(ctx))
650}
651
652// GetNetworkSettingsSender sends the GetNetworkSettings request. The method will close the
653// http.Response Body if it receives an error.
654func (client DevicesClient) GetNetworkSettingsSender(req *http.Request) (*http.Response, error) {
655	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
656}
657
658// GetNetworkSettingsResponder handles the response to the GetNetworkSettings request. The method always
659// closes the http.Response Body.
660func (client DevicesClient) GetNetworkSettingsResponder(resp *http.Response) (result NetworkSettings, err error) {
661	err = autorest.Respond(
662		resp,
663		azure.WithErrorUnlessStatusCode(http.StatusOK),
664		autorest.ByUnmarshallingJSON(&result),
665		autorest.ByClosing())
666	result.Response = autorest.Response{Response: resp}
667	return
668}
669
670// GetUpdateSummary sends the get update summary request.
671// Parameters:
672// deviceName - the device name.
673// resourceGroupName - the resource group name.
674func (client DevicesClient) GetUpdateSummary(ctx context.Context, deviceName string, resourceGroupName string) (result UpdateSummary, err error) {
675	if tracing.IsEnabled() {
676		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.GetUpdateSummary")
677		defer func() {
678			sc := -1
679			if result.Response.Response != nil {
680				sc = result.Response.Response.StatusCode
681			}
682			tracing.EndSpan(ctx, sc, err)
683		}()
684	}
685	req, err := client.GetUpdateSummaryPreparer(ctx, deviceName, resourceGroupName)
686	if err != nil {
687		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetUpdateSummary", nil, "Failure preparing request")
688		return
689	}
690
691	resp, err := client.GetUpdateSummarySender(req)
692	if err != nil {
693		result.Response = autorest.Response{Response: resp}
694		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetUpdateSummary", resp, "Failure sending request")
695		return
696	}
697
698	result, err = client.GetUpdateSummaryResponder(resp)
699	if err != nil {
700		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetUpdateSummary", resp, "Failure responding to request")
701		return
702	}
703
704	return
705}
706
707// GetUpdateSummaryPreparer prepares the GetUpdateSummary request.
708func (client DevicesClient) GetUpdateSummaryPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) {
709	pathParameters := map[string]interface{}{
710		"deviceName":        autorest.Encode("path", deviceName),
711		"resourceGroupName": autorest.Encode("path", resourceGroupName),
712		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
713	}
714
715	const APIVersion = "2020-12-01"
716	queryParameters := map[string]interface{}{
717		"api-version": APIVersion,
718	}
719
720	preparer := autorest.CreatePreparer(
721		autorest.AsGet(),
722		autorest.WithBaseURL(client.BaseURI),
723		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default", pathParameters),
724		autorest.WithQueryParameters(queryParameters))
725	return preparer.Prepare((&http.Request{}).WithContext(ctx))
726}
727
728// GetUpdateSummarySender sends the GetUpdateSummary request. The method will close the
729// http.Response Body if it receives an error.
730func (client DevicesClient) GetUpdateSummarySender(req *http.Request) (*http.Response, error) {
731	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
732}
733
734// GetUpdateSummaryResponder handles the response to the GetUpdateSummary request. The method always
735// closes the http.Response Body.
736func (client DevicesClient) GetUpdateSummaryResponder(resp *http.Response) (result UpdateSummary, err error) {
737	err = autorest.Respond(
738		resp,
739		azure.WithErrorUnlessStatusCode(http.StatusOK),
740		autorest.ByUnmarshallingJSON(&result),
741		autorest.ByClosing())
742	result.Response = autorest.Response{Response: resp}
743	return
744}
745
746// InstallUpdates sends the install updates request.
747// Parameters:
748// deviceName - the device name.
749// resourceGroupName - the resource group name.
750func (client DevicesClient) InstallUpdates(ctx context.Context, deviceName string, resourceGroupName string) (result DevicesInstallUpdatesFuture, err error) {
751	if tracing.IsEnabled() {
752		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.InstallUpdates")
753		defer func() {
754			sc := -1
755			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
756				sc = result.FutureAPI.Response().StatusCode
757			}
758			tracing.EndSpan(ctx, sc, err)
759		}()
760	}
761	req, err := client.InstallUpdatesPreparer(ctx, deviceName, resourceGroupName)
762	if err != nil {
763		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "InstallUpdates", nil, "Failure preparing request")
764		return
765	}
766
767	result, err = client.InstallUpdatesSender(req)
768	if err != nil {
769		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "InstallUpdates", nil, "Failure sending request")
770		return
771	}
772
773	return
774}
775
776// InstallUpdatesPreparer prepares the InstallUpdates request.
777func (client DevicesClient) InstallUpdatesPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) {
778	pathParameters := map[string]interface{}{
779		"deviceName":        autorest.Encode("path", deviceName),
780		"resourceGroupName": autorest.Encode("path", resourceGroupName),
781		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
782	}
783
784	const APIVersion = "2020-12-01"
785	queryParameters := map[string]interface{}{
786		"api-version": APIVersion,
787	}
788
789	preparer := autorest.CreatePreparer(
790		autorest.AsPost(),
791		autorest.WithBaseURL(client.BaseURI),
792		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates", pathParameters),
793		autorest.WithQueryParameters(queryParameters))
794	return preparer.Prepare((&http.Request{}).WithContext(ctx))
795}
796
797// InstallUpdatesSender sends the InstallUpdates request. The method will close the
798// http.Response Body if it receives an error.
799func (client DevicesClient) InstallUpdatesSender(req *http.Request) (future DevicesInstallUpdatesFuture, err error) {
800	var resp *http.Response
801	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
802	if err != nil {
803		return
804	}
805	var azf azure.Future
806	azf, err = azure.NewFutureFromResponse(resp)
807	future.FutureAPI = &azf
808	future.Result = future.result
809	return
810}
811
812// InstallUpdatesResponder handles the response to the InstallUpdates request. The method always
813// closes the http.Response Body.
814func (client DevicesClient) InstallUpdatesResponder(resp *http.Response) (result autorest.Response, err error) {
815	err = autorest.Respond(
816		resp,
817		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
818		autorest.ByClosing())
819	result.Response = resp
820	return
821}
822
823// ListByResourceGroup gets all the Data Box Edge/Data Box Gateway devices in a resource group.
824// Parameters:
825// resourceGroupName - the resource group name.
826// expand - specify $expand=details to populate additional fields related to the resource or Specify
827// $skipToken=<token> to populate the next page in the list.
828func (client DevicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string) (result DeviceListPage, err error) {
829	if tracing.IsEnabled() {
830		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ListByResourceGroup")
831		defer func() {
832			sc := -1
833			if result.dl.Response.Response != nil {
834				sc = result.dl.Response.Response.StatusCode
835			}
836			tracing.EndSpan(ctx, sc, err)
837		}()
838	}
839	result.fn = client.listByResourceGroupNextResults
840	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, expand)
841	if err != nil {
842		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListByResourceGroup", nil, "Failure preparing request")
843		return
844	}
845
846	resp, err := client.ListByResourceGroupSender(req)
847	if err != nil {
848		result.dl.Response = autorest.Response{Response: resp}
849		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListByResourceGroup", resp, "Failure sending request")
850		return
851	}
852
853	result.dl, err = client.ListByResourceGroupResponder(resp)
854	if err != nil {
855		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListByResourceGroup", resp, "Failure responding to request")
856		return
857	}
858	if result.dl.hasNextLink() && result.dl.IsEmpty() {
859		err = result.NextWithContext(ctx)
860		return
861	}
862
863	return
864}
865
866// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
867func (client DevicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, expand string) (*http.Request, error) {
868	pathParameters := map[string]interface{}{
869		"resourceGroupName": autorest.Encode("path", resourceGroupName),
870		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
871	}
872
873	const APIVersion = "2020-12-01"
874	queryParameters := map[string]interface{}{
875		"api-version": APIVersion,
876	}
877	if len(expand) > 0 {
878		queryParameters["$expand"] = autorest.Encode("query", expand)
879	}
880
881	preparer := autorest.CreatePreparer(
882		autorest.AsGet(),
883		autorest.WithBaseURL(client.BaseURI),
884		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices", pathParameters),
885		autorest.WithQueryParameters(queryParameters))
886	return preparer.Prepare((&http.Request{}).WithContext(ctx))
887}
888
889// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
890// http.Response Body if it receives an error.
891func (client DevicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
892	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
893}
894
895// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
896// closes the http.Response Body.
897func (client DevicesClient) ListByResourceGroupResponder(resp *http.Response) (result DeviceList, err error) {
898	err = autorest.Respond(
899		resp,
900		azure.WithErrorUnlessStatusCode(http.StatusOK),
901		autorest.ByUnmarshallingJSON(&result),
902		autorest.ByClosing())
903	result.Response = autorest.Response{Response: resp}
904	return
905}
906
907// listByResourceGroupNextResults retrieves the next set of results, if any.
908func (client DevicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DeviceList) (result DeviceList, err error) {
909	req, err := lastResults.deviceListPreparer(ctx)
910	if err != nil {
911		return result, autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
912	}
913	if req == nil {
914		return
915	}
916	resp, err := client.ListByResourceGroupSender(req)
917	if err != nil {
918		result.Response = autorest.Response{Response: resp}
919		return result, autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
920	}
921	result, err = client.ListByResourceGroupResponder(resp)
922	if err != nil {
923		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
924	}
925	return
926}
927
928// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
929func (client DevicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string) (result DeviceListIterator, err error) {
930	if tracing.IsEnabled() {
931		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ListByResourceGroup")
932		defer func() {
933			sc := -1
934			if result.Response().Response.Response != nil {
935				sc = result.page.Response().Response.Response.StatusCode
936			}
937			tracing.EndSpan(ctx, sc, err)
938		}()
939	}
940	result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, expand)
941	return
942}
943
944// ListBySubscription gets all the Data Box Edge/Data Box Gateway devices in a subscription.
945// Parameters:
946// expand - specify $expand=details to populate additional fields related to the resource or Specify
947// $skipToken=<token> to populate the next page in the list.
948func (client DevicesClient) ListBySubscription(ctx context.Context, expand string) (result DeviceListPage, err error) {
949	if tracing.IsEnabled() {
950		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ListBySubscription")
951		defer func() {
952			sc := -1
953			if result.dl.Response.Response != nil {
954				sc = result.dl.Response.Response.StatusCode
955			}
956			tracing.EndSpan(ctx, sc, err)
957		}()
958	}
959	result.fn = client.listBySubscriptionNextResults
960	req, err := client.ListBySubscriptionPreparer(ctx, expand)
961	if err != nil {
962		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListBySubscription", nil, "Failure preparing request")
963		return
964	}
965
966	resp, err := client.ListBySubscriptionSender(req)
967	if err != nil {
968		result.dl.Response = autorest.Response{Response: resp}
969		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListBySubscription", resp, "Failure sending request")
970		return
971	}
972
973	result.dl, err = client.ListBySubscriptionResponder(resp)
974	if err != nil {
975		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListBySubscription", resp, "Failure responding to request")
976		return
977	}
978	if result.dl.hasNextLink() && result.dl.IsEmpty() {
979		err = result.NextWithContext(ctx)
980		return
981	}
982
983	return
984}
985
986// ListBySubscriptionPreparer prepares the ListBySubscription request.
987func (client DevicesClient) ListBySubscriptionPreparer(ctx context.Context, expand string) (*http.Request, error) {
988	pathParameters := map[string]interface{}{
989		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
990	}
991
992	const APIVersion = "2020-12-01"
993	queryParameters := map[string]interface{}{
994		"api-version": APIVersion,
995	}
996	if len(expand) > 0 {
997		queryParameters["$expand"] = autorest.Encode("query", expand)
998	}
999
1000	preparer := autorest.CreatePreparer(
1001		autorest.AsGet(),
1002		autorest.WithBaseURL(client.BaseURI),
1003		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices", pathParameters),
1004		autorest.WithQueryParameters(queryParameters))
1005	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1006}
1007
1008// ListBySubscriptionSender sends the ListBySubscription request. The method will close the
1009// http.Response Body if it receives an error.
1010func (client DevicesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
1011	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1012}
1013
1014// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
1015// closes the http.Response Body.
1016func (client DevicesClient) ListBySubscriptionResponder(resp *http.Response) (result DeviceList, err error) {
1017	err = autorest.Respond(
1018		resp,
1019		azure.WithErrorUnlessStatusCode(http.StatusOK),
1020		autorest.ByUnmarshallingJSON(&result),
1021		autorest.ByClosing())
1022	result.Response = autorest.Response{Response: resp}
1023	return
1024}
1025
1026// listBySubscriptionNextResults retrieves the next set of results, if any.
1027func (client DevicesClient) listBySubscriptionNextResults(ctx context.Context, lastResults DeviceList) (result DeviceList, err error) {
1028	req, err := lastResults.deviceListPreparer(ctx)
1029	if err != nil {
1030		return result, autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request")
1031	}
1032	if req == nil {
1033		return
1034	}
1035	resp, err := client.ListBySubscriptionSender(req)
1036	if err != nil {
1037		result.Response = autorest.Response{Response: resp}
1038		return result, autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request")
1039	}
1040	result, err = client.ListBySubscriptionResponder(resp)
1041	if err != nil {
1042		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request")
1043	}
1044	return
1045}
1046
1047// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required.
1048func (client DevicesClient) ListBySubscriptionComplete(ctx context.Context, expand string) (result DeviceListIterator, err error) {
1049	if tracing.IsEnabled() {
1050		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ListBySubscription")
1051		defer func() {
1052			sc := -1
1053			if result.Response().Response.Response != nil {
1054				sc = result.page.Response().Response.Response.StatusCode
1055			}
1056			tracing.EndSpan(ctx, sc, err)
1057		}()
1058	}
1059	result.page, err = client.ListBySubscription(ctx, expand)
1060	return
1061}
1062
1063// ScanForUpdates sends the scan for updates request.
1064// Parameters:
1065// deviceName - the device name.
1066// resourceGroupName - the resource group name.
1067func (client DevicesClient) ScanForUpdates(ctx context.Context, deviceName string, resourceGroupName string) (result DevicesScanForUpdatesFuture, err error) {
1068	if tracing.IsEnabled() {
1069		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ScanForUpdates")
1070		defer func() {
1071			sc := -1
1072			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1073				sc = result.FutureAPI.Response().StatusCode
1074			}
1075			tracing.EndSpan(ctx, sc, err)
1076		}()
1077	}
1078	req, err := client.ScanForUpdatesPreparer(ctx, deviceName, resourceGroupName)
1079	if err != nil {
1080		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ScanForUpdates", nil, "Failure preparing request")
1081		return
1082	}
1083
1084	result, err = client.ScanForUpdatesSender(req)
1085	if err != nil {
1086		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ScanForUpdates", nil, "Failure sending request")
1087		return
1088	}
1089
1090	return
1091}
1092
1093// ScanForUpdatesPreparer prepares the ScanForUpdates request.
1094func (client DevicesClient) ScanForUpdatesPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) {
1095	pathParameters := map[string]interface{}{
1096		"deviceName":        autorest.Encode("path", deviceName),
1097		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1098		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1099	}
1100
1101	const APIVersion = "2020-12-01"
1102	queryParameters := map[string]interface{}{
1103		"api-version": APIVersion,
1104	}
1105
1106	preparer := autorest.CreatePreparer(
1107		autorest.AsPost(),
1108		autorest.WithBaseURL(client.BaseURI),
1109		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates", pathParameters),
1110		autorest.WithQueryParameters(queryParameters))
1111	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1112}
1113
1114// ScanForUpdatesSender sends the ScanForUpdates request. The method will close the
1115// http.Response Body if it receives an error.
1116func (client DevicesClient) ScanForUpdatesSender(req *http.Request) (future DevicesScanForUpdatesFuture, err error) {
1117	var resp *http.Response
1118	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1119	if err != nil {
1120		return
1121	}
1122	var azf azure.Future
1123	azf, err = azure.NewFutureFromResponse(resp)
1124	future.FutureAPI = &azf
1125	future.Result = future.result
1126	return
1127}
1128
1129// ScanForUpdatesResponder handles the response to the ScanForUpdates request. The method always
1130// closes the http.Response Body.
1131func (client DevicesClient) ScanForUpdatesResponder(resp *http.Response) (result autorest.Response, err error) {
1132	err = autorest.Respond(
1133		resp,
1134		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1135		autorest.ByClosing())
1136	result.Response = resp
1137	return
1138}
1139
1140// Update modifies a Data Box Edge/Data Box Gateway resource.
1141// Parameters:
1142// deviceName - the device name.
1143// parameters - the resource parameters.
1144// resourceGroupName - the resource group name.
1145func (client DevicesClient) Update(ctx context.Context, deviceName string, parameters DevicePatch, resourceGroupName string) (result Device, err error) {
1146	if tracing.IsEnabled() {
1147		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.Update")
1148		defer func() {
1149			sc := -1
1150			if result.Response.Response != nil {
1151				sc = result.Response.Response.StatusCode
1152			}
1153			tracing.EndSpan(ctx, sc, err)
1154		}()
1155	}
1156	req, err := client.UpdatePreparer(ctx, deviceName, parameters, resourceGroupName)
1157	if err != nil {
1158		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Update", nil, "Failure preparing request")
1159		return
1160	}
1161
1162	resp, err := client.UpdateSender(req)
1163	if err != nil {
1164		result.Response = autorest.Response{Response: resp}
1165		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Update", resp, "Failure sending request")
1166		return
1167	}
1168
1169	result, err = client.UpdateResponder(resp)
1170	if err != nil {
1171		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Update", resp, "Failure responding to request")
1172		return
1173	}
1174
1175	return
1176}
1177
1178// UpdatePreparer prepares the Update request.
1179func (client DevicesClient) UpdatePreparer(ctx context.Context, deviceName string, parameters DevicePatch, resourceGroupName string) (*http.Request, error) {
1180	pathParameters := map[string]interface{}{
1181		"deviceName":        autorest.Encode("path", deviceName),
1182		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1183		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1184	}
1185
1186	const APIVersion = "2020-12-01"
1187	queryParameters := map[string]interface{}{
1188		"api-version": APIVersion,
1189	}
1190
1191	preparer := autorest.CreatePreparer(
1192		autorest.AsContentType("application/json; charset=utf-8"),
1193		autorest.AsPatch(),
1194		autorest.WithBaseURL(client.BaseURI),
1195		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", pathParameters),
1196		autorest.WithJSON(parameters),
1197		autorest.WithQueryParameters(queryParameters))
1198	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1199}
1200
1201// UpdateSender sends the Update request. The method will close the
1202// http.Response Body if it receives an error.
1203func (client DevicesClient) UpdateSender(req *http.Request) (*http.Response, error) {
1204	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1205}
1206
1207// UpdateResponder handles the response to the Update request. The method always
1208// closes the http.Response Body.
1209func (client DevicesClient) UpdateResponder(resp *http.Response) (result Device, err error) {
1210	err = autorest.Respond(
1211		resp,
1212		azure.WithErrorUnlessStatusCode(http.StatusOK),
1213		autorest.ByUnmarshallingJSON(&result),
1214		autorest.ByClosing())
1215	result.Response = autorest.Response{Response: resp}
1216	return
1217}
1218
1219// UpdateExtendedInformation gets additional information for the specified Data Box Edge/Data Box Gateway device.
1220// Parameters:
1221// deviceName - the device name.
1222// parameters - the patch object.
1223// resourceGroupName - the resource group name.
1224func (client DevicesClient) UpdateExtendedInformation(ctx context.Context, deviceName string, parameters DeviceExtendedInfoPatch, resourceGroupName string) (result DeviceExtendedInfo, err error) {
1225	if tracing.IsEnabled() {
1226		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.UpdateExtendedInformation")
1227		defer func() {
1228			sc := -1
1229			if result.Response.Response != nil {
1230				sc = result.Response.Response.StatusCode
1231			}
1232			tracing.EndSpan(ctx, sc, err)
1233		}()
1234	}
1235	req, err := client.UpdateExtendedInformationPreparer(ctx, deviceName, parameters, resourceGroupName)
1236	if err != nil {
1237		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UpdateExtendedInformation", nil, "Failure preparing request")
1238		return
1239	}
1240
1241	resp, err := client.UpdateExtendedInformationSender(req)
1242	if err != nil {
1243		result.Response = autorest.Response{Response: resp}
1244		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UpdateExtendedInformation", resp, "Failure sending request")
1245		return
1246	}
1247
1248	result, err = client.UpdateExtendedInformationResponder(resp)
1249	if err != nil {
1250		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UpdateExtendedInformation", resp, "Failure responding to request")
1251		return
1252	}
1253
1254	return
1255}
1256
1257// UpdateExtendedInformationPreparer prepares the UpdateExtendedInformation request.
1258func (client DevicesClient) UpdateExtendedInformationPreparer(ctx context.Context, deviceName string, parameters DeviceExtendedInfoPatch, resourceGroupName string) (*http.Request, error) {
1259	pathParameters := map[string]interface{}{
1260		"deviceName":        autorest.Encode("path", deviceName),
1261		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1262		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1263	}
1264
1265	const APIVersion = "2020-12-01"
1266	queryParameters := map[string]interface{}{
1267		"api-version": APIVersion,
1268	}
1269
1270	preparer := autorest.CreatePreparer(
1271		autorest.AsContentType("application/json; charset=utf-8"),
1272		autorest.AsPost(),
1273		autorest.WithBaseURL(client.BaseURI),
1274		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation", pathParameters),
1275		autorest.WithJSON(parameters),
1276		autorest.WithQueryParameters(queryParameters))
1277	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1278}
1279
1280// UpdateExtendedInformationSender sends the UpdateExtendedInformation request. The method will close the
1281// http.Response Body if it receives an error.
1282func (client DevicesClient) UpdateExtendedInformationSender(req *http.Request) (*http.Response, error) {
1283	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1284}
1285
1286// UpdateExtendedInformationResponder handles the response to the UpdateExtendedInformation request. The method always
1287// closes the http.Response Body.
1288func (client DevicesClient) UpdateExtendedInformationResponder(resp *http.Response) (result DeviceExtendedInfo, err error) {
1289	err = autorest.Respond(
1290		resp,
1291		azure.WithErrorUnlessStatusCode(http.StatusOK),
1292		autorest.ByUnmarshallingJSON(&result),
1293		autorest.ByClosing())
1294	result.Response = autorest.Response{Response: resp}
1295	return
1296}
1297
1298// UploadCertificate uploads registration certificate for the device.
1299// Parameters:
1300// deviceName - the device name.
1301// parameters - the upload certificate request.
1302// resourceGroupName - the resource group name.
1303func (client DevicesClient) UploadCertificate(ctx context.Context, deviceName string, parameters UploadCertificateRequest, resourceGroupName string) (result UploadCertificateResponse, err error) {
1304	if tracing.IsEnabled() {
1305		ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.UploadCertificate")
1306		defer func() {
1307			sc := -1
1308			if result.Response.Response != nil {
1309				sc = result.Response.Response.StatusCode
1310			}
1311			tracing.EndSpan(ctx, sc, err)
1312		}()
1313	}
1314	if err := validation.Validate([]validation.Validation{
1315		{TargetValue: parameters,
1316			Constraints: []validation.Constraint{{Target: "parameters.RawCertificateData", Name: validation.Null, Rule: true,
1317				Chain: []validation.Constraint{{Target: "parameters.RawCertificateData.Certificate", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
1318		return result, validation.NewError("databoxedge.DevicesClient", "UploadCertificate", err.Error())
1319	}
1320
1321	req, err := client.UploadCertificatePreparer(ctx, deviceName, parameters, resourceGroupName)
1322	if err != nil {
1323		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UploadCertificate", nil, "Failure preparing request")
1324		return
1325	}
1326
1327	resp, err := client.UploadCertificateSender(req)
1328	if err != nil {
1329		result.Response = autorest.Response{Response: resp}
1330		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UploadCertificate", resp, "Failure sending request")
1331		return
1332	}
1333
1334	result, err = client.UploadCertificateResponder(resp)
1335	if err != nil {
1336		err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UploadCertificate", resp, "Failure responding to request")
1337		return
1338	}
1339
1340	return
1341}
1342
1343// UploadCertificatePreparer prepares the UploadCertificate request.
1344func (client DevicesClient) UploadCertificatePreparer(ctx context.Context, deviceName string, parameters UploadCertificateRequest, resourceGroupName string) (*http.Request, error) {
1345	pathParameters := map[string]interface{}{
1346		"deviceName":        autorest.Encode("path", deviceName),
1347		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1348		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1349	}
1350
1351	const APIVersion = "2020-12-01"
1352	queryParameters := map[string]interface{}{
1353		"api-version": APIVersion,
1354	}
1355
1356	preparer := autorest.CreatePreparer(
1357		autorest.AsContentType("application/json; charset=utf-8"),
1358		autorest.AsPost(),
1359		autorest.WithBaseURL(client.BaseURI),
1360		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate", pathParameters),
1361		autorest.WithJSON(parameters),
1362		autorest.WithQueryParameters(queryParameters))
1363	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1364}
1365
1366// UploadCertificateSender sends the UploadCertificate request. The method will close the
1367// http.Response Body if it receives an error.
1368func (client DevicesClient) UploadCertificateSender(req *http.Request) (*http.Response, error) {
1369	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1370}
1371
1372// UploadCertificateResponder handles the response to the UploadCertificate request. The method always
1373// closes the http.Response Body.
1374func (client DevicesClient) UploadCertificateResponder(resp *http.Response) (result UploadCertificateResponse, err error) {
1375	err = autorest.Respond(
1376		resp,
1377		azure.WithErrorUnlessStatusCode(http.StatusOK),
1378		autorest.ByUnmarshallingJSON(&result),
1379		autorest.ByClosing())
1380	result.Response = autorest.Response{Response: resp}
1381	return
1382}
1383