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/machinelearning/mgmt/2017-01-01/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 *BlobLocation `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 AsyncOperationErrorInfo struct {
75
76 Code *string `json:"code,omitempty"`
77
78 Target *string `json:"target,omitempty"`
79
80 Message *string `json:"message,omitempty"`
81
82 Details *[]AsyncOperationErrorInfo `json:"details,omitempty"`
83 }
84
85
86 func (aoei AsyncOperationErrorInfo) MarshalJSON() ([]byte, error) {
87 objectMap := make(map[string]interface{})
88 return json.Marshal(objectMap)
89 }
90
91
92 type AsyncOperationStatus struct {
93 autorest.Response `json:"-"`
94
95 ID *string `json:"id,omitempty"`
96
97 Name *string `json:"name,omitempty"`
98
99 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
100
101 StartTime *date.Time `json:"startTime,omitempty"`
102
103 EndTime *date.Time `json:"endTime,omitempty"`
104
105 PercentComplete *float64 `json:"percentComplete,omitempty"`
106
107 ErrorInfo *AsyncOperationErrorInfo `json:"errorInfo,omitempty"`
108 }
109
110
111 func (aos AsyncOperationStatus) MarshalJSON() ([]byte, error) {
112 objectMap := make(map[string]interface{})
113 return json.Marshal(objectMap)
114 }
115
116
117 type BlobLocation struct {
118
119 URI *string `json:"uri,omitempty"`
120
121 Credentials *string `json:"credentials,omitempty"`
122 }
123
124
125
126 type ColumnSpecification struct {
127
128 Type ColumnType `json:"type,omitempty"`
129
130 Format ColumnFormat `json:"format,omitempty"`
131
132 Enum *[]interface{} `json:"enum,omitempty"`
133
134 XMsIsnullable *bool `json:"x-ms-isnullable,omitempty"`
135
136 XMsIsordered *bool `json:"x-ms-isordered,omitempty"`
137 }
138
139
140 type CommitmentPlan struct {
141
142 ID *string `json:"id,omitempty"`
143 }
144
145
146
147 type CreateOrUpdateFuture struct {
148 azure.FutureAPI
149
150
151 Result func(Client) (WebService, error)
152 }
153
154
155 func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
156 var azFuture azure.Future
157 if err := json.Unmarshal(body, &azFuture); err != nil {
158 return err
159 }
160 future.FutureAPI = &azFuture
161 future.Result = future.result
162 return nil
163 }
164
165
166 func (future *CreateOrUpdateFuture) result(client Client) (ws WebService, err error) {
167 var done bool
168 done, err = future.DoneWithContext(context.Background(), client)
169 if err != nil {
170 err = autorest.NewErrorWithError(err, "webservices.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
171 return
172 }
173 if !done {
174 ws.Response.Response = future.Response()
175 err = azure.NewAsyncOpIncompleteError("webservices.CreateOrUpdateFuture")
176 return
177 }
178 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
179 if ws.Response.Response, err = future.GetResult(sender); err == nil && ws.Response.Response.StatusCode != http.StatusNoContent {
180 ws, err = client.CreateOrUpdateResponder(ws.Response.Response)
181 if err != nil {
182 err = autorest.NewErrorWithError(err, "webservices.CreateOrUpdateFuture", "Result", ws.Response.Response, "Failure responding to request")
183 }
184 }
185 return
186 }
187
188
189
190 type CreateRegionalPropertiesFuture struct {
191 azure.FutureAPI
192
193
194 Result func(Client) (AsyncOperationStatus, error)
195 }
196
197
198 func (future *CreateRegionalPropertiesFuture) UnmarshalJSON(body []byte) error {
199 var azFuture azure.Future
200 if err := json.Unmarshal(body, &azFuture); err != nil {
201 return err
202 }
203 future.FutureAPI = &azFuture
204 future.Result = future.result
205 return nil
206 }
207
208
209 func (future *CreateRegionalPropertiesFuture) result(client Client) (aos AsyncOperationStatus, err error) {
210 var done bool
211 done, err = future.DoneWithContext(context.Background(), client)
212 if err != nil {
213 err = autorest.NewErrorWithError(err, "webservices.CreateRegionalPropertiesFuture", "Result", future.Response(), "Polling failure")
214 return
215 }
216 if !done {
217 aos.Response.Response = future.Response()
218 err = azure.NewAsyncOpIncompleteError("webservices.CreateRegionalPropertiesFuture")
219 return
220 }
221 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
222 if aos.Response.Response, err = future.GetResult(sender); err == nil && aos.Response.Response.StatusCode != http.StatusNoContent {
223 aos, err = client.CreateRegionalPropertiesResponder(aos.Response.Response)
224 if err != nil {
225 err = autorest.NewErrorWithError(err, "webservices.CreateRegionalPropertiesFuture", "Result", aos.Response.Response, "Failure responding to request")
226 }
227 }
228 return
229 }
230
231
232 type DiagnosticsConfiguration struct {
233
234 Level DiagnosticsLevel `json:"level,omitempty"`
235
236 Expiry *date.Time `json:"expiry,omitempty"`
237 }
238
239
240 type ExampleRequest struct {
241
242 Inputs map[string][][]interface{} `json:"inputs"`
243
244 GlobalParameters map[string]interface{} `json:"globalParameters"`
245 }
246
247
248 func (er ExampleRequest) MarshalJSON() ([]byte, error) {
249 objectMap := make(map[string]interface{})
250 if er.Inputs != nil {
251 objectMap["inputs"] = er.Inputs
252 }
253 if er.GlobalParameters != nil {
254 objectMap["globalParameters"] = er.GlobalParameters
255 }
256 return json.Marshal(objectMap)
257 }
258
259
260 type GraphEdge struct {
261
262 SourceNodeID *string `json:"sourceNodeId,omitempty"`
263
264 SourcePortID *string `json:"sourcePortId,omitempty"`
265
266 TargetNodeID *string `json:"targetNodeId,omitempty"`
267
268 TargetPortID *string `json:"targetPortId,omitempty"`
269 }
270
271
272
273 type GraphNode struct {
274
275 AssetID *string `json:"assetId,omitempty"`
276
277 InputID *string `json:"inputId,omitempty"`
278
279 OutputID *string `json:"outputId,omitempty"`
280
281 Parameters map[string]*Parameter `json:"parameters"`
282 }
283
284
285 func (gn GraphNode) MarshalJSON() ([]byte, error) {
286 objectMap := make(map[string]interface{})
287 if gn.AssetID != nil {
288 objectMap["assetId"] = gn.AssetID
289 }
290 if gn.InputID != nil {
291 objectMap["inputId"] = gn.InputID
292 }
293 if gn.OutputID != nil {
294 objectMap["outputId"] = gn.OutputID
295 }
296 if gn.Parameters != nil {
297 objectMap["parameters"] = gn.Parameters
298 }
299 return json.Marshal(objectMap)
300 }
301
302
303 type GraphPackage struct {
304
305 Nodes map[string]*GraphNode `json:"nodes"`
306
307 Edges *[]GraphEdge `json:"edges,omitempty"`
308
309 GraphParameters map[string]*GraphParameter `json:"graphParameters"`
310 }
311
312
313 func (gp GraphPackage) MarshalJSON() ([]byte, error) {
314 objectMap := make(map[string]interface{})
315 if gp.Nodes != nil {
316 objectMap["nodes"] = gp.Nodes
317 }
318 if gp.Edges != nil {
319 objectMap["edges"] = gp.Edges
320 }
321 if gp.GraphParameters != nil {
322 objectMap["graphParameters"] = gp.GraphParameters
323 }
324 return json.Marshal(objectMap)
325 }
326
327
328 type GraphParameter struct {
329
330 Description *string `json:"description,omitempty"`
331
332 Type ParameterType `json:"type,omitempty"`
333
334 Links *[]GraphParameterLink `json:"links,omitempty"`
335 }
336
337
338 type GraphParameterLink struct {
339
340 NodeID *string `json:"nodeId,omitempty"`
341
342 ParameterKey *string `json:"parameterKey,omitempty"`
343 }
344
345
346 type InputPort struct {
347
348 Type InputPortType `json:"type,omitempty"`
349 }
350
351
352 type Keys struct {
353 autorest.Response `json:"-"`
354
355 Primary *string `json:"primary,omitempty"`
356
357 Secondary *string `json:"secondary,omitempty"`
358 }
359
360
361
362 type MachineLearningWorkspace struct {
363
364 ID *string `json:"id,omitempty"`
365 }
366
367
368 type ModeValueInfo struct {
369
370 InterfaceString *string `json:"interfaceString,omitempty"`
371
372 Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"`
373 }
374
375
376 type ModuleAssetParameter struct {
377
378 Name *string `json:"name,omitempty"`
379
380 ParameterType *string `json:"parameterType,omitempty"`
381
382 ModeValuesInfo map[string]*ModeValueInfo `json:"modeValuesInfo"`
383 }
384
385
386 func (mapVar ModuleAssetParameter) MarshalJSON() ([]byte, error) {
387 objectMap := make(map[string]interface{})
388 if mapVar.Name != nil {
389 objectMap["name"] = mapVar.Name
390 }
391 if mapVar.ParameterType != nil {
392 objectMap["parameterType"] = mapVar.ParameterType
393 }
394 if mapVar.ModeValuesInfo != nil {
395 objectMap["modeValuesInfo"] = mapVar.ModeValuesInfo
396 }
397 return json.Marshal(objectMap)
398 }
399
400
401 type OperationDisplayInfo struct {
402
403 Description *string `json:"description,omitempty"`
404
405 Operation *string `json:"operation,omitempty"`
406
407 Provider *string `json:"provider,omitempty"`
408
409 Resource *string `json:"resource,omitempty"`
410 }
411
412
413 func (odi OperationDisplayInfo) MarshalJSON() ([]byte, error) {
414 objectMap := make(map[string]interface{})
415 return json.Marshal(objectMap)
416 }
417
418
419 type OperationEntity struct {
420
421 Name *string `json:"name,omitempty"`
422
423 Display *OperationDisplayInfo `json:"display,omitempty"`
424 }
425
426
427 func (oe OperationEntity) MarshalJSON() ([]byte, error) {
428 objectMap := make(map[string]interface{})
429 if oe.Display != nil {
430 objectMap["display"] = oe.Display
431 }
432 return json.Marshal(objectMap)
433 }
434
435
436 type OperationEntityListResult struct {
437 autorest.Response `json:"-"`
438
439 Value *[]OperationEntity `json:"value,omitempty"`
440 }
441
442
443 func (oelr OperationEntityListResult) MarshalJSON() ([]byte, error) {
444 objectMap := make(map[string]interface{})
445 return json.Marshal(objectMap)
446 }
447
448
449 type OutputPort struct {
450
451 Type OutputPortType `json:"type,omitempty"`
452 }
453
454
455 type PaginatedWebServicesList struct {
456 autorest.Response `json:"-"`
457
458 Value *[]WebService `json:"value,omitempty"`
459
460 NextLink *string `json:"nextLink,omitempty"`
461 }
462
463
464 type PaginatedWebServicesListIterator struct {
465 i int
466 page PaginatedWebServicesListPage
467 }
468
469
470
471 func (iter *PaginatedWebServicesListIterator) NextWithContext(ctx context.Context) (err error) {
472 if tracing.IsEnabled() {
473 ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedWebServicesListIterator.NextWithContext")
474 defer func() {
475 sc := -1
476 if iter.Response().Response.Response != nil {
477 sc = iter.Response().Response.Response.StatusCode
478 }
479 tracing.EndSpan(ctx, sc, err)
480 }()
481 }
482 iter.i++
483 if iter.i < len(iter.page.Values()) {
484 return nil
485 }
486 err = iter.page.NextWithContext(ctx)
487 if err != nil {
488 iter.i--
489 return err
490 }
491 iter.i = 0
492 return nil
493 }
494
495
496
497
498 func (iter *PaginatedWebServicesListIterator) Next() error {
499 return iter.NextWithContext(context.Background())
500 }
501
502
503 func (iter PaginatedWebServicesListIterator) NotDone() bool {
504 return iter.page.NotDone() && iter.i < len(iter.page.Values())
505 }
506
507
508 func (iter PaginatedWebServicesListIterator) Response() PaginatedWebServicesList {
509 return iter.page.Response()
510 }
511
512
513
514 func (iter PaginatedWebServicesListIterator) Value() WebService {
515 if !iter.page.NotDone() {
516 return WebService{}
517 }
518 return iter.page.Values()[iter.i]
519 }
520
521
522 func NewPaginatedWebServicesListIterator(page PaginatedWebServicesListPage) PaginatedWebServicesListIterator {
523 return PaginatedWebServicesListIterator{page: page}
524 }
525
526
527 func (pwsl PaginatedWebServicesList) IsEmpty() bool {
528 return pwsl.Value == nil || len(*pwsl.Value) == 0
529 }
530
531
532 func (pwsl PaginatedWebServicesList) hasNextLink() bool {
533 return pwsl.NextLink != nil && len(*pwsl.NextLink) != 0
534 }
535
536
537
538 func (pwsl PaginatedWebServicesList) paginatedWebServicesListPreparer(ctx context.Context) (*http.Request, error) {
539 if !pwsl.hasNextLink() {
540 return nil, nil
541 }
542 return autorest.Prepare((&http.Request{}).WithContext(ctx),
543 autorest.AsJSON(),
544 autorest.AsGet(),
545 autorest.WithBaseURL(to.String(pwsl.NextLink)))
546 }
547
548
549 type PaginatedWebServicesListPage struct {
550 fn func(context.Context, PaginatedWebServicesList) (PaginatedWebServicesList, error)
551 pwsl PaginatedWebServicesList
552 }
553
554
555
556 func (page *PaginatedWebServicesListPage) NextWithContext(ctx context.Context) (err error) {
557 if tracing.IsEnabled() {
558 ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedWebServicesListPage.NextWithContext")
559 defer func() {
560 sc := -1
561 if page.Response().Response.Response != nil {
562 sc = page.Response().Response.Response.StatusCode
563 }
564 tracing.EndSpan(ctx, sc, err)
565 }()
566 }
567 for {
568 next, err := page.fn(ctx, page.pwsl)
569 if err != nil {
570 return err
571 }
572 page.pwsl = next
573 if !next.hasNextLink() || !next.IsEmpty() {
574 break
575 }
576 }
577 return nil
578 }
579
580
581
582
583 func (page *PaginatedWebServicesListPage) Next() error {
584 return page.NextWithContext(context.Background())
585 }
586
587
588 func (page PaginatedWebServicesListPage) NotDone() bool {
589 return !page.pwsl.IsEmpty()
590 }
591
592
593 func (page PaginatedWebServicesListPage) Response() PaginatedWebServicesList {
594 return page.pwsl
595 }
596
597
598 func (page PaginatedWebServicesListPage) Values() []WebService {
599 if page.pwsl.IsEmpty() {
600 return nil
601 }
602 return *page.pwsl.Value
603 }
604
605
606 func NewPaginatedWebServicesListPage(cur PaginatedWebServicesList, getNextPage func(context.Context, PaginatedWebServicesList) (PaginatedWebServicesList, error)) PaginatedWebServicesListPage {
607 return PaginatedWebServicesListPage{
608 fn: getNextPage,
609 pwsl: cur,
610 }
611 }
612
613
614 type Parameter struct {
615
616 Value interface{} `json:"value,omitempty"`
617
618 CertificateThumbprint *string `json:"certificateThumbprint,omitempty"`
619 }
620
621
622 type PatchedResource struct {
623
624 ID *string `json:"id,omitempty"`
625
626 Name *string `json:"name,omitempty"`
627
628 Location *string `json:"location,omitempty"`
629
630 Type *string `json:"type,omitempty"`
631
632 Tags map[string]*string `json:"tags"`
633 }
634
635
636 func (pr PatchedResource) MarshalJSON() ([]byte, error) {
637 objectMap := make(map[string]interface{})
638 if pr.Tags != nil {
639 objectMap["tags"] = pr.Tags
640 }
641 return json.Marshal(objectMap)
642 }
643
644
645 type PatchedWebService struct {
646
647 Properties BasicProperties `json:"properties,omitempty"`
648
649 ID *string `json:"id,omitempty"`
650
651 Name *string `json:"name,omitempty"`
652
653 Location *string `json:"location,omitempty"`
654
655 Type *string `json:"type,omitempty"`
656
657 Tags map[string]*string `json:"tags"`
658 }
659
660
661 func (pws PatchedWebService) MarshalJSON() ([]byte, error) {
662 objectMap := make(map[string]interface{})
663 objectMap["properties"] = pws.Properties
664 if pws.Tags != nil {
665 objectMap["tags"] = pws.Tags
666 }
667 return json.Marshal(objectMap)
668 }
669
670
671 func (pws *PatchedWebService) UnmarshalJSON(body []byte) error {
672 var m map[string]*json.RawMessage
673 err := json.Unmarshal(body, &m)
674 if err != nil {
675 return err
676 }
677 for k, v := range m {
678 switch k {
679 case "properties":
680 if v != nil {
681 properties, err := unmarshalBasicProperties(*v)
682 if err != nil {
683 return err
684 }
685 pws.Properties = properties
686 }
687 case "id":
688 if v != nil {
689 var ID string
690 err = json.Unmarshal(*v, &ID)
691 if err != nil {
692 return err
693 }
694 pws.ID = &ID
695 }
696 case "name":
697 if v != nil {
698 var name string
699 err = json.Unmarshal(*v, &name)
700 if err != nil {
701 return err
702 }
703 pws.Name = &name
704 }
705 case "location":
706 if v != nil {
707 var location string
708 err = json.Unmarshal(*v, &location)
709 if err != nil {
710 return err
711 }
712 pws.Location = &location
713 }
714 case "type":
715 if v != nil {
716 var typeVar string
717 err = json.Unmarshal(*v, &typeVar)
718 if err != nil {
719 return err
720 }
721 pws.Type = &typeVar
722 }
723 case "tags":
724 if v != nil {
725 var tags map[string]*string
726 err = json.Unmarshal(*v, &tags)
727 if err != nil {
728 return err
729 }
730 pws.Tags = tags
731 }
732 }
733 }
734
735 return nil
736 }
737
738
739 type PatchFuture struct {
740 azure.FutureAPI
741
742
743 Result func(Client) (WebService, error)
744 }
745
746
747 func (future *PatchFuture) UnmarshalJSON(body []byte) error {
748 var azFuture azure.Future
749 if err := json.Unmarshal(body, &azFuture); err != nil {
750 return err
751 }
752 future.FutureAPI = &azFuture
753 future.Result = future.result
754 return nil
755 }
756
757
758 func (future *PatchFuture) result(client Client) (ws WebService, err error) {
759 var done bool
760 done, err = future.DoneWithContext(context.Background(), client)
761 if err != nil {
762 err = autorest.NewErrorWithError(err, "webservices.PatchFuture", "Result", future.Response(), "Polling failure")
763 return
764 }
765 if !done {
766 ws.Response.Response = future.Response()
767 err = azure.NewAsyncOpIncompleteError("webservices.PatchFuture")
768 return
769 }
770 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
771 if ws.Response.Response, err = future.GetResult(sender); err == nil && ws.Response.Response.StatusCode != http.StatusNoContent {
772 ws, err = client.PatchResponder(ws.Response.Response)
773 if err != nil {
774 err = autorest.NewErrorWithError(err, "webservices.PatchFuture", "Result", ws.Response.Response, "Failure responding to request")
775 }
776 }
777 return
778 }
779
780
781 type BasicProperties interface {
782 AsPropertiesForGraph() (*PropertiesForGraph, bool)
783 AsProperties() (*Properties, bool)
784 }
785
786
787 type Properties struct {
788
789 Title *string `json:"title,omitempty"`
790
791 Description *string `json:"description,omitempty"`
792
793 CreatedOn *date.Time `json:"createdOn,omitempty"`
794
795 ModifiedOn *date.Time `json:"modifiedOn,omitempty"`
796
797 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
798
799 Keys *Keys `json:"keys,omitempty"`
800
801 ReadOnly *bool `json:"readOnly,omitempty"`
802
803 SwaggerLocation *string `json:"swaggerLocation,omitempty"`
804
805 ExposeSampleData *bool `json:"exposeSampleData,omitempty"`
806
807 RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"`
808
809 Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"`
810
811 StorageAccount *StorageAccount `json:"storageAccount,omitempty"`
812
813 MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"`
814
815 CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"`
816
817 Input *ServiceInputOutputSpecification `json:"input,omitempty"`
818
819 Output *ServiceInputOutputSpecification `json:"output,omitempty"`
820
821 ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"`
822
823 Assets map[string]*AssetItem `json:"assets"`
824
825 Parameters map[string]*Parameter `json:"parameters"`
826
827 PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"`
828
829 PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"`
830
831 PackageType PackageType `json:"packageType,omitempty"`
832 }
833
834 func unmarshalBasicProperties(body []byte) (BasicProperties, error) {
835 var m map[string]interface{}
836 err := json.Unmarshal(body, &m)
837 if err != nil {
838 return nil, err
839 }
840
841 switch m["packageType"] {
842 case string(PackageTypeGraph):
843 var pfg PropertiesForGraph
844 err := json.Unmarshal(body, &pfg)
845 return pfg, err
846 default:
847 var p Properties
848 err := json.Unmarshal(body, &p)
849 return p, err
850 }
851 }
852 func unmarshalBasicPropertiesArray(body []byte) ([]BasicProperties, error) {
853 var rawMessages []*json.RawMessage
854 err := json.Unmarshal(body, &rawMessages)
855 if err != nil {
856 return nil, err
857 }
858
859 pArray := make([]BasicProperties, len(rawMessages))
860
861 for index, rawMessage := range rawMessages {
862 p, err := unmarshalBasicProperties(*rawMessage)
863 if err != nil {
864 return nil, err
865 }
866 pArray[index] = p
867 }
868 return pArray, nil
869 }
870
871
872 func (p Properties) MarshalJSON() ([]byte, error) {
873 p.PackageType = PackageTypeWebServiceProperties
874 objectMap := make(map[string]interface{})
875 if p.Title != nil {
876 objectMap["title"] = p.Title
877 }
878 if p.Description != nil {
879 objectMap["description"] = p.Description
880 }
881 if p.Keys != nil {
882 objectMap["keys"] = p.Keys
883 }
884 if p.ReadOnly != nil {
885 objectMap["readOnly"] = p.ReadOnly
886 }
887 if p.ExposeSampleData != nil {
888 objectMap["exposeSampleData"] = p.ExposeSampleData
889 }
890 if p.RealtimeConfiguration != nil {
891 objectMap["realtimeConfiguration"] = p.RealtimeConfiguration
892 }
893 if p.Diagnostics != nil {
894 objectMap["diagnostics"] = p.Diagnostics
895 }
896 if p.StorageAccount != nil {
897 objectMap["storageAccount"] = p.StorageAccount
898 }
899 if p.MachineLearningWorkspace != nil {
900 objectMap["machineLearningWorkspace"] = p.MachineLearningWorkspace
901 }
902 if p.CommitmentPlan != nil {
903 objectMap["commitmentPlan"] = p.CommitmentPlan
904 }
905 if p.Input != nil {
906 objectMap["input"] = p.Input
907 }
908 if p.Output != nil {
909 objectMap["output"] = p.Output
910 }
911 if p.ExampleRequest != nil {
912 objectMap["exampleRequest"] = p.ExampleRequest
913 }
914 if p.Assets != nil {
915 objectMap["assets"] = p.Assets
916 }
917 if p.Parameters != nil {
918 objectMap["parameters"] = p.Parameters
919 }
920 if p.PayloadsInBlobStorage != nil {
921 objectMap["payloadsInBlobStorage"] = p.PayloadsInBlobStorage
922 }
923 if p.PayloadsLocation != nil {
924 objectMap["payloadsLocation"] = p.PayloadsLocation
925 }
926 if p.PackageType != "" {
927 objectMap["packageType"] = p.PackageType
928 }
929 return json.Marshal(objectMap)
930 }
931
932
933 func (p Properties) AsPropertiesForGraph() (*PropertiesForGraph, bool) {
934 return nil, false
935 }
936
937
938 func (p Properties) AsProperties() (*Properties, bool) {
939 return &p, true
940 }
941
942
943 func (p Properties) AsBasicProperties() (BasicProperties, bool) {
944 return &p, true
945 }
946
947
948 type PropertiesForGraph struct {
949
950 Package *GraphPackage `json:"package,omitempty"`
951
952 Title *string `json:"title,omitempty"`
953
954 Description *string `json:"description,omitempty"`
955
956 CreatedOn *date.Time `json:"createdOn,omitempty"`
957
958 ModifiedOn *date.Time `json:"modifiedOn,omitempty"`
959
960 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
961
962 Keys *Keys `json:"keys,omitempty"`
963
964 ReadOnly *bool `json:"readOnly,omitempty"`
965
966 SwaggerLocation *string `json:"swaggerLocation,omitempty"`
967
968 ExposeSampleData *bool `json:"exposeSampleData,omitempty"`
969
970 RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"`
971
972 Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"`
973
974 StorageAccount *StorageAccount `json:"storageAccount,omitempty"`
975
976 MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"`
977
978 CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"`
979
980 Input *ServiceInputOutputSpecification `json:"input,omitempty"`
981
982 Output *ServiceInputOutputSpecification `json:"output,omitempty"`
983
984 ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"`
985
986 Assets map[string]*AssetItem `json:"assets"`
987
988 Parameters map[string]*Parameter `json:"parameters"`
989
990 PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"`
991
992 PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"`
993
994 PackageType PackageType `json:"packageType,omitempty"`
995 }
996
997
998 func (pfg PropertiesForGraph) MarshalJSON() ([]byte, error) {
999 pfg.PackageType = PackageTypeGraph
1000 objectMap := make(map[string]interface{})
1001 if pfg.Package != nil {
1002 objectMap["package"] = pfg.Package
1003 }
1004 if pfg.Title != nil {
1005 objectMap["title"] = pfg.Title
1006 }
1007 if pfg.Description != nil {
1008 objectMap["description"] = pfg.Description
1009 }
1010 if pfg.Keys != nil {
1011 objectMap["keys"] = pfg.Keys
1012 }
1013 if pfg.ReadOnly != nil {
1014 objectMap["readOnly"] = pfg.ReadOnly
1015 }
1016 if pfg.ExposeSampleData != nil {
1017 objectMap["exposeSampleData"] = pfg.ExposeSampleData
1018 }
1019 if pfg.RealtimeConfiguration != nil {
1020 objectMap["realtimeConfiguration"] = pfg.RealtimeConfiguration
1021 }
1022 if pfg.Diagnostics != nil {
1023 objectMap["diagnostics"] = pfg.Diagnostics
1024 }
1025 if pfg.StorageAccount != nil {
1026 objectMap["storageAccount"] = pfg.StorageAccount
1027 }
1028 if pfg.MachineLearningWorkspace != nil {
1029 objectMap["machineLearningWorkspace"] = pfg.MachineLearningWorkspace
1030 }
1031 if pfg.CommitmentPlan != nil {
1032 objectMap["commitmentPlan"] = pfg.CommitmentPlan
1033 }
1034 if pfg.Input != nil {
1035 objectMap["input"] = pfg.Input
1036 }
1037 if pfg.Output != nil {
1038 objectMap["output"] = pfg.Output
1039 }
1040 if pfg.ExampleRequest != nil {
1041 objectMap["exampleRequest"] = pfg.ExampleRequest
1042 }
1043 if pfg.Assets != nil {
1044 objectMap["assets"] = pfg.Assets
1045 }
1046 if pfg.Parameters != nil {
1047 objectMap["parameters"] = pfg.Parameters
1048 }
1049 if pfg.PayloadsInBlobStorage != nil {
1050 objectMap["payloadsInBlobStorage"] = pfg.PayloadsInBlobStorage
1051 }
1052 if pfg.PayloadsLocation != nil {
1053 objectMap["payloadsLocation"] = pfg.PayloadsLocation
1054 }
1055 if pfg.PackageType != "" {
1056 objectMap["packageType"] = pfg.PackageType
1057 }
1058 return json.Marshal(objectMap)
1059 }
1060
1061
1062 func (pfg PropertiesForGraph) AsPropertiesForGraph() (*PropertiesForGraph, bool) {
1063 return &pfg, true
1064 }
1065
1066
1067 func (pfg PropertiesForGraph) AsProperties() (*Properties, bool) {
1068 return nil, false
1069 }
1070
1071
1072 func (pfg PropertiesForGraph) AsBasicProperties() (BasicProperties, bool) {
1073 return &pfg, true
1074 }
1075
1076
1077 type RealtimeConfiguration struct {
1078
1079 MaxConcurrentCalls *int32 `json:"maxConcurrentCalls,omitempty"`
1080 }
1081
1082
1083 type RemoveFuture struct {
1084 azure.FutureAPI
1085
1086
1087 Result func(Client) (autorest.Response, error)
1088 }
1089
1090
1091 func (future *RemoveFuture) UnmarshalJSON(body []byte) error {
1092 var azFuture azure.Future
1093 if err := json.Unmarshal(body, &azFuture); err != nil {
1094 return err
1095 }
1096 future.FutureAPI = &azFuture
1097 future.Result = future.result
1098 return nil
1099 }
1100
1101
1102 func (future *RemoveFuture) result(client Client) (ar autorest.Response, err error) {
1103 var done bool
1104 done, err = future.DoneWithContext(context.Background(), client)
1105 if err != nil {
1106 err = autorest.NewErrorWithError(err, "webservices.RemoveFuture", "Result", future.Response(), "Polling failure")
1107 return
1108 }
1109 if !done {
1110 ar.Response = future.Response()
1111 err = azure.NewAsyncOpIncompleteError("webservices.RemoveFuture")
1112 return
1113 }
1114 ar.Response = future.Response()
1115 return
1116 }
1117
1118
1119 type Resource struct {
1120
1121 ID *string `json:"id,omitempty"`
1122
1123 Name *string `json:"name,omitempty"`
1124
1125 Location *string `json:"location,omitempty"`
1126
1127 Type *string `json:"type,omitempty"`
1128
1129 Tags map[string]*string `json:"tags"`
1130 }
1131
1132
1133 func (r Resource) MarshalJSON() ([]byte, error) {
1134 objectMap := make(map[string]interface{})
1135 if r.Location != nil {
1136 objectMap["location"] = r.Location
1137 }
1138 if r.Tags != nil {
1139 objectMap["tags"] = r.Tags
1140 }
1141 return json.Marshal(objectMap)
1142 }
1143
1144
1145
1146 type ServiceInputOutputSpecification struct {
1147
1148 Title *string `json:"title,omitempty"`
1149
1150 Description *string `json:"description,omitempty"`
1151
1152 Type *string `json:"type,omitempty"`
1153
1154 Properties map[string]*TableSpecification `json:"properties"`
1155 }
1156
1157
1158 func (sios ServiceInputOutputSpecification) MarshalJSON() ([]byte, error) {
1159 objectMap := make(map[string]interface{})
1160 if sios.Title != nil {
1161 objectMap["title"] = sios.Title
1162 }
1163 if sios.Description != nil {
1164 objectMap["description"] = sios.Description
1165 }
1166 if sios.Type != nil {
1167 objectMap["type"] = sios.Type
1168 }
1169 if sios.Properties != nil {
1170 objectMap["properties"] = sios.Properties
1171 }
1172 return json.Marshal(objectMap)
1173 }
1174
1175
1176 type StorageAccount struct {
1177
1178 Name *string `json:"name,omitempty"`
1179
1180 Key *string `json:"key,omitempty"`
1181 }
1182
1183
1184
1185 type TableSpecification struct {
1186
1187 Title *string `json:"title,omitempty"`
1188
1189 Description *string `json:"description,omitempty"`
1190
1191 Type *string `json:"type,omitempty"`
1192
1193 Format *string `json:"format,omitempty"`
1194
1195 Properties map[string]*ColumnSpecification `json:"properties"`
1196 }
1197
1198
1199 func (ts TableSpecification) MarshalJSON() ([]byte, error) {
1200 objectMap := make(map[string]interface{})
1201 if ts.Title != nil {
1202 objectMap["title"] = ts.Title
1203 }
1204 if ts.Description != nil {
1205 objectMap["description"] = ts.Description
1206 }
1207 if ts.Type != nil {
1208 objectMap["type"] = ts.Type
1209 }
1210 if ts.Format != nil {
1211 objectMap["format"] = ts.Format
1212 }
1213 if ts.Properties != nil {
1214 objectMap["properties"] = ts.Properties
1215 }
1216 return json.Marshal(objectMap)
1217 }
1218
1219
1220 type WebService struct {
1221 autorest.Response `json:"-"`
1222
1223 Properties BasicProperties `json:"properties,omitempty"`
1224
1225 ID *string `json:"id,omitempty"`
1226
1227 Name *string `json:"name,omitempty"`
1228
1229 Location *string `json:"location,omitempty"`
1230
1231 Type *string `json:"type,omitempty"`
1232
1233 Tags map[string]*string `json:"tags"`
1234 }
1235
1236
1237 func (ws WebService) MarshalJSON() ([]byte, error) {
1238 objectMap := make(map[string]interface{})
1239 objectMap["properties"] = ws.Properties
1240 if ws.Location != nil {
1241 objectMap["location"] = ws.Location
1242 }
1243 if ws.Tags != nil {
1244 objectMap["tags"] = ws.Tags
1245 }
1246 return json.Marshal(objectMap)
1247 }
1248
1249
1250 func (ws *WebService) UnmarshalJSON(body []byte) error {
1251 var m map[string]*json.RawMessage
1252 err := json.Unmarshal(body, &m)
1253 if err != nil {
1254 return err
1255 }
1256 for k, v := range m {
1257 switch k {
1258 case "properties":
1259 if v != nil {
1260 properties, err := unmarshalBasicProperties(*v)
1261 if err != nil {
1262 return err
1263 }
1264 ws.Properties = properties
1265 }
1266 case "id":
1267 if v != nil {
1268 var ID string
1269 err = json.Unmarshal(*v, &ID)
1270 if err != nil {
1271 return err
1272 }
1273 ws.ID = &ID
1274 }
1275 case "name":
1276 if v != nil {
1277 var name string
1278 err = json.Unmarshal(*v, &name)
1279 if err != nil {
1280 return err
1281 }
1282 ws.Name = &name
1283 }
1284 case "location":
1285 if v != nil {
1286 var location string
1287 err = json.Unmarshal(*v, &location)
1288 if err != nil {
1289 return err
1290 }
1291 ws.Location = &location
1292 }
1293 case "type":
1294 if v != nil {
1295 var typeVar string
1296 err = json.Unmarshal(*v, &typeVar)
1297 if err != nil {
1298 return err
1299 }
1300 ws.Type = &typeVar
1301 }
1302 case "tags":
1303 if v != nil {
1304 var tags map[string]*string
1305 err = json.Unmarshal(*v, &tags)
1306 if err != nil {
1307 return err
1308 }
1309 ws.Tags = tags
1310 }
1311 }
1312 }
1313
1314 return nil
1315 }
1316
View as plain text