-
Notifications
You must be signed in to change notification settings - Fork 814
/
models.go
1031 lines (937 loc) · 38.8 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package scheduler
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-01-01/scheduler"
// BasicAuthentication ...
type BasicAuthentication struct {
// Username - Gets or sets the username.
Username *string `json:"username,omitempty"`
// Password - Gets or sets the password.
Password *string `json:"password,omitempty"`
// Type - Gets or sets the http authentication type. Possible values include: 'NotSpecified', 'ClientCertificate', 'ActiveDirectoryOAuth', 'Basic'
Type HTTPAuthenticationType `json:"type,omitempty"`
}
// ClientCertAuthentication ...
type ClientCertAuthentication struct {
// Password - Gets or sets the password.
Password *string `json:"password,omitempty"`
// Pfx - Gets or sets the pfx.
Pfx *string `json:"pfx,omitempty"`
// CertificateThumbprint - Gets or sets the certificate thumbprint.
CertificateThumbprint *string `json:"certificateThumbprint,omitempty"`
// CertificateExpirationDate - Gets or sets the certificate expiration date.
CertificateExpirationDate *date.Time `json:"certificateExpirationDate,omitempty"`
// CertificateSubjectName - Gets or sets the certificate subject name.
CertificateSubjectName *string `json:"certificateSubjectName,omitempty"`
// Type - Gets or sets the http authentication type. Possible values include: 'NotSpecified', 'ClientCertificate', 'ActiveDirectoryOAuth', 'Basic'
Type HTTPAuthenticationType `json:"type,omitempty"`
}
// HTTPAuthentication ...
type HTTPAuthentication struct {
// Type - Gets or sets the http authentication type. Possible values include: 'NotSpecified', 'ClientCertificate', 'ActiveDirectoryOAuth', 'Basic'
Type HTTPAuthenticationType `json:"type,omitempty"`
}
// HTTPRequest ...
type HTTPRequest struct {
// Authentication - Gets or sets the http authentication.
Authentication *HTTPAuthentication `json:"authentication,omitempty"`
// URI - Gets or sets the Uri.
URI *string `json:"uri,omitempty"`
// Method - Gets or sets the method of the request.
Method *string `json:"method,omitempty"`
// Body - Gets or sets the request body.
Body *string `json:"body,omitempty"`
// Headers - Gets or sets the headers.
Headers map[string]*string `json:"headers"`
}
// MarshalJSON is the custom marshaler for HTTPRequest.
func (hr HTTPRequest) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if hr.Authentication != nil {
objectMap["authentication"] = hr.Authentication
}
if hr.URI != nil {
objectMap["uri"] = hr.URI
}
if hr.Method != nil {
objectMap["method"] = hr.Method
}
if hr.Body != nil {
objectMap["body"] = hr.Body
}
if hr.Headers != nil {
objectMap["headers"] = hr.Headers
}
return json.Marshal(objectMap)
}
// JobAction ...
type JobAction struct {
// Type - Gets or sets the job action type. Possible values include: 'HTTP', 'HTTPS', 'StorageQueue', 'ServiceBusQueue', 'ServiceBusTopic'
Type JobActionType `json:"type,omitempty"`
// Request - Gets or sets the http requests.
Request *HTTPRequest `json:"request,omitempty"`
// QueueMessage - Gets or sets the storage queue message.
QueueMessage *StorageQueueMessage `json:"queueMessage,omitempty"`
// ServiceBusQueueMessage - Gets or sets the service bus queue message.
ServiceBusQueueMessage *ServiceBusQueueMessage `json:"serviceBusQueueMessage,omitempty"`
// ServiceBusTopicMessage - Gets or sets the service bus topic message.
ServiceBusTopicMessage *ServiceBusTopicMessage `json:"serviceBusTopicMessage,omitempty"`
// RetryPolicy - Gets or sets the retry policy.
RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"`
// ErrorAction - Gets or sets the error action.
ErrorAction *JobErrorAction `json:"errorAction,omitempty"`
}
// JobCollectionDefinition ...
type JobCollectionDefinition struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; Gets the job collection resource identifier.
ID *string `json:"id,omitempty"`
// Type - READ-ONLY; Gets the job collection resource type.
Type *string `json:"type,omitempty"`
// Name - Gets or sets the job collection resource name.
Name *string `json:"name,omitempty"`
// Location - Gets or sets the storage account location.
Location *string `json:"location,omitempty"`
// Tags - Gets or sets the tags.
Tags map[string]*string `json:"tags"`
// Properties - Gets or sets the job collection properties.
Properties *JobCollectionProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for JobCollectionDefinition.
func (jcd JobCollectionDefinition) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if jcd.Name != nil {
objectMap["name"] = jcd.Name
}
if jcd.Location != nil {
objectMap["location"] = jcd.Location
}
if jcd.Tags != nil {
objectMap["tags"] = jcd.Tags
}
if jcd.Properties != nil {
objectMap["properties"] = jcd.Properties
}
return json.Marshal(objectMap)
}
// JobCollectionListResult ...
type JobCollectionListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; Gets the job collections.
Value *[]JobCollectionDefinition `json:"value,omitempty"`
// NextLink - Gets or sets the URL to get the next set of job collections.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for JobCollectionListResult.
func (jclr JobCollectionListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if jclr.NextLink != nil {
objectMap["nextLink"] = jclr.NextLink
}
return json.Marshal(objectMap)
}
// JobCollectionListResultIterator provides access to a complete listing of JobCollectionDefinition values.
type JobCollectionListResultIterator struct {
i int
page JobCollectionListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *JobCollectionListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/JobCollectionListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *JobCollectionListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter JobCollectionListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter JobCollectionListResultIterator) Response() JobCollectionListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter JobCollectionListResultIterator) Value() JobCollectionDefinition {
if !iter.page.NotDone() {
return JobCollectionDefinition{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the JobCollectionListResultIterator type.
func NewJobCollectionListResultIterator(page JobCollectionListResultPage) JobCollectionListResultIterator {
return JobCollectionListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (jclr JobCollectionListResult) IsEmpty() bool {
return jclr.Value == nil || len(*jclr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (jclr JobCollectionListResult) hasNextLink() bool {
return jclr.NextLink != nil && len(*jclr.NextLink) != 0
}
// jobCollectionListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (jclr JobCollectionListResult) jobCollectionListResultPreparer(ctx context.Context) (*http.Request, error) {
if !jclr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(jclr.NextLink)))
}
// JobCollectionListResultPage contains a page of JobCollectionDefinition values.
type JobCollectionListResultPage struct {
fn func(context.Context, JobCollectionListResult) (JobCollectionListResult, error)
jclr JobCollectionListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *JobCollectionListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/JobCollectionListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.jclr)
if err != nil {
return err
}
page.jclr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *JobCollectionListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page JobCollectionListResultPage) NotDone() bool {
return !page.jclr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page JobCollectionListResultPage) Response() JobCollectionListResult {
return page.jclr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page JobCollectionListResultPage) Values() []JobCollectionDefinition {
if page.jclr.IsEmpty() {
return nil
}
return *page.jclr.Value
}
// Creates a new instance of the JobCollectionListResultPage type.
func NewJobCollectionListResultPage(getNextPage func(context.Context, JobCollectionListResult) (JobCollectionListResult, error)) JobCollectionListResultPage {
return JobCollectionListResultPage{fn: getNextPage}
}
// JobCollectionProperties ...
type JobCollectionProperties struct {
// Sku - Gets or sets the SKU.
Sku *Sku `json:"sku,omitempty"`
// State - Gets or sets the state. Possible values include: 'Enabled', 'Disabled', 'Suspended', 'Deleted'
State JobCollectionState `json:"state,omitempty"`
// Quota - Gets or sets the job collection quota.
Quota *JobCollectionQuota `json:"quota,omitempty"`
}
// JobCollectionQuota ...
type JobCollectionQuota struct {
// MaxJobCount - Gets or set the maximum job count.
MaxJobCount *int32 `json:"maxJobCount,omitempty"`
// MaxJobOccurrence - Gets or sets the maximum job occurrence.
MaxJobOccurrence *int32 `json:"maxJobOccurrence,omitempty"`
// MaxRecurrence - Gets or set the maximum recurrence.
MaxRecurrence *JobMaxRecurrence `json:"maxRecurrence,omitempty"`
}
// JobDefinition ...
type JobDefinition struct {
autorest.Response `json:"-"`
// ID - READ-ONLY; Gets the job resource identifier.
ID *string `json:"id,omitempty"`
// Type - READ-ONLY; Gets the job resource type.
Type *string `json:"type,omitempty"`
// Name - READ-ONLY; Gets the job resource name.
Name *string `json:"name,omitempty"`
// Properties - Gets or sets the job properties.
Properties *JobProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for JobDefinition.
func (jd JobDefinition) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if jd.Properties != nil {
objectMap["properties"] = jd.Properties
}
return json.Marshal(objectMap)
}
// JobErrorAction ...
type JobErrorAction struct {
// Type - Gets or sets the job error action type. Possible values include: 'HTTP', 'HTTPS', 'StorageQueue', 'ServiceBusQueue', 'ServiceBusTopic'
Type JobActionType `json:"type,omitempty"`
// Request - Gets or sets the http requests.
Request *HTTPRequest `json:"request,omitempty"`
// QueueMessage - Gets or sets the storage queue message.
QueueMessage *StorageQueueMessage `json:"queueMessage,omitempty"`
// ServiceBusQueueMessage - Gets or sets the service bus queue message.
ServiceBusQueueMessage *ServiceBusQueueMessage `json:"serviceBusQueueMessage,omitempty"`
// ServiceBusTopicMessage - Gets or sets the service bus topic message.
ServiceBusTopicMessage *ServiceBusTopicMessage `json:"serviceBusTopicMessage,omitempty"`
// RetryPolicy - Gets or sets the retry policy.
RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"`
}
// JobHistoryDefinition ...
type JobHistoryDefinition struct {
// ID - READ-ONLY; Gets the job history identifier.
ID *string `json:"id,omitempty"`
// Type - READ-ONLY; Gets the job history resource type.
Type *string `json:"type,omitempty"`
// Name - READ-ONLY; Gets the job history name.
Name *string `json:"name,omitempty"`
// Properties - READ-ONLY; Gets or sets the job history properties.
Properties *JobHistoryDefinitionProperties `json:"properties,omitempty"`
}
// JobHistoryDefinitionProperties ...
type JobHistoryDefinitionProperties struct {
// StartTime - READ-ONLY; Gets the start time for this job.
StartTime *date.Time `json:"startTime,omitempty"`
// EndTime - READ-ONLY; Gets the end time for this job.
EndTime *date.Time `json:"endTime,omitempty"`
// ExpectedExecutionTime - READ-ONLY; Gets the expected execution time for this job.
ExpectedExecutionTime *date.Time `json:"expectedExecutionTime,omitempty"`
// ActionName - READ-ONLY; Gets the job history action name. Possible values include: 'MainAction', 'ErrorAction'
ActionName JobHistoryActionName `json:"actionName,omitempty"`
// Status - READ-ONLY; Gets the job history status. Possible values include: 'Completed', 'Failed', 'Postponed'
Status JobExecutionStatus `json:"status,omitempty"`
// Message - READ-ONLY; Gets the message for the job history.
Message *string `json:"message,omitempty"`
// RetryCount - READ-ONLY; Gets the retry count for job.
RetryCount *int32 `json:"retryCount,omitempty"`
// RepeatCount - READ-ONLY; Gets the repeat count for the job.
RepeatCount *int32 `json:"repeatCount,omitempty"`
}
// JobHistoryFilter ...
type JobHistoryFilter struct {
// Status - Gets or sets the job execution status. Possible values include: 'Completed', 'Failed', 'Postponed'
Status JobExecutionStatus `json:"status,omitempty"`
}
// JobHistoryListResult ...
type JobHistoryListResult struct {
autorest.Response `json:"-"`
// Value - Gets or sets the job histories under job.
Value *[]JobHistoryDefinition `json:"value,omitempty"`
// NextLink - Gets or sets the URL to get the next set of job histories.
NextLink *string `json:"nextLink,omitempty"`
}
// JobHistoryListResultIterator provides access to a complete listing of JobHistoryDefinition values.
type JobHistoryListResultIterator struct {
i int
page JobHistoryListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *JobHistoryListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/JobHistoryListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *JobHistoryListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter JobHistoryListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter JobHistoryListResultIterator) Response() JobHistoryListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter JobHistoryListResultIterator) Value() JobHistoryDefinition {
if !iter.page.NotDone() {
return JobHistoryDefinition{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the JobHistoryListResultIterator type.
func NewJobHistoryListResultIterator(page JobHistoryListResultPage) JobHistoryListResultIterator {
return JobHistoryListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (jhlr JobHistoryListResult) IsEmpty() bool {
return jhlr.Value == nil || len(*jhlr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (jhlr JobHistoryListResult) hasNextLink() bool {
return jhlr.NextLink != nil && len(*jhlr.NextLink) != 0
}
// jobHistoryListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (jhlr JobHistoryListResult) jobHistoryListResultPreparer(ctx context.Context) (*http.Request, error) {
if !jhlr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(jhlr.NextLink)))
}
// JobHistoryListResultPage contains a page of JobHistoryDefinition values.
type JobHistoryListResultPage struct {
fn func(context.Context, JobHistoryListResult) (JobHistoryListResult, error)
jhlr JobHistoryListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *JobHistoryListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/JobHistoryListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.jhlr)
if err != nil {
return err
}
page.jhlr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *JobHistoryListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page JobHistoryListResultPage) NotDone() bool {
return !page.jhlr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page JobHistoryListResultPage) Response() JobHistoryListResult {
return page.jhlr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page JobHistoryListResultPage) Values() []JobHistoryDefinition {
if page.jhlr.IsEmpty() {
return nil
}
return *page.jhlr.Value
}
// Creates a new instance of the JobHistoryListResultPage type.
func NewJobHistoryListResultPage(getNextPage func(context.Context, JobHistoryListResult) (JobHistoryListResult, error)) JobHistoryListResultPage {
return JobHistoryListResultPage{fn: getNextPage}
}
// JobListResult ...
type JobListResult struct {
autorest.Response `json:"-"`
// Value - Gets or sets all jobs under job collection.
Value *[]JobDefinition `json:"value,omitempty"`
// NextLink - Gets or sets the URL to get the next set of jobs.
NextLink *string `json:"nextLink,omitempty"`
}
// JobListResultIterator provides access to a complete listing of JobDefinition values.
type JobListResultIterator struct {
i int
page JobListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *JobListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *JobListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter JobListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter JobListResultIterator) Response() JobListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter JobListResultIterator) Value() JobDefinition {
if !iter.page.NotDone() {
return JobDefinition{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the JobListResultIterator type.
func NewJobListResultIterator(page JobListResultPage) JobListResultIterator {
return JobListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (jlr JobListResult) IsEmpty() bool {
return jlr.Value == nil || len(*jlr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (jlr JobListResult) hasNextLink() bool {
return jlr.NextLink != nil && len(*jlr.NextLink) != 0
}
// jobListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (jlr JobListResult) jobListResultPreparer(ctx context.Context) (*http.Request, error) {
if !jlr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(jlr.NextLink)))
}
// JobListResultPage contains a page of JobDefinition values.
type JobListResultPage struct {
fn func(context.Context, JobListResult) (JobListResult, error)
jlr JobListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *JobListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.jlr)
if err != nil {
return err
}
page.jlr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *JobListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page JobListResultPage) NotDone() bool {
return !page.jlr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page JobListResultPage) Response() JobListResult {
return page.jlr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page JobListResultPage) Values() []JobDefinition {
if page.jlr.IsEmpty() {
return nil
}
return *page.jlr.Value
}
// Creates a new instance of the JobListResultPage type.
func NewJobListResultPage(getNextPage func(context.Context, JobListResult) (JobListResult, error)) JobListResultPage {
return JobListResultPage{fn: getNextPage}
}
// JobMaxRecurrence ...
type JobMaxRecurrence struct {
// Frequency - Gets or sets the frequency of recurrence (second, minute, hour, day, week, month). Possible values include: 'Minute', 'Hour', 'Day', 'Week', 'Month'
Frequency RecurrenceFrequency `json:"frequency,omitempty"`
// Interval - Gets or sets the interval between retries.
Interval *int32 `json:"interval,omitempty"`
}
// JobProperties ...
type JobProperties struct {
// StartTime - Gets or sets the job start time.
StartTime *date.Time `json:"startTime,omitempty"`
// Action - Gets or sets the job action.
Action *JobAction `json:"action,omitempty"`
// Recurrence - Gets or sets the job recurrence.
Recurrence *JobRecurrence `json:"recurrence,omitempty"`
// State - Gets or set the job state. Possible values include: 'JobStateEnabled', 'JobStateDisabled', 'JobStateFaulted', 'JobStateCompleted'
State JobState `json:"state,omitempty"`
// Status - READ-ONLY; Gets the job status.
Status *JobStatus `json:"status,omitempty"`
}
// MarshalJSON is the custom marshaler for JobProperties.
func (jp JobProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if jp.StartTime != nil {
objectMap["startTime"] = jp.StartTime
}
if jp.Action != nil {
objectMap["action"] = jp.Action
}
if jp.Recurrence != nil {
objectMap["recurrence"] = jp.Recurrence
}
if jp.State != "" {
objectMap["state"] = jp.State
}
return json.Marshal(objectMap)
}
// JobRecurrence ...
type JobRecurrence struct {
// Frequency - Gets or sets the frequency of recurrence (second, minute, hour, day, week, month). Possible values include: 'Minute', 'Hour', 'Day', 'Week', 'Month'
Frequency RecurrenceFrequency `json:"frequency,omitempty"`
// Interval - Gets or sets the interval between retries.
Interval *int32 `json:"interval,omitempty"`
// Count - Gets or sets the maximum number of times that the job should run.
Count *int32 `json:"count,omitempty"`
// EndTime - Gets or sets the time at which the job will complete.
EndTime *date.Time `json:"endTime,omitempty"`
Schedule *JobRecurrenceSchedule `json:"schedule,omitempty"`
}
// JobRecurrenceSchedule ...
type JobRecurrenceSchedule struct {
// WeekDays - Gets or sets the days of the week that the job should execute on.
WeekDays *[]DayOfWeek `json:"weekDays,omitempty"`
// Hours - Gets or sets the hours of the day that the job should execute at.
Hours *[]int32 `json:"hours,omitempty"`
// Minutes - Gets or sets the minutes of the hour that the job should execute at.
Minutes *[]int32 `json:"minutes,omitempty"`
// MonthDays - Gets or sets the days of the month that the job should execute on. Must be between 1 and 31.
MonthDays *[]int32 `json:"monthDays,omitempty"`
// MonthlyOccurrences - Gets or sets the occurrences of days within a month.
MonthlyOccurrences *[]JobRecurrenceScheduleMonthlyOccurrence `json:"monthlyOccurrences,omitempty"`
}
// JobRecurrenceScheduleMonthlyOccurrence ...
type JobRecurrenceScheduleMonthlyOccurrence struct {
// Day - Gets or sets the day. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday. Possible values include: 'JobScheduleDayMonday', 'JobScheduleDayTuesday', 'JobScheduleDayWednesday', 'JobScheduleDayThursday', 'JobScheduleDayFriday', 'JobScheduleDaySaturday', 'JobScheduleDaySunday'
Day JobScheduleDay `json:"day,omitempty"`
// Occurrence - Gets or sets the occurrence. Must be between -5 and 5.
Occurrence *int32 `json:"Occurrence,omitempty"`
}
// JobStateFilter ...
type JobStateFilter struct {
// State - Gets or sets the job state. Possible values include: 'JobStateEnabled', 'JobStateDisabled', 'JobStateFaulted', 'JobStateCompleted'
State JobState `json:"state,omitempty"`
}
// JobStatus ...
type JobStatus struct {
// ExecutionCount - READ-ONLY; Gets the number of times this job has executed.
ExecutionCount *int32 `json:"executionCount,omitempty"`
// FailureCount - READ-ONLY; Gets the number of times this job has failed.
FailureCount *int32 `json:"failureCount,omitempty"`
// FaultedCount - READ-ONLY; Gets the number of faulted occurrences (occurrences that were retried and failed as many times as the retry policy states).
FaultedCount *int32 `json:"faultedCount,omitempty"`
// LastExecutionTime - READ-ONLY; Gets the time the last occurrence executed in ISO-8601 format. Could be empty if job has not run yet.
LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"`
// NextExecutionTime - READ-ONLY; Gets the time of the next occurrence in ISO-8601 format. Could be empty if the job is completed.
NextExecutionTime *date.Time `json:"nextExecutionTime,omitempty"`
}
// OAuthAuthentication ...
type OAuthAuthentication struct {
// Secret - Gets or sets the secret.
Secret *string `json:"secret,omitempty"`
// Tenant - Gets or sets the tenant.
Tenant *string `json:"tenant,omitempty"`
// Audience - Gets or sets the audience.
Audience *string `json:"audience,omitempty"`
// ClientID - Gets or sets the client identifier.
ClientID *string `json:"clientId,omitempty"`
// Type - Gets or sets the http authentication type. Possible values include: 'NotSpecified', 'ClientCertificate', 'ActiveDirectoryOAuth', 'Basic'
Type HTTPAuthenticationType `json:"type,omitempty"`
}
// RetryPolicy ...
type RetryPolicy struct {
// RetryType - Gets or sets the retry strategy to be used. Possible values include: 'None', 'Fixed'
RetryType RetryType `json:"retryType,omitempty"`
// RetryInterval - Gets or sets the retry interval between retries.
RetryInterval *string `json:"retryInterval,omitempty"`
// RetryCount - Gets or sets the number of times a retry should be attempted.
RetryCount *int32 `json:"retryCount,omitempty"`
}
// ServiceBusAuthentication ...
type ServiceBusAuthentication struct {
// SasKey - Gets or sets the SAS key.
SasKey *string `json:"sasKey,omitempty"`
// SasKeyName - Gets or sets the SAS key name.
SasKeyName *string `json:"sasKeyName,omitempty"`
// Type - Gets or sets the authentication type. Possible values include: 'ServiceBusAuthenticationTypeNotSpecified', 'ServiceBusAuthenticationTypeSharedAccessKey'
Type ServiceBusAuthenticationType `json:"type,omitempty"`
}
// ServiceBusBrokeredMessageProperties ...
type ServiceBusBrokeredMessageProperties struct {
// ContentType - Gets or sets the content type.
ContentType *string `json:"contentType,omitempty"`
// CorrelationID - Gets or sets the correlation id.
CorrelationID *string `json:"correlationId,omitempty"`
// ForcePersistence - Gets or sets the force persistence.
ForcePersistence *bool `json:"forcePersistence,omitempty"`
// Label - Gets or sets the label.
Label *string `json:"label,omitempty"`
// MessageID - Gets or sets the message id.
MessageID *string `json:"messageId,omitempty"`
// PartitionKey - Gets or sets the partition key.
PartitionKey *string `json:"partitionKey,omitempty"`
// ReplyTo - Gets or sets the reply to.
ReplyTo *string `json:"replyTo,omitempty"`
// ReplyToSessionID - Gets or sets the reply to session id.
ReplyToSessionID *string `json:"replyToSessionId,omitempty"`
// ScheduledEnqueueTimeUtc - Gets or sets the scheduled enqueue time UTC.
ScheduledEnqueueTimeUtc *date.Time `json:"scheduledEnqueueTimeUtc,omitempty"`
// SessionID - Gets or sets the session id.
SessionID *string `json:"sessionId,omitempty"`
// TimeToLive - Gets or sets the time to live.
TimeToLive *date.Time `json:"timeToLive,omitempty"`
// To - Gets or sets the to.
To *string `json:"to,omitempty"`
// ViaPartitionKey - Gets or sets the via partition key.
ViaPartitionKey *string `json:"viaPartitionKey,omitempty"`
}
// ServiceBusMessage ...
type ServiceBusMessage struct {
// Authentication - Gets or sets the authentication.
Authentication *ServiceBusAuthentication `json:"authentication,omitempty"`
// BrokeredMessageProperties - Gets or sets the brokered message properties.
BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"`
// CustomMessageProperties - Gets or sets the custom message properties.
CustomMessageProperties map[string]*string `json:"customMessageProperties"`
// Message - Gets or sets the message.
Message *string `json:"message,omitempty"`
// Namespace - Gets or sets the namespace.
Namespace *string `json:"namespace,omitempty"`
// TransportType - Gets or sets the transport type. Possible values include: 'ServiceBusTransportTypeNotSpecified', 'ServiceBusTransportTypeNetMessaging', 'ServiceBusTransportTypeAMQP'
TransportType ServiceBusTransportType `json:"transportType,omitempty"`
}
// MarshalJSON is the custom marshaler for ServiceBusMessage.
func (sbm ServiceBusMessage) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if sbm.Authentication != nil {
objectMap["authentication"] = sbm.Authentication
}
if sbm.BrokeredMessageProperties != nil {
objectMap["brokeredMessageProperties"] = sbm.BrokeredMessageProperties
}
if sbm.CustomMessageProperties != nil {
objectMap["customMessageProperties"] = sbm.CustomMessageProperties
}
if sbm.Message != nil {
objectMap["message"] = sbm.Message
}
if sbm.Namespace != nil {
objectMap["namespace"] = sbm.Namespace
}
if sbm.TransportType != "" {
objectMap["transportType"] = sbm.TransportType
}
return json.Marshal(objectMap)
}
// ServiceBusQueueMessage ...
type ServiceBusQueueMessage struct {
// QueueName - Gets or sets the queue name.
QueueName *string `json:"queueName,omitempty"`
// Authentication - Gets or sets the authentication.
Authentication *ServiceBusAuthentication `json:"authentication,omitempty"`
// BrokeredMessageProperties - Gets or sets the brokered message properties.
BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"`
// CustomMessageProperties - Gets or sets the custom message properties.
CustomMessageProperties map[string]*string `json:"customMessageProperties"`
// Message - Gets or sets the message.
Message *string `json:"message,omitempty"`
// Namespace - Gets or sets the namespace.
Namespace *string `json:"namespace,omitempty"`
// TransportType - Gets or sets the transport type. Possible values include: 'ServiceBusTransportTypeNotSpecified', 'ServiceBusTransportTypeNetMessaging', 'ServiceBusTransportTypeAMQP'
TransportType ServiceBusTransportType `json:"transportType,omitempty"`
}
// MarshalJSON is the custom marshaler for ServiceBusQueueMessage.
func (sbqm ServiceBusQueueMessage) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if sbqm.QueueName != nil {
objectMap["queueName"] = sbqm.QueueName
}
if sbqm.Authentication != nil {
objectMap["authentication"] = sbqm.Authentication
}
if sbqm.BrokeredMessageProperties != nil {
objectMap["brokeredMessageProperties"] = sbqm.BrokeredMessageProperties
}
if sbqm.CustomMessageProperties != nil {
objectMap["customMessageProperties"] = sbqm.CustomMessageProperties
}
if sbqm.Message != nil {
objectMap["message"] = sbqm.Message
}
if sbqm.Namespace != nil {
objectMap["namespace"] = sbqm.Namespace
}
if sbqm.TransportType != "" {
objectMap["transportType"] = sbqm.TransportType
}
return json.Marshal(objectMap)
}
// ServiceBusTopicMessage ...
type ServiceBusTopicMessage struct {
// TopicPath - Gets or sets the topic path.
TopicPath *string `json:"topicPath,omitempty"`
// Authentication - Gets or sets the authentication.
Authentication *ServiceBusAuthentication `json:"authentication,omitempty"`
// BrokeredMessageProperties - Gets or sets the brokered message properties.
BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"`
// CustomMessageProperties - Gets or sets the custom message properties.
CustomMessageProperties map[string]*string `json:"customMessageProperties"`
// Message - Gets or sets the message.
Message *string `json:"message,omitempty"`
// Namespace - Gets or sets the namespace.
Namespace *string `json:"namespace,omitempty"`
// TransportType - Gets or sets the transport type. Possible values include: 'ServiceBusTransportTypeNotSpecified', 'ServiceBusTransportTypeNetMessaging', 'ServiceBusTransportTypeAMQP'
TransportType ServiceBusTransportType `json:"transportType,omitempty"`
}
// MarshalJSON is the custom marshaler for ServiceBusTopicMessage.
func (sbtm ServiceBusTopicMessage) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if sbtm.TopicPath != nil {
objectMap["topicPath"] = sbtm.TopicPath
}
if sbtm.Authentication != nil {
objectMap["authentication"] = sbtm.Authentication
}
if sbtm.BrokeredMessageProperties != nil {
objectMap["brokeredMessageProperties"] = sbtm.BrokeredMessageProperties
}
if sbtm.CustomMessageProperties != nil {