1 package webservices
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/date"
15 "github.com/Azure/go-autorest/autorest/to"
16 "github.com/Azure/go-autorest/tracing"
17 "net/http"
18 )
19
20
21 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/machinelearning/mgmt/2016-05-01-preview/webservices"
22
23
24 type AssetItem struct {
25
26 Name *string `json:"name,omitempty"`
27
28 ID *string `json:"id,omitempty"`
29
30 Type AssetType `json:"type,omitempty"`
31
32 LocationInfo *AssetLocation `json:"locationInfo,omitempty"`
33
34 InputPorts map[string]*InputPort `json:"inputPorts"`
35
36 OutputPorts map[string]*OutputPort `json:"outputPorts"`
37
38 Metadata map[string]*string `json:"metadata"`
39
40 Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"`
41 }
42
43
44 func (ai AssetItem) MarshalJSON() ([]byte, error) {
45 objectMap := make(map[string]interface{})
46 if ai.Name != nil {
47 objectMap["name"] = ai.Name
48 }
49 if ai.ID != nil {
50 objectMap["id"] = ai.ID
51 }
52 if ai.Type != "" {
53 objectMap["type"] = ai.Type
54 }
55 if ai.LocationInfo != nil {
56 objectMap["locationInfo"] = ai.LocationInfo
57 }
58 if ai.InputPorts != nil {
59 objectMap["inputPorts"] = ai.InputPorts
60 }
61 if ai.OutputPorts != nil {
62 objectMap["outputPorts"] = ai.OutputPorts
63 }
64 if ai.Metadata != nil {
65 objectMap["metadata"] = ai.Metadata
66 }
67 if ai.Parameters != nil {
68 objectMap["parameters"] = ai.Parameters
69 }
70 return json.Marshal(objectMap)
71 }
72
73
74 type AssetLocation struct {
75
76 URI *string `json:"uri,omitempty"`
77
78 Credentials *string `json:"credentials,omitempty"`
79 }
80
81
82
83 type ColumnSpecification struct {
84
85 Type ColumnType `json:"type,omitempty"`
86
87 Format ColumnFormat `json:"format,omitempty"`
88
89 Enum *[]interface{} `json:"enum,omitempty"`
90
91 XMsIsnullable *bool `json:"x-ms-isnullable,omitempty"`
92
93 XMsIsordered *bool `json:"x-ms-isordered,omitempty"`
94 }
95
96
97 type CommitmentPlan struct {
98
99 ID *string `json:"id,omitempty"`
100 }
101
102
103
104 type CreateOrUpdateFuture struct {
105 azure.FutureAPI
106
107
108 Result func(Client) (WebService, error)
109 }
110
111
112 func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
113 var azFuture azure.Future
114 if err := json.Unmarshal(body, &azFuture); err != nil {
115 return err
116 }
117 future.FutureAPI = &azFuture
118 future.Result = future.result
119 return nil
120 }
121
122
123 func (future *CreateOrUpdateFuture) result(client Client) (ws WebService, err error) {
124 var done bool
125 done, err = future.DoneWithContext(context.Background(), client)
126 if err != nil {
127 err = autorest.NewErrorWithError(err, "webservices.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
128 return
129 }
130 if !done {
131 ws.Response.Response = future.Response()
132 err = azure.NewAsyncOpIncompleteError("webservices.CreateOrUpdateFuture")
133 return
134 }
135 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
136 if ws.Response.Response, err = future.GetResult(sender); err == nil && ws.Response.Response.StatusCode != http.StatusNoContent {
137 ws, err = client.CreateOrUpdateResponder(ws.Response.Response)
138 if err != nil {
139 err = autorest.NewErrorWithError(err, "webservices.CreateOrUpdateFuture", "Result", ws.Response.Response, "Failure responding to request")
140 }
141 }
142 return
143 }
144
145
146 type DiagnosticsConfiguration struct {
147
148 Level DiagnosticsLevel `json:"level,omitempty"`
149
150 Expiry *date.Time `json:"expiry,omitempty"`
151 }
152
153
154 type ExampleRequest struct {
155
156 Inputs map[string][][]interface{} `json:"inputs"`
157
158 GlobalParameters map[string]interface{} `json:"globalParameters"`
159 }
160
161
162 func (er ExampleRequest) MarshalJSON() ([]byte, error) {
163 objectMap := make(map[string]interface{})
164 if er.Inputs != nil {
165 objectMap["inputs"] = er.Inputs
166 }
167 if er.GlobalParameters != nil {
168 objectMap["globalParameters"] = er.GlobalParameters
169 }
170 return json.Marshal(objectMap)
171 }
172
173
174 type GraphEdge struct {
175
176 SourceNodeID *string `json:"sourceNodeId,omitempty"`
177
178 SourcePortID *string `json:"sourcePortId,omitempty"`
179
180 TargetNodeID *string `json:"targetNodeId,omitempty"`
181
182 TargetPortID *string `json:"targetPortId,omitempty"`
183 }
184
185
186
187 type GraphNode struct {
188
189 AssetID *string `json:"assetId,omitempty"`
190
191 InputID *string `json:"inputId,omitempty"`
192
193 OutputID *string `json:"outputId,omitempty"`
194
195 Parameters map[string]*string `json:"parameters"`
196 }
197
198
199 func (gn GraphNode) MarshalJSON() ([]byte, error) {
200 objectMap := make(map[string]interface{})
201 if gn.AssetID != nil {
202 objectMap["assetId"] = gn.AssetID
203 }
204 if gn.InputID != nil {
205 objectMap["inputId"] = gn.InputID
206 }
207 if gn.OutputID != nil {
208 objectMap["outputId"] = gn.OutputID
209 }
210 if gn.Parameters != nil {
211 objectMap["parameters"] = gn.Parameters
212 }
213 return json.Marshal(objectMap)
214 }
215
216
217 type GraphPackage struct {
218
219 Nodes map[string]*GraphNode `json:"nodes"`
220
221 Edges *[]GraphEdge `json:"edges,omitempty"`
222
223 GraphParameters map[string]*GraphParameter `json:"graphParameters"`
224 }
225
226
227 func (gp GraphPackage) MarshalJSON() ([]byte, error) {
228 objectMap := make(map[string]interface{})
229 if gp.Nodes != nil {
230 objectMap["nodes"] = gp.Nodes
231 }
232 if gp.Edges != nil {
233 objectMap["edges"] = gp.Edges
234 }
235 if gp.GraphParameters != nil {
236 objectMap["graphParameters"] = gp.GraphParameters
237 }
238 return json.Marshal(objectMap)
239 }
240
241
242 type GraphParameter struct {
243
244 Description *string `json:"description,omitempty"`
245
246 Type ParameterType `json:"type,omitempty"`
247
248 Links *[]GraphParameterLink `json:"links,omitempty"`
249 }
250
251
252 type GraphParameterLink struct {
253
254 NodeID *string `json:"nodeId,omitempty"`
255
256 ParameterKey *string `json:"parameterKey,omitempty"`
257 }
258
259
260 type InputPort struct {
261
262 Type InputPortType `json:"type,omitempty"`
263 }
264
265
266 type Keys struct {
267 autorest.Response `json:"-"`
268
269 Primary *string `json:"primary,omitempty"`
270
271 Secondary *string `json:"secondary,omitempty"`
272 }
273
274
275
276 type MachineLearningWorkspace struct {
277
278 ID *string `json:"id,omitempty"`
279 }
280
281
282 type ModeValueInfo struct {
283
284 InterfaceString *string `json:"interfaceString,omitempty"`
285
286 Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"`
287 }
288
289
290 type ModuleAssetParameter struct {
291
292 Name *string `json:"name,omitempty"`
293
294 ParameterType *string `json:"parameterType,omitempty"`
295
296 ModeValuesInfo map[string]*ModeValueInfo `json:"modeValuesInfo"`
297 }
298
299
300 func (mapVar ModuleAssetParameter) MarshalJSON() ([]byte, error) {
301 objectMap := make(map[string]interface{})
302 if mapVar.Name != nil {
303 objectMap["name"] = mapVar.Name
304 }
305 if mapVar.ParameterType != nil {
306 objectMap["parameterType"] = mapVar.ParameterType
307 }
308 if mapVar.ModeValuesInfo != nil {
309 objectMap["modeValuesInfo"] = mapVar.ModeValuesInfo
310 }
311 return json.Marshal(objectMap)
312 }
313
314
315 type OutputPort struct {
316
317 Type OutputPortType `json:"type,omitempty"`
318 }
319
320
321 type PaginatedWebServicesList struct {
322 autorest.Response `json:"-"`
323
324 Value *[]WebService `json:"value,omitempty"`
325
326 NextLink *string `json:"nextLink,omitempty"`
327 }
328
329
330 type PaginatedWebServicesListIterator struct {
331 i int
332 page PaginatedWebServicesListPage
333 }
334
335
336
337 func (iter *PaginatedWebServicesListIterator) NextWithContext(ctx context.Context) (err error) {
338 if tracing.IsEnabled() {
339 ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedWebServicesListIterator.NextWithContext")
340 defer func() {
341 sc := -1
342 if iter.Response().Response.Response != nil {
343 sc = iter.Response().Response.Response.StatusCode
344 }
345 tracing.EndSpan(ctx, sc, err)
346 }()
347 }
348 iter.i++
349 if iter.i < len(iter.page.Values()) {
350 return nil
351 }
352 err = iter.page.NextWithContext(ctx)
353 if err != nil {
354 iter.i--
355 return err
356 }
357 iter.i = 0
358 return nil
359 }
360
361
362
363
364 func (iter *PaginatedWebServicesListIterator) Next() error {
365 return iter.NextWithContext(context.Background())
366 }
367
368
369 func (iter PaginatedWebServicesListIterator) NotDone() bool {
370 return iter.page.NotDone() && iter.i < len(iter.page.Values())
371 }
372
373
374 func (iter PaginatedWebServicesListIterator) Response() PaginatedWebServicesList {
375 return iter.page.Response()
376 }
377
378
379
380 func (iter PaginatedWebServicesListIterator) Value() WebService {
381 if !iter.page.NotDone() {
382 return WebService{}
383 }
384 return iter.page.Values()[iter.i]
385 }
386
387
388 func NewPaginatedWebServicesListIterator(page PaginatedWebServicesListPage) PaginatedWebServicesListIterator {
389 return PaginatedWebServicesListIterator{page: page}
390 }
391
392
393 func (pwsl PaginatedWebServicesList) IsEmpty() bool {
394 return pwsl.Value == nil || len(*pwsl.Value) == 0
395 }
396
397
398 func (pwsl PaginatedWebServicesList) hasNextLink() bool {
399 return pwsl.NextLink != nil && len(*pwsl.NextLink) != 0
400 }
401
402
403
404 func (pwsl PaginatedWebServicesList) paginatedWebServicesListPreparer(ctx context.Context) (*http.Request, error) {
405 if !pwsl.hasNextLink() {
406 return nil, nil
407 }
408 return autorest.Prepare((&http.Request{}).WithContext(ctx),
409 autorest.AsJSON(),
410 autorest.AsGet(),
411 autorest.WithBaseURL(to.String(pwsl.NextLink)))
412 }
413
414
415 type PaginatedWebServicesListPage struct {
416 fn func(context.Context, PaginatedWebServicesList) (PaginatedWebServicesList, error)
417 pwsl PaginatedWebServicesList
418 }
419
420
421
422 func (page *PaginatedWebServicesListPage) NextWithContext(ctx context.Context) (err error) {
423 if tracing.IsEnabled() {
424 ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedWebServicesListPage.NextWithContext")
425 defer func() {
426 sc := -1
427 if page.Response().Response.Response != nil {
428 sc = page.Response().Response.Response.StatusCode
429 }
430 tracing.EndSpan(ctx, sc, err)
431 }()
432 }
433 for {
434 next, err := page.fn(ctx, page.pwsl)
435 if err != nil {
436 return err
437 }
438 page.pwsl = next
439 if !next.hasNextLink() || !next.IsEmpty() {
440 break
441 }
442 }
443 return nil
444 }
445
446
447
448
449 func (page *PaginatedWebServicesListPage) Next() error {
450 return page.NextWithContext(context.Background())
451 }
452
453
454 func (page PaginatedWebServicesListPage) NotDone() bool {
455 return !page.pwsl.IsEmpty()
456 }
457
458
459 func (page PaginatedWebServicesListPage) Response() PaginatedWebServicesList {
460 return page.pwsl
461 }
462
463
464 func (page PaginatedWebServicesListPage) Values() []WebService {
465 if page.pwsl.IsEmpty() {
466 return nil
467 }
468 return *page.pwsl.Value
469 }
470
471
472 func NewPaginatedWebServicesListPage(cur PaginatedWebServicesList, getNextPage func(context.Context, PaginatedWebServicesList) (PaginatedWebServicesList, error)) PaginatedWebServicesListPage {
473 return PaginatedWebServicesListPage{
474 fn: getNextPage,
475 pwsl: cur,
476 }
477 }
478
479
480 type PatchFuture struct {
481 azure.FutureAPI
482
483
484 Result func(Client) (WebService, error)
485 }
486
487
488 func (future *PatchFuture) UnmarshalJSON(body []byte) error {
489 var azFuture azure.Future
490 if err := json.Unmarshal(body, &azFuture); err != nil {
491 return err
492 }
493 future.FutureAPI = &azFuture
494 future.Result = future.result
495 return nil
496 }
497
498
499 func (future *PatchFuture) result(client Client) (ws WebService, err error) {
500 var done bool
501 done, err = future.DoneWithContext(context.Background(), client)
502 if err != nil {
503 err = autorest.NewErrorWithError(err, "webservices.PatchFuture", "Result", future.Response(), "Polling failure")
504 return
505 }
506 if !done {
507 ws.Response.Response = future.Response()
508 err = azure.NewAsyncOpIncompleteError("webservices.PatchFuture")
509 return
510 }
511 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
512 if ws.Response.Response, err = future.GetResult(sender); err == nil && ws.Response.Response.StatusCode != http.StatusNoContent {
513 ws, err = client.PatchResponder(ws.Response.Response)
514 if err != nil {
515 err = autorest.NewErrorWithError(err, "webservices.PatchFuture", "Result", ws.Response.Response, "Failure responding to request")
516 }
517 }
518 return
519 }
520
521
522 type BasicProperties interface {
523 AsPropertiesForGraph() (*PropertiesForGraph, bool)
524 AsProperties() (*Properties, bool)
525 }
526
527
528 type Properties struct {
529
530 Title *string `json:"title,omitempty"`
531
532 Description *string `json:"description,omitempty"`
533
534 CreatedOn *date.Time `json:"createdOn,omitempty"`
535
536 ModifiedOn *date.Time `json:"modifiedOn,omitempty"`
537
538 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
539
540 Keys *Keys `json:"keys,omitempty"`
541
542 ReadOnly *bool `json:"readOnly,omitempty"`
543
544 SwaggerLocation *string `json:"swaggerLocation,omitempty"`
545
546 ExposeSampleData *bool `json:"exposeSampleData,omitempty"`
547
548 RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"`
549
550 Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"`
551
552 StorageAccount *StorageAccount `json:"storageAccount,omitempty"`
553
554 MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"`
555
556 CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"`
557
558 Input *ServiceInputOutputSpecification `json:"input,omitempty"`
559
560 Output *ServiceInputOutputSpecification `json:"output,omitempty"`
561
562 ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"`
563
564 Assets map[string]*AssetItem `json:"assets"`
565
566 Parameters map[string]*string `json:"parameters"`
567
568 PackageType PackageType `json:"packageType,omitempty"`
569 }
570
571 func unmarshalBasicProperties(body []byte) (BasicProperties, error) {
572 var m map[string]interface{}
573 err := json.Unmarshal(body, &m)
574 if err != nil {
575 return nil, err
576 }
577
578 switch m["packageType"] {
579 case string(PackageTypeGraph):
580 var pfg PropertiesForGraph
581 err := json.Unmarshal(body, &pfg)
582 return pfg, err
583 default:
584 var p Properties
585 err := json.Unmarshal(body, &p)
586 return p, err
587 }
588 }
589 func unmarshalBasicPropertiesArray(body []byte) ([]BasicProperties, error) {
590 var rawMessages []*json.RawMessage
591 err := json.Unmarshal(body, &rawMessages)
592 if err != nil {
593 return nil, err
594 }
595
596 pArray := make([]BasicProperties, len(rawMessages))
597
598 for index, rawMessage := range rawMessages {
599 p, err := unmarshalBasicProperties(*rawMessage)
600 if err != nil {
601 return nil, err
602 }
603 pArray[index] = p
604 }
605 return pArray, nil
606 }
607
608
609 func (p Properties) MarshalJSON() ([]byte, error) {
610 p.PackageType = PackageTypeWebServiceProperties
611 objectMap := make(map[string]interface{})
612 if p.Title != nil {
613 objectMap["title"] = p.Title
614 }
615 if p.Description != nil {
616 objectMap["description"] = p.Description
617 }
618 if p.Keys != nil {
619 objectMap["keys"] = p.Keys
620 }
621 if p.ReadOnly != nil {
622 objectMap["readOnly"] = p.ReadOnly
623 }
624 if p.ExposeSampleData != nil {
625 objectMap["exposeSampleData"] = p.ExposeSampleData
626 }
627 if p.RealtimeConfiguration != nil {
628 objectMap["realtimeConfiguration"] = p.RealtimeConfiguration
629 }
630 if p.Diagnostics != nil {
631 objectMap["diagnostics"] = p.Diagnostics
632 }
633 if p.StorageAccount != nil {
634 objectMap["storageAccount"] = p.StorageAccount
635 }
636 if p.MachineLearningWorkspace != nil {
637 objectMap["machineLearningWorkspace"] = p.MachineLearningWorkspace
638 }
639 if p.CommitmentPlan != nil {
640 objectMap["commitmentPlan"] = p.CommitmentPlan
641 }
642 if p.Input != nil {
643 objectMap["input"] = p.Input
644 }
645 if p.Output != nil {
646 objectMap["output"] = p.Output
647 }
648 if p.ExampleRequest != nil {
649 objectMap["exampleRequest"] = p.ExampleRequest
650 }
651 if p.Assets != nil {
652 objectMap["assets"] = p.Assets
653 }
654 if p.Parameters != nil {
655 objectMap["parameters"] = p.Parameters
656 }
657 if p.PackageType != "" {
658 objectMap["packageType"] = p.PackageType
659 }
660 return json.Marshal(objectMap)
661 }
662
663
664 func (p Properties) AsPropertiesForGraph() (*PropertiesForGraph, bool) {
665 return nil, false
666 }
667
668
669 func (p Properties) AsProperties() (*Properties, bool) {
670 return &p, true
671 }
672
673
674 func (p Properties) AsBasicProperties() (BasicProperties, bool) {
675 return &p, true
676 }
677
678
679 type PropertiesForGraph struct {
680
681 Package *GraphPackage `json:"package,omitempty"`
682
683 Title *string `json:"title,omitempty"`
684
685 Description *string `json:"description,omitempty"`
686
687 CreatedOn *date.Time `json:"createdOn,omitempty"`
688
689 ModifiedOn *date.Time `json:"modifiedOn,omitempty"`
690
691 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
692
693 Keys *Keys `json:"keys,omitempty"`
694
695 ReadOnly *bool `json:"readOnly,omitempty"`
696
697 SwaggerLocation *string `json:"swaggerLocation,omitempty"`
698
699 ExposeSampleData *bool `json:"exposeSampleData,omitempty"`
700
701 RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"`
702
703 Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"`
704
705 StorageAccount *StorageAccount `json:"storageAccount,omitempty"`
706
707 MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"`
708
709 CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"`
710
711 Input *ServiceInputOutputSpecification `json:"input,omitempty"`
712
713 Output *ServiceInputOutputSpecification `json:"output,omitempty"`
714
715 ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"`
716
717 Assets map[string]*AssetItem `json:"assets"`
718
719 Parameters map[string]*string `json:"parameters"`
720
721 PackageType PackageType `json:"packageType,omitempty"`
722 }
723
724
725 func (pfg PropertiesForGraph) MarshalJSON() ([]byte, error) {
726 pfg.PackageType = PackageTypeGraph
727 objectMap := make(map[string]interface{})
728 if pfg.Package != nil {
729 objectMap["package"] = pfg.Package
730 }
731 if pfg.Title != nil {
732 objectMap["title"] = pfg.Title
733 }
734 if pfg.Description != nil {
735 objectMap["description"] = pfg.Description
736 }
737 if pfg.Keys != nil {
738 objectMap["keys"] = pfg.Keys
739 }
740 if pfg.ReadOnly != nil {
741 objectMap["readOnly"] = pfg.ReadOnly
742 }
743 if pfg.ExposeSampleData != nil {
744 objectMap["exposeSampleData"] = pfg.ExposeSampleData
745 }
746 if pfg.RealtimeConfiguration != nil {
747 objectMap["realtimeConfiguration"] = pfg.RealtimeConfiguration
748 }
749 if pfg.Diagnostics != nil {
750 objectMap["diagnostics"] = pfg.Diagnostics
751 }
752 if pfg.StorageAccount != nil {
753 objectMap["storageAccount"] = pfg.StorageAccount
754 }
755 if pfg.MachineLearningWorkspace != nil {
756 objectMap["machineLearningWorkspace"] = pfg.MachineLearningWorkspace
757 }
758 if pfg.CommitmentPlan != nil {
759 objectMap["commitmentPlan"] = pfg.CommitmentPlan
760 }
761 if pfg.Input != nil {
762 objectMap["input"] = pfg.Input
763 }
764 if pfg.Output != nil {
765 objectMap["output"] = pfg.Output
766 }
767 if pfg.ExampleRequest != nil {
768 objectMap["exampleRequest"] = pfg.ExampleRequest
769 }
770 if pfg.Assets != nil {
771 objectMap["assets"] = pfg.Assets
772 }
773 if pfg.Parameters != nil {
774 objectMap["parameters"] = pfg.Parameters
775 }
776 if pfg.PackageType != "" {
777 objectMap["packageType"] = pfg.PackageType
778 }
779 return json.Marshal(objectMap)
780 }
781
782
783 func (pfg PropertiesForGraph) AsPropertiesForGraph() (*PropertiesForGraph, bool) {
784 return &pfg, true
785 }
786
787
788 func (pfg PropertiesForGraph) AsProperties() (*Properties, bool) {
789 return nil, false
790 }
791
792
793 func (pfg PropertiesForGraph) AsBasicProperties() (BasicProperties, bool) {
794 return &pfg, true
795 }
796
797
798 type RealtimeConfiguration struct {
799
800 MaxConcurrentCalls *int32 `json:"maxConcurrentCalls,omitempty"`
801 }
802
803
804 type RemoveFuture struct {
805 azure.FutureAPI
806
807
808 Result func(Client) (autorest.Response, error)
809 }
810
811
812 func (future *RemoveFuture) UnmarshalJSON(body []byte) error {
813 var azFuture azure.Future
814 if err := json.Unmarshal(body, &azFuture); err != nil {
815 return err
816 }
817 future.FutureAPI = &azFuture
818 future.Result = future.result
819 return nil
820 }
821
822
823 func (future *RemoveFuture) result(client Client) (ar autorest.Response, err error) {
824 var done bool
825 done, err = future.DoneWithContext(context.Background(), client)
826 if err != nil {
827 err = autorest.NewErrorWithError(err, "webservices.RemoveFuture", "Result", future.Response(), "Polling failure")
828 return
829 }
830 if !done {
831 ar.Response = future.Response()
832 err = azure.NewAsyncOpIncompleteError("webservices.RemoveFuture")
833 return
834 }
835 ar.Response = future.Response()
836 return
837 }
838
839
840 type Resource struct {
841
842 ID *string `json:"id,omitempty"`
843
844 Name *string `json:"name,omitempty"`
845
846 Location *string `json:"location,omitempty"`
847
848 Type *string `json:"type,omitempty"`
849
850 Tags map[string]*string `json:"tags"`
851 }
852
853
854 func (r Resource) MarshalJSON() ([]byte, error) {
855 objectMap := make(map[string]interface{})
856 if r.Name != nil {
857 objectMap["name"] = r.Name
858 }
859 if r.Location != nil {
860 objectMap["location"] = r.Location
861 }
862 if r.Tags != nil {
863 objectMap["tags"] = r.Tags
864 }
865 return json.Marshal(objectMap)
866 }
867
868
869
870 type ServiceInputOutputSpecification struct {
871
872 Title *string `json:"title,omitempty"`
873
874 Description *string `json:"description,omitempty"`
875
876 Type *string `json:"type,omitempty"`
877
878 Properties map[string]*TableSpecification `json:"properties"`
879 }
880
881
882 func (sios ServiceInputOutputSpecification) MarshalJSON() ([]byte, error) {
883 objectMap := make(map[string]interface{})
884 if sios.Title != nil {
885 objectMap["title"] = sios.Title
886 }
887 if sios.Description != nil {
888 objectMap["description"] = sios.Description
889 }
890 if sios.Type != nil {
891 objectMap["type"] = sios.Type
892 }
893 if sios.Properties != nil {
894 objectMap["properties"] = sios.Properties
895 }
896 return json.Marshal(objectMap)
897 }
898
899
900 type StorageAccount struct {
901
902 Name *string `json:"name,omitempty"`
903
904 Key *string `json:"key,omitempty"`
905 }
906
907
908
909 type TableSpecification struct {
910
911 Title *string `json:"title,omitempty"`
912
913 Description *string `json:"description,omitempty"`
914
915 Type *string `json:"type,omitempty"`
916
917 Format *string `json:"format,omitempty"`
918
919 Properties map[string]*ColumnSpecification `json:"properties"`
920 }
921
922
923 func (ts TableSpecification) MarshalJSON() ([]byte, error) {
924 objectMap := make(map[string]interface{})
925 if ts.Title != nil {
926 objectMap["title"] = ts.Title
927 }
928 if ts.Description != nil {
929 objectMap["description"] = ts.Description
930 }
931 if ts.Type != nil {
932 objectMap["type"] = ts.Type
933 }
934 if ts.Format != nil {
935 objectMap["format"] = ts.Format
936 }
937 if ts.Properties != nil {
938 objectMap["properties"] = ts.Properties
939 }
940 return json.Marshal(objectMap)
941 }
942
943
944 type WebService struct {
945 autorest.Response `json:"-"`
946
947 Properties BasicProperties `json:"properties,omitempty"`
948
949 ID *string `json:"id,omitempty"`
950
951 Name *string `json:"name,omitempty"`
952
953 Location *string `json:"location,omitempty"`
954
955 Type *string `json:"type,omitempty"`
956
957 Tags map[string]*string `json:"tags"`
958 }
959
960
961 func (ws WebService) MarshalJSON() ([]byte, error) {
962 objectMap := make(map[string]interface{})
963 objectMap["properties"] = ws.Properties
964 if ws.Name != nil {
965 objectMap["name"] = ws.Name
966 }
967 if ws.Location != nil {
968 objectMap["location"] = ws.Location
969 }
970 if ws.Tags != nil {
971 objectMap["tags"] = ws.Tags
972 }
973 return json.Marshal(objectMap)
974 }
975
976
977 func (ws *WebService) UnmarshalJSON(body []byte) error {
978 var m map[string]*json.RawMessage
979 err := json.Unmarshal(body, &m)
980 if err != nil {
981 return err
982 }
983 for k, v := range m {
984 switch k {
985 case "properties":
986 if v != nil {
987 properties, err := unmarshalBasicProperties(*v)
988 if err != nil {
989 return err
990 }
991 ws.Properties = properties
992 }
993 case "id":
994 if v != nil {
995 var ID string
996 err = json.Unmarshal(*v, &ID)
997 if err != nil {
998 return err
999 }
1000 ws.ID = &ID
1001 }
1002 case "name":
1003 if v != nil {
1004 var name string
1005 err = json.Unmarshal(*v, &name)
1006 if err != nil {
1007 return err
1008 }
1009 ws.Name = &name
1010 }
1011 case "location":
1012 if v != nil {
1013 var location string
1014 err = json.Unmarshal(*v, &location)
1015 if err != nil {
1016 return err
1017 }
1018 ws.Location = &location
1019 }
1020 case "type":
1021 if v != nil {
1022 var typeVar string
1023 err = json.Unmarshal(*v, &typeVar)
1024 if err != nil {
1025 return err
1026 }
1027 ws.Type = &typeVar
1028 }
1029 case "tags":
1030 if v != nil {
1031 var tags map[string]*string
1032 err = json.Unmarshal(*v, &tags)
1033 if err != nil {
1034 return err
1035 }
1036 ws.Tags = tags
1037 }
1038 }
1039 }
1040
1041 return nil
1042 }
1043
View as plain text