1 package storsimple
2
3
4
5
6
7
8
9 import (
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
19 type FileServersClient struct {
20 BaseClient
21 }
22
23
24 func NewFileServersClient(subscriptionID string) FileServersClient {
25 return NewFileServersClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30 func NewFileServersClientWithBaseURI(baseURI string, subscriptionID string) FileServersClient {
31 return FileServersClient{NewWithBaseURI(baseURI, subscriptionID)}
32 }
33
34
35
36
37
38
39
40 func (client FileServersClient) BackupNow(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string) (result FileServersBackupNowFuture, err error) {
41 if tracing.IsEnabled() {
42 ctx = tracing.StartSpan(ctx, fqdn+"/FileServersClient.BackupNow")
43 defer func() {
44 sc := -1
45 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
46 sc = result.FutureAPI.Response().StatusCode
47 }
48 tracing.EndSpan(ctx, sc, err)
49 }()
50 }
51 if err := validation.Validate([]validation.Validation{
52 {TargetValue: managerName,
53 Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
54 {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
55 return result, validation.NewError("storsimple.FileServersClient", "BackupNow", err.Error())
56 }
57
58 req, err := client.BackupNowPreparer(ctx, deviceName, fileServerName, resourceGroupName, managerName)
59 if err != nil {
60 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "BackupNow", nil, "Failure preparing request")
61 return
62 }
63
64 result, err = client.BackupNowSender(req)
65 if err != nil {
66 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "BackupNow", result.Response(), "Failure sending request")
67 return
68 }
69
70 return
71 }
72
73
74 func (client FileServersClient) BackupNowPreparer(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string) (*http.Request, error) {
75 pathParameters := map[string]interface{}{
76 "deviceName": autorest.Encode("path", deviceName),
77 "fileServerName": autorest.Encode("path", fileServerName),
78 "managerName": autorest.Encode("path", managerName),
79 "resourceGroupName": autorest.Encode("path", resourceGroupName),
80 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
81 }
82
83 const APIVersion = "2016-10-01"
84 queryParameters := map[string]interface{}{
85 "api-version": APIVersion,
86 }
87
88 preparer := autorest.CreatePreparer(
89 autorest.AsPost(),
90 autorest.WithBaseURL(client.BaseURI),
91 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/backup", pathParameters),
92 autorest.WithQueryParameters(queryParameters))
93 return preparer.Prepare((&http.Request{}).WithContext(ctx))
94 }
95
96
97
98 func (client FileServersClient) BackupNowSender(req *http.Request) (future FileServersBackupNowFuture, err error) {
99 var resp *http.Response
100 future.FutureAPI = &azure.Future{}
101 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
102 if err != nil {
103 return
104 }
105 var azf azure.Future
106 azf, err = azure.NewFutureFromResponse(resp)
107 future.FutureAPI = &azf
108 future.Result = future.result
109 return
110 }
111
112
113
114 func (client FileServersClient) BackupNowResponder(resp *http.Response) (result autorest.Response, err error) {
115 err = autorest.Respond(
116 resp,
117 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
118 autorest.ByClosing())
119 result.Response = resp
120 return
121 }
122
123
124
125
126
127
128
129
130 func (client FileServersClient) CreateOrUpdate(ctx context.Context, deviceName string, fileServerName string, fileServer FileServer, resourceGroupName string, managerName string) (result FileServersCreateOrUpdateFuture, err error) {
131 if tracing.IsEnabled() {
132 ctx = tracing.StartSpan(ctx, fqdn+"/FileServersClient.CreateOrUpdate")
133 defer func() {
134 sc := -1
135 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
136 sc = result.FutureAPI.Response().StatusCode
137 }
138 tracing.EndSpan(ctx, sc, err)
139 }()
140 }
141 if err := validation.Validate([]validation.Validation{
142 {TargetValue: fileServer,
143 Constraints: []validation.Constraint{{Target: "fileServer.FileServerProperties", Name: validation.Null, Rule: true,
144 Chain: []validation.Constraint{{Target: "fileServer.FileServerProperties.DomainName", Name: validation.Null, Rule: true, Chain: nil},
145 {Target: "fileServer.FileServerProperties.StorageDomainID", Name: validation.Null, Rule: true, Chain: nil},
146 {Target: "fileServer.FileServerProperties.BackupScheduleGroupID", Name: validation.Null, Rule: true, Chain: nil},
147 }}}},
148 {TargetValue: managerName,
149 Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
150 {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
151 return result, validation.NewError("storsimple.FileServersClient", "CreateOrUpdate", err.Error())
152 }
153
154 req, err := client.CreateOrUpdatePreparer(ctx, deviceName, fileServerName, fileServer, resourceGroupName, managerName)
155 if err != nil {
156 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "CreateOrUpdate", nil, "Failure preparing request")
157 return
158 }
159
160 result, err = client.CreateOrUpdateSender(req)
161 if err != nil {
162 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "CreateOrUpdate", result.Response(), "Failure sending request")
163 return
164 }
165
166 return
167 }
168
169
170 func (client FileServersClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, fileServerName string, fileServer FileServer, resourceGroupName string, managerName string) (*http.Request, error) {
171 pathParameters := map[string]interface{}{
172 "deviceName": autorest.Encode("path", deviceName),
173 "fileServerName": autorest.Encode("path", fileServerName),
174 "managerName": autorest.Encode("path", managerName),
175 "resourceGroupName": autorest.Encode("path", resourceGroupName),
176 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
177 }
178
179 const APIVersion = "2016-10-01"
180 queryParameters := map[string]interface{}{
181 "api-version": APIVersion,
182 }
183
184 preparer := autorest.CreatePreparer(
185 autorest.AsContentType("application/json; charset=utf-8"),
186 autorest.AsPut(),
187 autorest.WithBaseURL(client.BaseURI),
188 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}", pathParameters),
189 autorest.WithJSON(fileServer),
190 autorest.WithQueryParameters(queryParameters))
191 return preparer.Prepare((&http.Request{}).WithContext(ctx))
192 }
193
194
195
196 func (client FileServersClient) CreateOrUpdateSender(req *http.Request) (future FileServersCreateOrUpdateFuture, err error) {
197 var resp *http.Response
198 future.FutureAPI = &azure.Future{}
199 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
200 if err != nil {
201 return
202 }
203 var azf azure.Future
204 azf, err = azure.NewFutureFromResponse(resp)
205 future.FutureAPI = &azf
206 future.Result = future.result
207 return
208 }
209
210
211
212 func (client FileServersClient) CreateOrUpdateResponder(resp *http.Response) (result FileServer, err error) {
213 err = autorest.Respond(
214 resp,
215 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
216 autorest.ByUnmarshallingJSON(&result),
217 autorest.ByClosing())
218 result.Response = autorest.Response{Response: resp}
219 return
220 }
221
222
223
224
225
226
227
228 func (client FileServersClient) Delete(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string) (result FileServersDeleteFuture, err error) {
229 if tracing.IsEnabled() {
230 ctx = tracing.StartSpan(ctx, fqdn+"/FileServersClient.Delete")
231 defer func() {
232 sc := -1
233 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
234 sc = result.FutureAPI.Response().StatusCode
235 }
236 tracing.EndSpan(ctx, sc, err)
237 }()
238 }
239 if err := validation.Validate([]validation.Validation{
240 {TargetValue: managerName,
241 Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
242 {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
243 return result, validation.NewError("storsimple.FileServersClient", "Delete", err.Error())
244 }
245
246 req, err := client.DeletePreparer(ctx, deviceName, fileServerName, resourceGroupName, managerName)
247 if err != nil {
248 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "Delete", nil, "Failure preparing request")
249 return
250 }
251
252 result, err = client.DeleteSender(req)
253 if err != nil {
254 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "Delete", result.Response(), "Failure sending request")
255 return
256 }
257
258 return
259 }
260
261
262 func (client FileServersClient) DeletePreparer(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string) (*http.Request, error) {
263 pathParameters := map[string]interface{}{
264 "deviceName": autorest.Encode("path", deviceName),
265 "fileServerName": autorest.Encode("path", fileServerName),
266 "managerName": autorest.Encode("path", managerName),
267 "resourceGroupName": autorest.Encode("path", resourceGroupName),
268 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
269 }
270
271 const APIVersion = "2016-10-01"
272 queryParameters := map[string]interface{}{
273 "api-version": APIVersion,
274 }
275
276 preparer := autorest.CreatePreparer(
277 autorest.AsDelete(),
278 autorest.WithBaseURL(client.BaseURI),
279 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}", pathParameters),
280 autorest.WithQueryParameters(queryParameters))
281 return preparer.Prepare((&http.Request{}).WithContext(ctx))
282 }
283
284
285
286 func (client FileServersClient) DeleteSender(req *http.Request) (future FileServersDeleteFuture, err error) {
287 var resp *http.Response
288 future.FutureAPI = &azure.Future{}
289 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
290 if err != nil {
291 return
292 }
293 var azf azure.Future
294 azf, err = azure.NewFutureFromResponse(resp)
295 future.FutureAPI = &azf
296 future.Result = future.result
297 return
298 }
299
300
301
302 func (client FileServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
303 err = autorest.Respond(
304 resp,
305 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
306 autorest.ByClosing())
307 result.Response = resp
308 return
309 }
310
311
312
313
314
315
316
317 func (client FileServersClient) Get(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string) (result FileServer, err error) {
318 if tracing.IsEnabled() {
319 ctx = tracing.StartSpan(ctx, fqdn+"/FileServersClient.Get")
320 defer func() {
321 sc := -1
322 if result.Response.Response != nil {
323 sc = result.Response.Response.StatusCode
324 }
325 tracing.EndSpan(ctx, sc, err)
326 }()
327 }
328 if err := validation.Validate([]validation.Validation{
329 {TargetValue: managerName,
330 Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
331 {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
332 return result, validation.NewError("storsimple.FileServersClient", "Get", err.Error())
333 }
334
335 req, err := client.GetPreparer(ctx, deviceName, fileServerName, resourceGroupName, managerName)
336 if err != nil {
337 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "Get", nil, "Failure preparing request")
338 return
339 }
340
341 resp, err := client.GetSender(req)
342 if err != nil {
343 result.Response = autorest.Response{Response: resp}
344 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "Get", resp, "Failure sending request")
345 return
346 }
347
348 result, err = client.GetResponder(resp)
349 if err != nil {
350 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "Get", resp, "Failure responding to request")
351 return
352 }
353
354 return
355 }
356
357
358 func (client FileServersClient) GetPreparer(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string) (*http.Request, error) {
359 pathParameters := map[string]interface{}{
360 "deviceName": autorest.Encode("path", deviceName),
361 "fileServerName": autorest.Encode("path", fileServerName),
362 "managerName": autorest.Encode("path", managerName),
363 "resourceGroupName": autorest.Encode("path", resourceGroupName),
364 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
365 }
366
367 const APIVersion = "2016-10-01"
368 queryParameters := map[string]interface{}{
369 "api-version": APIVersion,
370 }
371
372 preparer := autorest.CreatePreparer(
373 autorest.AsGet(),
374 autorest.WithBaseURL(client.BaseURI),
375 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}", pathParameters),
376 autorest.WithQueryParameters(queryParameters))
377 return preparer.Prepare((&http.Request{}).WithContext(ctx))
378 }
379
380
381
382 func (client FileServersClient) GetSender(req *http.Request) (*http.Response, error) {
383 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
384 }
385
386
387
388 func (client FileServersClient) GetResponder(resp *http.Response) (result FileServer, err error) {
389 err = autorest.Respond(
390 resp,
391 azure.WithErrorUnlessStatusCode(http.StatusOK),
392 autorest.ByUnmarshallingJSON(&result),
393 autorest.ByClosing())
394 result.Response = autorest.Response{Response: resp}
395 return
396 }
397
398
399
400
401
402
403 func (client FileServersClient) ListByDevice(ctx context.Context, deviceName string, resourceGroupName string, managerName string) (result FileServerList, err error) {
404 if tracing.IsEnabled() {
405 ctx = tracing.StartSpan(ctx, fqdn+"/FileServersClient.ListByDevice")
406 defer func() {
407 sc := -1
408 if result.Response.Response != nil {
409 sc = result.Response.Response.StatusCode
410 }
411 tracing.EndSpan(ctx, sc, err)
412 }()
413 }
414 if err := validation.Validate([]validation.Validation{
415 {TargetValue: managerName,
416 Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
417 {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
418 return result, validation.NewError("storsimple.FileServersClient", "ListByDevice", err.Error())
419 }
420
421 req, err := client.ListByDevicePreparer(ctx, deviceName, resourceGroupName, managerName)
422 if err != nil {
423 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListByDevice", nil, "Failure preparing request")
424 return
425 }
426
427 resp, err := client.ListByDeviceSender(req)
428 if err != nil {
429 result.Response = autorest.Response{Response: resp}
430 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListByDevice", resp, "Failure sending request")
431 return
432 }
433
434 result, err = client.ListByDeviceResponder(resp)
435 if err != nil {
436 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListByDevice", resp, "Failure responding to request")
437 return
438 }
439
440 return
441 }
442
443
444 func (client FileServersClient) ListByDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string, managerName string) (*http.Request, error) {
445 pathParameters := map[string]interface{}{
446 "deviceName": autorest.Encode("path", deviceName),
447 "managerName": autorest.Encode("path", managerName),
448 "resourceGroupName": autorest.Encode("path", resourceGroupName),
449 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
450 }
451
452 const APIVersion = "2016-10-01"
453 queryParameters := map[string]interface{}{
454 "api-version": APIVersion,
455 }
456
457 preparer := autorest.CreatePreparer(
458 autorest.AsGet(),
459 autorest.WithBaseURL(client.BaseURI),
460 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers", pathParameters),
461 autorest.WithQueryParameters(queryParameters))
462 return preparer.Prepare((&http.Request{}).WithContext(ctx))
463 }
464
465
466
467 func (client FileServersClient) ListByDeviceSender(req *http.Request) (*http.Response, error) {
468 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
469 }
470
471
472
473 func (client FileServersClient) ListByDeviceResponder(resp *http.Response) (result FileServerList, err error) {
474 err = autorest.Respond(
475 resp,
476 azure.WithErrorUnlessStatusCode(http.StatusOK),
477 autorest.ByUnmarshallingJSON(&result),
478 autorest.ByClosing())
479 result.Response = autorest.Response{Response: resp}
480 return
481 }
482
483
484
485
486
487 func (client FileServersClient) ListByManager(ctx context.Context, resourceGroupName string, managerName string) (result FileServerList, err error) {
488 if tracing.IsEnabled() {
489 ctx = tracing.StartSpan(ctx, fqdn+"/FileServersClient.ListByManager")
490 defer func() {
491 sc := -1
492 if result.Response.Response != nil {
493 sc = result.Response.Response.StatusCode
494 }
495 tracing.EndSpan(ctx, sc, err)
496 }()
497 }
498 if err := validation.Validate([]validation.Validation{
499 {TargetValue: managerName,
500 Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
501 {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
502 return result, validation.NewError("storsimple.FileServersClient", "ListByManager", err.Error())
503 }
504
505 req, err := client.ListByManagerPreparer(ctx, resourceGroupName, managerName)
506 if err != nil {
507 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListByManager", nil, "Failure preparing request")
508 return
509 }
510
511 resp, err := client.ListByManagerSender(req)
512 if err != nil {
513 result.Response = autorest.Response{Response: resp}
514 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListByManager", resp, "Failure sending request")
515 return
516 }
517
518 result, err = client.ListByManagerResponder(resp)
519 if err != nil {
520 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListByManager", resp, "Failure responding to request")
521 return
522 }
523
524 return
525 }
526
527
528 func (client FileServersClient) ListByManagerPreparer(ctx context.Context, resourceGroupName string, managerName string) (*http.Request, error) {
529 pathParameters := map[string]interface{}{
530 "managerName": autorest.Encode("path", managerName),
531 "resourceGroupName": autorest.Encode("path", resourceGroupName),
532 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
533 }
534
535 const APIVersion = "2016-10-01"
536 queryParameters := map[string]interface{}{
537 "api-version": APIVersion,
538 }
539
540 preparer := autorest.CreatePreparer(
541 autorest.AsGet(),
542 autorest.WithBaseURL(client.BaseURI),
543 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/fileservers", pathParameters),
544 autorest.WithQueryParameters(queryParameters))
545 return preparer.Prepare((&http.Request{}).WithContext(ctx))
546 }
547
548
549
550 func (client FileServersClient) ListByManagerSender(req *http.Request) (*http.Response, error) {
551 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
552 }
553
554
555
556 func (client FileServersClient) ListByManagerResponder(resp *http.Response) (result FileServerList, err error) {
557 err = autorest.Respond(
558 resp,
559 azure.WithErrorUnlessStatusCode(http.StatusOK),
560 autorest.ByUnmarshallingJSON(&result),
561 autorest.ByClosing())
562 result.Response = autorest.Response{Response: resp}
563 return
564 }
565
566
567
568
569
570
571
572 func (client FileServersClient) ListMetricDefinition(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string) (result MetricDefinitionList, err error) {
573 if tracing.IsEnabled() {
574 ctx = tracing.StartSpan(ctx, fqdn+"/FileServersClient.ListMetricDefinition")
575 defer func() {
576 sc := -1
577 if result.Response.Response != nil {
578 sc = result.Response.Response.StatusCode
579 }
580 tracing.EndSpan(ctx, sc, err)
581 }()
582 }
583 if err := validation.Validate([]validation.Validation{
584 {TargetValue: managerName,
585 Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
586 {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
587 return result, validation.NewError("storsimple.FileServersClient", "ListMetricDefinition", err.Error())
588 }
589
590 req, err := client.ListMetricDefinitionPreparer(ctx, deviceName, fileServerName, resourceGroupName, managerName)
591 if err != nil {
592 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListMetricDefinition", nil, "Failure preparing request")
593 return
594 }
595
596 resp, err := client.ListMetricDefinitionSender(req)
597 if err != nil {
598 result.Response = autorest.Response{Response: resp}
599 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListMetricDefinition", resp, "Failure sending request")
600 return
601 }
602
603 result, err = client.ListMetricDefinitionResponder(resp)
604 if err != nil {
605 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListMetricDefinition", resp, "Failure responding to request")
606 return
607 }
608
609 return
610 }
611
612
613 func (client FileServersClient) ListMetricDefinitionPreparer(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string) (*http.Request, error) {
614 pathParameters := map[string]interface{}{
615 "deviceName": autorest.Encode("path", deviceName),
616 "fileServerName": autorest.Encode("path", fileServerName),
617 "managerName": autorest.Encode("path", managerName),
618 "resourceGroupName": autorest.Encode("path", resourceGroupName),
619 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
620 }
621
622 const APIVersion = "2016-10-01"
623 queryParameters := map[string]interface{}{
624 "api-version": APIVersion,
625 }
626
627 preparer := autorest.CreatePreparer(
628 autorest.AsGet(),
629 autorest.WithBaseURL(client.BaseURI),
630 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/metricsDefinitions", pathParameters),
631 autorest.WithQueryParameters(queryParameters))
632 return preparer.Prepare((&http.Request{}).WithContext(ctx))
633 }
634
635
636
637 func (client FileServersClient) ListMetricDefinitionSender(req *http.Request) (*http.Response, error) {
638 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
639 }
640
641
642
643 func (client FileServersClient) ListMetricDefinitionResponder(resp *http.Response) (result MetricDefinitionList, err error) {
644 err = autorest.Respond(
645 resp,
646 azure.WithErrorUnlessStatusCode(http.StatusOK),
647 autorest.ByUnmarshallingJSON(&result),
648 autorest.ByClosing())
649 result.Response = autorest.Response{Response: resp}
650 return
651 }
652
653
654
655
656
657
658
659
660 func (client FileServersClient) ListMetrics(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, filter string) (result MetricList, err error) {
661 if tracing.IsEnabled() {
662 ctx = tracing.StartSpan(ctx, fqdn+"/FileServersClient.ListMetrics")
663 defer func() {
664 sc := -1
665 if result.Response.Response != nil {
666 sc = result.Response.Response.StatusCode
667 }
668 tracing.EndSpan(ctx, sc, err)
669 }()
670 }
671 if err := validation.Validate([]validation.Validation{
672 {TargetValue: managerName,
673 Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
674 {Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
675 return result, validation.NewError("storsimple.FileServersClient", "ListMetrics", err.Error())
676 }
677
678 req, err := client.ListMetricsPreparer(ctx, deviceName, fileServerName, resourceGroupName, managerName, filter)
679 if err != nil {
680 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListMetrics", nil, "Failure preparing request")
681 return
682 }
683
684 resp, err := client.ListMetricsSender(req)
685 if err != nil {
686 result.Response = autorest.Response{Response: resp}
687 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListMetrics", resp, "Failure sending request")
688 return
689 }
690
691 result, err = client.ListMetricsResponder(resp)
692 if err != nil {
693 err = autorest.NewErrorWithError(err, "storsimple.FileServersClient", "ListMetrics", resp, "Failure responding to request")
694 return
695 }
696
697 return
698 }
699
700
701 func (client FileServersClient) ListMetricsPreparer(ctx context.Context, deviceName string, fileServerName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) {
702 pathParameters := map[string]interface{}{
703 "deviceName": autorest.Encode("path", deviceName),
704 "fileServerName": autorest.Encode("path", fileServerName),
705 "managerName": autorest.Encode("path", managerName),
706 "resourceGroupName": autorest.Encode("path", resourceGroupName),
707 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
708 }
709
710 const APIVersion = "2016-10-01"
711 queryParameters := map[string]interface{}{
712 "api-version": APIVersion,
713 }
714 if len(filter) > 0 {
715 queryParameters["$filter"] = autorest.Encode("query", filter)
716 }
717
718 preparer := autorest.CreatePreparer(
719 autorest.AsGet(),
720 autorest.WithBaseURL(client.BaseURI),
721 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/metrics", pathParameters),
722 autorest.WithQueryParameters(queryParameters))
723 return preparer.Prepare((&http.Request{}).WithContext(ctx))
724 }
725
726
727
728 func (client FileServersClient) ListMetricsSender(req *http.Request) (*http.Response, error) {
729 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
730 }
731
732
733
734 func (client FileServersClient) ListMetricsResponder(resp *http.Response) (result MetricList, err error) {
735 err = autorest.Respond(
736 resp,
737 azure.WithErrorUnlessStatusCode(http.StatusOK),
738 autorest.ByUnmarshallingJSON(&result),
739 autorest.ByClosing())
740 result.Response = autorest.Response{Response: resp}
741 return
742 }
743
View as plain text