1 package analysisservices
2
3
4
5
6
7
8
9 import (
10 "context"
11 "encoding/json"
12 "github.com/Azure/go-autorest/autorest"
13 "github.com/Azure/go-autorest/autorest/azure"
14 "github.com/Azure/go-autorest/autorest/to"
15 "github.com/Azure/go-autorest/tracing"
16 "net/http"
17 )
18
19
20 const fqdn = "github.com/Azure/azure-sdk-for-go/services/analysisservices/mgmt/2017-08-01/analysisservices"
21
22
23 type CheckServerNameAvailabilityParameters struct {
24
25 Name *string `json:"name,omitempty"`
26
27 Type *string `json:"type,omitempty"`
28 }
29
30
31 type CheckServerNameAvailabilityResult struct {
32 autorest.Response `json:"-"`
33
34 NameAvailable *bool `json:"nameAvailable,omitempty"`
35
36 Reason *string `json:"reason,omitempty"`
37
38 Message *string `json:"message,omitempty"`
39 }
40
41
42 type ErrorResponse struct {
43
44 Code *string `json:"code,omitempty"`
45
46 Message *string `json:"message,omitempty"`
47 }
48
49
50 type GatewayDetails struct {
51
52 GatewayResourceID *string `json:"gatewayResourceId,omitempty"`
53
54 GatewayObjectID *string `json:"gatewayObjectId,omitempty"`
55
56 DmtsClusterURI *string `json:"dmtsClusterUri,omitempty"`
57 }
58
59
60 func (gd GatewayDetails) MarshalJSON() ([]byte, error) {
61 objectMap := make(map[string]interface{})
62 if gd.GatewayResourceID != nil {
63 objectMap["gatewayResourceId"] = gd.GatewayResourceID
64 }
65 return json.Marshal(objectMap)
66 }
67
68
69 type GatewayError struct {
70
71 Code *string `json:"code,omitempty"`
72
73 Message *string `json:"message,omitempty"`
74 }
75
76
77 type GatewayListStatusError struct {
78
79 Error *GatewayError `json:"error,omitempty"`
80 }
81
82
83 type GatewayListStatusLive struct {
84 autorest.Response `json:"-"`
85
86 Status Status `json:"status,omitempty"`
87 }
88
89
90 type IPv4FirewallRule struct {
91
92 FirewallRuleName *string `json:"firewallRuleName,omitempty"`
93
94 RangeStart *string `json:"rangeStart,omitempty"`
95
96 RangeEnd *string `json:"rangeEnd,omitempty"`
97 }
98
99
100 type IPv4FirewallSettings struct {
101
102 FirewallRules *[]IPv4FirewallRule `json:"firewallRules,omitempty"`
103
104 EnablePowerBIService *bool `json:"enablePowerBIService,omitempty"`
105 }
106
107
108 type Operation struct {
109
110 Name *string `json:"name,omitempty"`
111
112 Display *OperationDisplay `json:"display,omitempty"`
113 }
114
115
116 func (o Operation) MarshalJSON() ([]byte, error) {
117 objectMap := make(map[string]interface{})
118 if o.Display != nil {
119 objectMap["display"] = o.Display
120 }
121 return json.Marshal(objectMap)
122 }
123
124
125 type OperationDisplay struct {
126
127 Provider *string `json:"provider,omitempty"`
128
129 Resource *string `json:"resource,omitempty"`
130
131 Operation *string `json:"operation,omitempty"`
132 }
133
134
135 func (o OperationDisplay) MarshalJSON() ([]byte, error) {
136 objectMap := make(map[string]interface{})
137 return json.Marshal(objectMap)
138 }
139
140
141
142 type OperationListResult struct {
143 autorest.Response `json:"-"`
144
145 Value *[]Operation `json:"value,omitempty"`
146
147 NextLink *string `json:"nextLink,omitempty"`
148 }
149
150
151 func (olr OperationListResult) MarshalJSON() ([]byte, error) {
152 objectMap := make(map[string]interface{})
153 return json.Marshal(objectMap)
154 }
155
156
157 type OperationListResultIterator struct {
158 i int
159 page OperationListResultPage
160 }
161
162
163
164 func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
165 if tracing.IsEnabled() {
166 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
167 defer func() {
168 sc := -1
169 if iter.Response().Response.Response != nil {
170 sc = iter.Response().Response.Response.StatusCode
171 }
172 tracing.EndSpan(ctx, sc, err)
173 }()
174 }
175 iter.i++
176 if iter.i < len(iter.page.Values()) {
177 return nil
178 }
179 err = iter.page.NextWithContext(ctx)
180 if err != nil {
181 iter.i--
182 return err
183 }
184 iter.i = 0
185 return nil
186 }
187
188
189
190
191 func (iter *OperationListResultIterator) Next() error {
192 return iter.NextWithContext(context.Background())
193 }
194
195
196 func (iter OperationListResultIterator) NotDone() bool {
197 return iter.page.NotDone() && iter.i < len(iter.page.Values())
198 }
199
200
201 func (iter OperationListResultIterator) Response() OperationListResult {
202 return iter.page.Response()
203 }
204
205
206
207 func (iter OperationListResultIterator) Value() Operation {
208 if !iter.page.NotDone() {
209 return Operation{}
210 }
211 return iter.page.Values()[iter.i]
212 }
213
214
215 func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
216 return OperationListResultIterator{page: page}
217 }
218
219
220 func (olr OperationListResult) IsEmpty() bool {
221 return olr.Value == nil || len(*olr.Value) == 0
222 }
223
224
225 func (olr OperationListResult) hasNextLink() bool {
226 return olr.NextLink != nil && len(*olr.NextLink) != 0
227 }
228
229
230
231 func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
232 if !olr.hasNextLink() {
233 return nil, nil
234 }
235 return autorest.Prepare((&http.Request{}).WithContext(ctx),
236 autorest.AsJSON(),
237 autorest.AsGet(),
238 autorest.WithBaseURL(to.String(olr.NextLink)))
239 }
240
241
242 type OperationListResultPage struct {
243 fn func(context.Context, OperationListResult) (OperationListResult, error)
244 olr OperationListResult
245 }
246
247
248
249 func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
250 if tracing.IsEnabled() {
251 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
252 defer func() {
253 sc := -1
254 if page.Response().Response.Response != nil {
255 sc = page.Response().Response.Response.StatusCode
256 }
257 tracing.EndSpan(ctx, sc, err)
258 }()
259 }
260 for {
261 next, err := page.fn(ctx, page.olr)
262 if err != nil {
263 return err
264 }
265 page.olr = next
266 if !next.hasNextLink() || !next.IsEmpty() {
267 break
268 }
269 }
270 return nil
271 }
272
273
274
275
276 func (page *OperationListResultPage) Next() error {
277 return page.NextWithContext(context.Background())
278 }
279
280
281 func (page OperationListResultPage) NotDone() bool {
282 return !page.olr.IsEmpty()
283 }
284
285
286 func (page OperationListResultPage) Response() OperationListResult {
287 return page.olr
288 }
289
290
291 func (page OperationListResultPage) Values() []Operation {
292 if page.olr.IsEmpty() {
293 return nil
294 }
295 return *page.olr.Value
296 }
297
298
299 func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
300 return OperationListResultPage{
301 fn: getNextPage,
302 olr: cur,
303 }
304 }
305
306
307 type OperationStatus struct {
308 autorest.Response `json:"-"`
309
310 ID *string `json:"id,omitempty"`
311
312 Name *string `json:"name,omitempty"`
313
314 StartTime *string `json:"startTime,omitempty"`
315
316 EndTime *string `json:"endTime,omitempty"`
317
318 Status *string `json:"status,omitempty"`
319
320 Error *ErrorResponse `json:"error,omitempty"`
321 }
322
323
324 type Resource struct {
325
326 ID *string `json:"id,omitempty"`
327
328 Name *string `json:"name,omitempty"`
329
330 Type *string `json:"type,omitempty"`
331
332 Location *string `json:"location,omitempty"`
333
334 Sku *ResourceSku `json:"sku,omitempty"`
335
336 Tags map[string]*string `json:"tags"`
337 }
338
339
340 func (r Resource) MarshalJSON() ([]byte, error) {
341 objectMap := make(map[string]interface{})
342 if r.Location != nil {
343 objectMap["location"] = r.Location
344 }
345 if r.Sku != nil {
346 objectMap["sku"] = r.Sku
347 }
348 if r.Tags != nil {
349 objectMap["tags"] = r.Tags
350 }
351 return json.Marshal(objectMap)
352 }
353
354
355 type ResourceSku struct {
356
357 Name *string `json:"name,omitempty"`
358
359 Tier SkuTier `json:"tier,omitempty"`
360
361 Capacity *int32 `json:"capacity,omitempty"`
362 }
363
364
365 type Server struct {
366 autorest.Response `json:"-"`
367
368 *ServerProperties `json:"properties,omitempty"`
369
370 ID *string `json:"id,omitempty"`
371
372 Name *string `json:"name,omitempty"`
373
374 Type *string `json:"type,omitempty"`
375
376 Location *string `json:"location,omitempty"`
377
378 Sku *ResourceSku `json:"sku,omitempty"`
379
380 Tags map[string]*string `json:"tags"`
381 }
382
383
384 func (s Server) MarshalJSON() ([]byte, error) {
385 objectMap := make(map[string]interface{})
386 if s.ServerProperties != nil {
387 objectMap["properties"] = s.ServerProperties
388 }
389 if s.Location != nil {
390 objectMap["location"] = s.Location
391 }
392 if s.Sku != nil {
393 objectMap["sku"] = s.Sku
394 }
395 if s.Tags != nil {
396 objectMap["tags"] = s.Tags
397 }
398 return json.Marshal(objectMap)
399 }
400
401
402 func (s *Server) UnmarshalJSON(body []byte) error {
403 var m map[string]*json.RawMessage
404 err := json.Unmarshal(body, &m)
405 if err != nil {
406 return err
407 }
408 for k, v := range m {
409 switch k {
410 case "properties":
411 if v != nil {
412 var serverProperties ServerProperties
413 err = json.Unmarshal(*v, &serverProperties)
414 if err != nil {
415 return err
416 }
417 s.ServerProperties = &serverProperties
418 }
419 case "id":
420 if v != nil {
421 var ID string
422 err = json.Unmarshal(*v, &ID)
423 if err != nil {
424 return err
425 }
426 s.ID = &ID
427 }
428 case "name":
429 if v != nil {
430 var name string
431 err = json.Unmarshal(*v, &name)
432 if err != nil {
433 return err
434 }
435 s.Name = &name
436 }
437 case "type":
438 if v != nil {
439 var typeVar string
440 err = json.Unmarshal(*v, &typeVar)
441 if err != nil {
442 return err
443 }
444 s.Type = &typeVar
445 }
446 case "location":
447 if v != nil {
448 var location string
449 err = json.Unmarshal(*v, &location)
450 if err != nil {
451 return err
452 }
453 s.Location = &location
454 }
455 case "sku":
456 if v != nil {
457 var sku ResourceSku
458 err = json.Unmarshal(*v, &sku)
459 if err != nil {
460 return err
461 }
462 s.Sku = &sku
463 }
464 case "tags":
465 if v != nil {
466 var tags map[string]*string
467 err = json.Unmarshal(*v, &tags)
468 if err != nil {
469 return err
470 }
471 s.Tags = tags
472 }
473 }
474 }
475
476 return nil
477 }
478
479
480 type ServerAdministrators struct {
481
482 Members *[]string `json:"members,omitempty"`
483 }
484
485
486
487 type ServerMutableProperties struct {
488
489 AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"`
490
491 BackupBlobContainerURI *string `json:"backupBlobContainerUri,omitempty"`
492
493 GatewayDetails *GatewayDetails `json:"gatewayDetails,omitempty"`
494
495 IPV4FirewallSettings *IPv4FirewallSettings `json:"ipV4FirewallSettings,omitempty"`
496
497 QuerypoolConnectionMode ConnectionMode `json:"querypoolConnectionMode,omitempty"`
498 }
499
500
501 type ServerProperties struct {
502
503 State State `json:"state,omitempty"`
504
505 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
506
507 ServerFullName *string `json:"serverFullName,omitempty"`
508
509 AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"`
510
511 BackupBlobContainerURI *string `json:"backupBlobContainerUri,omitempty"`
512
513 GatewayDetails *GatewayDetails `json:"gatewayDetails,omitempty"`
514
515 IPV4FirewallSettings *IPv4FirewallSettings `json:"ipV4FirewallSettings,omitempty"`
516
517 QuerypoolConnectionMode ConnectionMode `json:"querypoolConnectionMode,omitempty"`
518 }
519
520
521 func (sp ServerProperties) MarshalJSON() ([]byte, error) {
522 objectMap := make(map[string]interface{})
523 if sp.AsAdministrators != nil {
524 objectMap["asAdministrators"] = sp.AsAdministrators
525 }
526 if sp.BackupBlobContainerURI != nil {
527 objectMap["backupBlobContainerUri"] = sp.BackupBlobContainerURI
528 }
529 if sp.GatewayDetails != nil {
530 objectMap["gatewayDetails"] = sp.GatewayDetails
531 }
532 if sp.IPV4FirewallSettings != nil {
533 objectMap["ipV4FirewallSettings"] = sp.IPV4FirewallSettings
534 }
535 if sp.QuerypoolConnectionMode != "" {
536 objectMap["querypoolConnectionMode"] = sp.QuerypoolConnectionMode
537 }
538 return json.Marshal(objectMap)
539 }
540
541
542 type Servers struct {
543 autorest.Response `json:"-"`
544
545 Value *[]Server `json:"value,omitempty"`
546 }
547
548
549
550 type ServersCreateFuture struct {
551 azure.FutureAPI
552
553
554 Result func(ServersClient) (Server, error)
555 }
556
557
558 func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
559 var azFuture azure.Future
560 if err := json.Unmarshal(body, &azFuture); err != nil {
561 return err
562 }
563 future.FutureAPI = &azFuture
564 future.Result = future.result
565 return nil
566 }
567
568
569 func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
570 var done bool
571 done, err = future.DoneWithContext(context.Background(), client)
572 if err != nil {
573 err = autorest.NewErrorWithError(err, "analysisservices.ServersCreateFuture", "Result", future.Response(), "Polling failure")
574 return
575 }
576 if !done {
577 s.Response.Response = future.Response()
578 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersCreateFuture")
579 return
580 }
581 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
582 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
583 s, err = client.CreateResponder(s.Response.Response)
584 if err != nil {
585 err = autorest.NewErrorWithError(err, "analysisservices.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
586 }
587 }
588 return
589 }
590
591
592
593 type ServersDeleteFuture struct {
594 azure.FutureAPI
595
596
597 Result func(ServersClient) (autorest.Response, error)
598 }
599
600
601 func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
602 var azFuture azure.Future
603 if err := json.Unmarshal(body, &azFuture); err != nil {
604 return err
605 }
606 future.FutureAPI = &azFuture
607 future.Result = future.result
608 return nil
609 }
610
611
612 func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
613 var done bool
614 done, err = future.DoneWithContext(context.Background(), client)
615 if err != nil {
616 err = autorest.NewErrorWithError(err, "analysisservices.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
617 return
618 }
619 if !done {
620 ar.Response = future.Response()
621 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersDeleteFuture")
622 return
623 }
624 ar.Response = future.Response()
625 return
626 }
627
628
629
630 type ServersResumeFuture struct {
631 azure.FutureAPI
632
633
634 Result func(ServersClient) (autorest.Response, error)
635 }
636
637
638 func (future *ServersResumeFuture) UnmarshalJSON(body []byte) error {
639 var azFuture azure.Future
640 if err := json.Unmarshal(body, &azFuture); err != nil {
641 return err
642 }
643 future.FutureAPI = &azFuture
644 future.Result = future.result
645 return nil
646 }
647
648
649 func (future *ServersResumeFuture) result(client ServersClient) (ar autorest.Response, err error) {
650 var done bool
651 done, err = future.DoneWithContext(context.Background(), client)
652 if err != nil {
653 err = autorest.NewErrorWithError(err, "analysisservices.ServersResumeFuture", "Result", future.Response(), "Polling failure")
654 return
655 }
656 if !done {
657 ar.Response = future.Response()
658 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersResumeFuture")
659 return
660 }
661 ar.Response = future.Response()
662 return
663 }
664
665
666
667 type ServersSuspendFuture struct {
668 azure.FutureAPI
669
670
671 Result func(ServersClient) (autorest.Response, error)
672 }
673
674
675 func (future *ServersSuspendFuture) UnmarshalJSON(body []byte) error {
676 var azFuture azure.Future
677 if err := json.Unmarshal(body, &azFuture); err != nil {
678 return err
679 }
680 future.FutureAPI = &azFuture
681 future.Result = future.result
682 return nil
683 }
684
685
686 func (future *ServersSuspendFuture) result(client ServersClient) (ar autorest.Response, err error) {
687 var done bool
688 done, err = future.DoneWithContext(context.Background(), client)
689 if err != nil {
690 err = autorest.NewErrorWithError(err, "analysisservices.ServersSuspendFuture", "Result", future.Response(), "Polling failure")
691 return
692 }
693 if !done {
694 ar.Response = future.Response()
695 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersSuspendFuture")
696 return
697 }
698 ar.Response = future.Response()
699 return
700 }
701
702
703
704 type ServersUpdateFuture struct {
705 azure.FutureAPI
706
707
708 Result func(ServersClient) (Server, error)
709 }
710
711
712 func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
713 var azFuture azure.Future
714 if err := json.Unmarshal(body, &azFuture); err != nil {
715 return err
716 }
717 future.FutureAPI = &azFuture
718 future.Result = future.result
719 return nil
720 }
721
722
723 func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
724 var done bool
725 done, err = future.DoneWithContext(context.Background(), client)
726 if err != nil {
727 err = autorest.NewErrorWithError(err, "analysisservices.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
728 return
729 }
730 if !done {
731 s.Response.Response = future.Response()
732 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersUpdateFuture")
733 return
734 }
735 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
736 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
737 s, err = client.UpdateResponder(s.Response.Response)
738 if err != nil {
739 err = autorest.NewErrorWithError(err, "analysisservices.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
740 }
741 }
742 return
743 }
744
745
746 type ServerUpdateParameters struct {
747
748 Sku *ResourceSku `json:"sku,omitempty"`
749
750 Tags map[string]*string `json:"tags"`
751
752 *ServerMutableProperties `json:"properties,omitempty"`
753 }
754
755
756 func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) {
757 objectMap := make(map[string]interface{})
758 if sup.Sku != nil {
759 objectMap["sku"] = sup.Sku
760 }
761 if sup.Tags != nil {
762 objectMap["tags"] = sup.Tags
763 }
764 if sup.ServerMutableProperties != nil {
765 objectMap["properties"] = sup.ServerMutableProperties
766 }
767 return json.Marshal(objectMap)
768 }
769
770
771 func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error {
772 var m map[string]*json.RawMessage
773 err := json.Unmarshal(body, &m)
774 if err != nil {
775 return err
776 }
777 for k, v := range m {
778 switch k {
779 case "sku":
780 if v != nil {
781 var sku ResourceSku
782 err = json.Unmarshal(*v, &sku)
783 if err != nil {
784 return err
785 }
786 sup.Sku = &sku
787 }
788 case "tags":
789 if v != nil {
790 var tags map[string]*string
791 err = json.Unmarshal(*v, &tags)
792 if err != nil {
793 return err
794 }
795 sup.Tags = tags
796 }
797 case "properties":
798 if v != nil {
799 var serverMutableProperties ServerMutableProperties
800 err = json.Unmarshal(*v, &serverMutableProperties)
801 if err != nil {
802 return err
803 }
804 sup.ServerMutableProperties = &serverMutableProperties
805 }
806 }
807 }
808
809 return nil
810 }
811
812
813 type SkuDetailsForExistingResource struct {
814
815 Sku *ResourceSku `json:"sku,omitempty"`
816 }
817
818
819
820 type SkuEnumerationForExistingResourceResult struct {
821 autorest.Response `json:"-"`
822
823 Value *[]SkuDetailsForExistingResource `json:"value,omitempty"`
824 }
825
826
827 type SkuEnumerationForNewResourceResult struct {
828 autorest.Response `json:"-"`
829
830 Value *[]ResourceSku `json:"value,omitempty"`
831 }
832
View as plain text