/
devicesettings_client.go
634 lines (602 loc) · 33.2 KB
/
devicesettings_client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armstorsimple8000series
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"strings"
)
// DeviceSettingsClient contains the methods for the DeviceSettings group.
// Don't use this type directly, use NewDeviceSettingsClient() instead.
type DeviceSettingsClient struct {
internal *arm.Client
subscriptionID string
}
// NewDeviceSettingsClient creates a new instance of DeviceSettingsClient with the specified values.
// - subscriptionID - The subscription id
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewDeviceSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeviceSettingsClient, error) {
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
client := &DeviceSettingsClient{
subscriptionID: subscriptionID,
internal: cl,
}
return client, nil
}
// BeginCreateOrUpdateAlertSettings - Creates or updates the alert settings of the specified device.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
// - deviceName - The device name
// - resourceGroupName - The resource group name
// - managerName - The manager name
// - parameters - The alert settings to be added or updated.
// - options - DeviceSettingsClientBeginCreateOrUpdateAlertSettingsOptions contains the optional parameters for the DeviceSettingsClient.BeginCreateOrUpdateAlertSettings
// method.
func (client *DeviceSettingsClient) BeginCreateOrUpdateAlertSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters AlertSettings, options *DeviceSettingsClientBeginCreateOrUpdateAlertSettingsOptions) (*runtime.Poller[DeviceSettingsClientCreateOrUpdateAlertSettingsResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.createOrUpdateAlertSettings(ctx, deviceName, resourceGroupName, managerName, parameters, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceSettingsClientCreateOrUpdateAlertSettingsResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeviceSettingsClientCreateOrUpdateAlertSettingsResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// CreateOrUpdateAlertSettings - Creates or updates the alert settings of the specified device.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
func (client *DeviceSettingsClient) createOrUpdateAlertSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters AlertSettings, options *DeviceSettingsClientBeginCreateOrUpdateAlertSettingsOptions) (*http.Response, error) {
var err error
const operationName = "DeviceSettingsClient.BeginCreateOrUpdateAlertSettings"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.createOrUpdateAlertSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, parameters, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// createOrUpdateAlertSettingsCreateRequest creates the CreateOrUpdateAlertSettings request.
func (client *DeviceSettingsClient) createOrUpdateAlertSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters AlertSettings, options *DeviceSettingsClientBeginCreateOrUpdateAlertSettingsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/default"
urlPath = strings.ReplaceAll(urlPath, "{deviceName}", deviceName)
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", client.subscriptionID)
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", resourceGroupName)
urlPath = strings.ReplaceAll(urlPath, "{managerName}", managerName)
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2017-06-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
return nil, err
}
return req, nil
}
// BeginCreateOrUpdateTimeSettings - Creates or updates the time settings of the specified device.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
// - deviceName - The device name
// - resourceGroupName - The resource group name
// - managerName - The manager name
// - parameters - The time settings to be added or updated.
// - options - DeviceSettingsClientBeginCreateOrUpdateTimeSettingsOptions contains the optional parameters for the DeviceSettingsClient.BeginCreateOrUpdateTimeSettings
// method.
func (client *DeviceSettingsClient) BeginCreateOrUpdateTimeSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters TimeSettings, options *DeviceSettingsClientBeginCreateOrUpdateTimeSettingsOptions) (*runtime.Poller[DeviceSettingsClientCreateOrUpdateTimeSettingsResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.createOrUpdateTimeSettings(ctx, deviceName, resourceGroupName, managerName, parameters, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceSettingsClientCreateOrUpdateTimeSettingsResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeviceSettingsClientCreateOrUpdateTimeSettingsResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// CreateOrUpdateTimeSettings - Creates or updates the time settings of the specified device.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
func (client *DeviceSettingsClient) createOrUpdateTimeSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters TimeSettings, options *DeviceSettingsClientBeginCreateOrUpdateTimeSettingsOptions) (*http.Response, error) {
var err error
const operationName = "DeviceSettingsClient.BeginCreateOrUpdateTimeSettings"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.createOrUpdateTimeSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, parameters, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// createOrUpdateTimeSettingsCreateRequest creates the CreateOrUpdateTimeSettings request.
func (client *DeviceSettingsClient) createOrUpdateTimeSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters TimeSettings, options *DeviceSettingsClientBeginCreateOrUpdateTimeSettingsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/timeSettings/default"
urlPath = strings.ReplaceAll(urlPath, "{deviceName}", deviceName)
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", client.subscriptionID)
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", resourceGroupName)
urlPath = strings.ReplaceAll(urlPath, "{managerName}", managerName)
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2017-06-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
return nil, err
}
return req, nil
}
// GetAlertSettings - Gets the alert settings of the specified device.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
// - deviceName - The device name
// - resourceGroupName - The resource group name
// - managerName - The manager name
// - options - DeviceSettingsClientGetAlertSettingsOptions contains the optional parameters for the DeviceSettingsClient.GetAlertSettings
// method.
func (client *DeviceSettingsClient) GetAlertSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientGetAlertSettingsOptions) (DeviceSettingsClientGetAlertSettingsResponse, error) {
var err error
const operationName = "DeviceSettingsClient.GetAlertSettings"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getAlertSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, options)
if err != nil {
return DeviceSettingsClientGetAlertSettingsResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return DeviceSettingsClientGetAlertSettingsResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return DeviceSettingsClientGetAlertSettingsResponse{}, err
}
resp, err := client.getAlertSettingsHandleResponse(httpResp)
return resp, err
}
// getAlertSettingsCreateRequest creates the GetAlertSettings request.
func (client *DeviceSettingsClient) getAlertSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientGetAlertSettingsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/default"
urlPath = strings.ReplaceAll(urlPath, "{deviceName}", deviceName)
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", client.subscriptionID)
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", resourceGroupName)
urlPath = strings.ReplaceAll(urlPath, "{managerName}", managerName)
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2017-06-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getAlertSettingsHandleResponse handles the GetAlertSettings response.
func (client *DeviceSettingsClient) getAlertSettingsHandleResponse(resp *http.Response) (DeviceSettingsClientGetAlertSettingsResponse, error) {
result := DeviceSettingsClientGetAlertSettingsResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.AlertSettings); err != nil {
return DeviceSettingsClientGetAlertSettingsResponse{}, err
}
return result, nil
}
// GetNetworkSettings - Gets the network settings of the specified device.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
// - deviceName - The device name
// - resourceGroupName - The resource group name
// - managerName - The manager name
// - options - DeviceSettingsClientGetNetworkSettingsOptions contains the optional parameters for the DeviceSettingsClient.GetNetworkSettings
// method.
func (client *DeviceSettingsClient) GetNetworkSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientGetNetworkSettingsOptions) (DeviceSettingsClientGetNetworkSettingsResponse, error) {
var err error
const operationName = "DeviceSettingsClient.GetNetworkSettings"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getNetworkSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, options)
if err != nil {
return DeviceSettingsClientGetNetworkSettingsResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return DeviceSettingsClientGetNetworkSettingsResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return DeviceSettingsClientGetNetworkSettingsResponse{}, err
}
resp, err := client.getNetworkSettingsHandleResponse(httpResp)
return resp, err
}
// getNetworkSettingsCreateRequest creates the GetNetworkSettings request.
func (client *DeviceSettingsClient) getNetworkSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientGetNetworkSettingsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/networkSettings/default"
urlPath = strings.ReplaceAll(urlPath, "{deviceName}", deviceName)
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", client.subscriptionID)
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", resourceGroupName)
urlPath = strings.ReplaceAll(urlPath, "{managerName}", managerName)
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2017-06-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getNetworkSettingsHandleResponse handles the GetNetworkSettings response.
func (client *DeviceSettingsClient) getNetworkSettingsHandleResponse(resp *http.Response) (DeviceSettingsClientGetNetworkSettingsResponse, error) {
result := DeviceSettingsClientGetNetworkSettingsResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSettings); err != nil {
return DeviceSettingsClientGetNetworkSettingsResponse{}, err
}
return result, nil
}
// GetSecuritySettings - Returns the Security properties of the specified device name.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
// - deviceName - The device name
// - resourceGroupName - The resource group name
// - managerName - The manager name
// - options - DeviceSettingsClientGetSecuritySettingsOptions contains the optional parameters for the DeviceSettingsClient.GetSecuritySettings
// method.
func (client *DeviceSettingsClient) GetSecuritySettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientGetSecuritySettingsOptions) (DeviceSettingsClientGetSecuritySettingsResponse, error) {
var err error
const operationName = "DeviceSettingsClient.GetSecuritySettings"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getSecuritySettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, options)
if err != nil {
return DeviceSettingsClientGetSecuritySettingsResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return DeviceSettingsClientGetSecuritySettingsResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return DeviceSettingsClientGetSecuritySettingsResponse{}, err
}
resp, err := client.getSecuritySettingsHandleResponse(httpResp)
return resp, err
}
// getSecuritySettingsCreateRequest creates the GetSecuritySettings request.
func (client *DeviceSettingsClient) getSecuritySettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientGetSecuritySettingsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default"
urlPath = strings.ReplaceAll(urlPath, "{deviceName}", deviceName)
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", client.subscriptionID)
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", resourceGroupName)
urlPath = strings.ReplaceAll(urlPath, "{managerName}", managerName)
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2017-06-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getSecuritySettingsHandleResponse handles the GetSecuritySettings response.
func (client *DeviceSettingsClient) getSecuritySettingsHandleResponse(resp *http.Response) (DeviceSettingsClientGetSecuritySettingsResponse, error) {
result := DeviceSettingsClientGetSecuritySettingsResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySettings); err != nil {
return DeviceSettingsClientGetSecuritySettingsResponse{}, err
}
return result, nil
}
// GetTimeSettings - Gets the time settings of the specified device.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
// - deviceName - The device name
// - resourceGroupName - The resource group name
// - managerName - The manager name
// - options - DeviceSettingsClientGetTimeSettingsOptions contains the optional parameters for the DeviceSettingsClient.GetTimeSettings
// method.
func (client *DeviceSettingsClient) GetTimeSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientGetTimeSettingsOptions) (DeviceSettingsClientGetTimeSettingsResponse, error) {
var err error
const operationName = "DeviceSettingsClient.GetTimeSettings"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getTimeSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, options)
if err != nil {
return DeviceSettingsClientGetTimeSettingsResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return DeviceSettingsClientGetTimeSettingsResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return DeviceSettingsClientGetTimeSettingsResponse{}, err
}
resp, err := client.getTimeSettingsHandleResponse(httpResp)
return resp, err
}
// getTimeSettingsCreateRequest creates the GetTimeSettings request.
func (client *DeviceSettingsClient) getTimeSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientGetTimeSettingsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/timeSettings/default"
urlPath = strings.ReplaceAll(urlPath, "{deviceName}", deviceName)
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", client.subscriptionID)
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", resourceGroupName)
urlPath = strings.ReplaceAll(urlPath, "{managerName}", managerName)
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2017-06-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getTimeSettingsHandleResponse handles the GetTimeSettings response.
func (client *DeviceSettingsClient) getTimeSettingsHandleResponse(resp *http.Response) (DeviceSettingsClientGetTimeSettingsResponse, error) {
result := DeviceSettingsClientGetTimeSettingsResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.TimeSettings); err != nil {
return DeviceSettingsClientGetTimeSettingsResponse{}, err
}
return result, nil
}
// BeginSyncRemotemanagementCertificate - sync Remote management Certificate between appliance and Service
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
// - deviceName - The device name
// - resourceGroupName - The resource group name
// - managerName - The manager name
// - options - DeviceSettingsClientBeginSyncRemotemanagementCertificateOptions contains the optional parameters for the DeviceSettingsClient.BeginSyncRemotemanagementCertificate
// method.
func (client *DeviceSettingsClient) BeginSyncRemotemanagementCertificate(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientBeginSyncRemotemanagementCertificateOptions) (*runtime.Poller[DeviceSettingsClientSyncRemotemanagementCertificateResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.syncRemotemanagementCertificate(ctx, deviceName, resourceGroupName, managerName, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceSettingsClientSyncRemotemanagementCertificateResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeviceSettingsClientSyncRemotemanagementCertificateResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// SyncRemotemanagementCertificate - sync Remote management Certificate between appliance and Service
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
func (client *DeviceSettingsClient) syncRemotemanagementCertificate(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientBeginSyncRemotemanagementCertificateOptions) (*http.Response, error) {
var err error
const operationName = "DeviceSettingsClient.BeginSyncRemotemanagementCertificate"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.syncRemotemanagementCertificateCreateRequest(ctx, deviceName, resourceGroupName, managerName, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// syncRemotemanagementCertificateCreateRequest creates the SyncRemotemanagementCertificate request.
func (client *DeviceSettingsClient) syncRemotemanagementCertificateCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, options *DeviceSettingsClientBeginSyncRemotemanagementCertificateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default/syncRemoteManagementCertificate"
urlPath = strings.ReplaceAll(urlPath, "{deviceName}", deviceName)
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", client.subscriptionID)
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", resourceGroupName)
urlPath = strings.ReplaceAll(urlPath, "{managerName}", managerName)
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2017-06-01")
req.Raw().URL.RawQuery = reqQP.Encode()
return req, nil
}
// BeginUpdateNetworkSettings - Updates the network settings on the specified device.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
// - deviceName - The device name
// - resourceGroupName - The resource group name
// - managerName - The manager name
// - parameters - The network settings to be updated.
// - options - DeviceSettingsClientBeginUpdateNetworkSettingsOptions contains the optional parameters for the DeviceSettingsClient.BeginUpdateNetworkSettings
// method.
func (client *DeviceSettingsClient) BeginUpdateNetworkSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters NetworkSettingsPatch, options *DeviceSettingsClientBeginUpdateNetworkSettingsOptions) (*runtime.Poller[DeviceSettingsClientUpdateNetworkSettingsResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.updateNetworkSettings(ctx, deviceName, resourceGroupName, managerName, parameters, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceSettingsClientUpdateNetworkSettingsResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeviceSettingsClientUpdateNetworkSettingsResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// UpdateNetworkSettings - Updates the network settings on the specified device.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
func (client *DeviceSettingsClient) updateNetworkSettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters NetworkSettingsPatch, options *DeviceSettingsClientBeginUpdateNetworkSettingsOptions) (*http.Response, error) {
var err error
const operationName = "DeviceSettingsClient.BeginUpdateNetworkSettings"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.updateNetworkSettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, parameters, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// updateNetworkSettingsCreateRequest creates the UpdateNetworkSettings request.
func (client *DeviceSettingsClient) updateNetworkSettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters NetworkSettingsPatch, options *DeviceSettingsClientBeginUpdateNetworkSettingsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/networkSettings/default"
urlPath = strings.ReplaceAll(urlPath, "{deviceName}", deviceName)
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", client.subscriptionID)
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", resourceGroupName)
urlPath = strings.ReplaceAll(urlPath, "{managerName}", managerName)
req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2017-06-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
return nil, err
}
return req, nil
}
// BeginUpdateSecuritySettings - Patch Security properties of the specified device name.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
// - deviceName - The device name
// - resourceGroupName - The resource group name
// - managerName - The manager name
// - parameters - The security settings properties to be patched.
// - options - DeviceSettingsClientBeginUpdateSecuritySettingsOptions contains the optional parameters for the DeviceSettingsClient.BeginUpdateSecuritySettings
// method.
func (client *DeviceSettingsClient) BeginUpdateSecuritySettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters SecuritySettingsPatch, options *DeviceSettingsClientBeginUpdateSecuritySettingsOptions) (*runtime.Poller[DeviceSettingsClientUpdateSecuritySettingsResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.updateSecuritySettings(ctx, deviceName, resourceGroupName, managerName, parameters, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeviceSettingsClientUpdateSecuritySettingsResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeviceSettingsClientUpdateSecuritySettingsResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// UpdateSecuritySettings - Patch Security properties of the specified device name.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2017-06-01
func (client *DeviceSettingsClient) updateSecuritySettings(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters SecuritySettingsPatch, options *DeviceSettingsClientBeginUpdateSecuritySettingsOptions) (*http.Response, error) {
var err error
const operationName = "DeviceSettingsClient.BeginUpdateSecuritySettings"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.updateSecuritySettingsCreateRequest(ctx, deviceName, resourceGroupName, managerName, parameters, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// updateSecuritySettingsCreateRequest creates the UpdateSecuritySettings request.
func (client *DeviceSettingsClient) updateSecuritySettingsCreateRequest(ctx context.Context, deviceName string, resourceGroupName string, managerName string, parameters SecuritySettingsPatch, options *DeviceSettingsClientBeginUpdateSecuritySettingsOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default"
urlPath = strings.ReplaceAll(urlPath, "{deviceName}", deviceName)
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", client.subscriptionID)
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", resourceGroupName)
urlPath = strings.ReplaceAll(urlPath, "{managerName}", managerName)
req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2017-06-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
return nil, err
}
return req, nil
}