1package eventhub
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
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// The package's fully qualified name.
21const fqdn = "github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub"
22
23// AccessKeys namespace/EventHub Connection String
24type AccessKeys struct {
25	autorest.Response `json:"-"`
26	// PrimaryConnectionString - READ-ONLY; Primary connection string of the created namespace AuthorizationRule.
27	PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"`
28	// SecondaryConnectionString - READ-ONLY; Secondary connection string of the created namespace AuthorizationRule.
29	SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"`
30	// AliasPrimaryConnectionString - READ-ONLY; Primary connection string of the alias if GEO DR is enabled
31	AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"`
32	// AliasSecondaryConnectionString - READ-ONLY; Secondary  connection string of the alias if GEO DR is enabled
33	AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"`
34	// PrimaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token.
35	PrimaryKey *string `json:"primaryKey,omitempty"`
36	// SecondaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token.
37	SecondaryKey *string `json:"secondaryKey,omitempty"`
38	// KeyName - READ-ONLY; A string that describes the AuthorizationRule.
39	KeyName *string `json:"keyName,omitempty"`
40}
41
42// MarshalJSON is the custom marshaler for AccessKeys.
43func (ak AccessKeys) MarshalJSON() ([]byte, error) {
44	objectMap := make(map[string]interface{})
45	return json.Marshal(objectMap)
46}
47
48// ArmDisasterRecovery single item in List or Get Alias(Disaster Recovery configuration) operation
49type ArmDisasterRecovery struct {
50	autorest.Response `json:"-"`
51	// ArmDisasterRecoveryProperties - Properties required to the Create Or Update Alias(Disaster Recovery configurations)
52	*ArmDisasterRecoveryProperties `json:"properties,omitempty"`
53	// ID - READ-ONLY; Resource ID.
54	ID *string `json:"id,omitempty"`
55	// Name - READ-ONLY; Resource name.
56	Name *string `json:"name,omitempty"`
57	// Type - READ-ONLY; Resource type.
58	Type *string `json:"type,omitempty"`
59}
60
61// MarshalJSON is the custom marshaler for ArmDisasterRecovery.
62func (adr ArmDisasterRecovery) MarshalJSON() ([]byte, error) {
63	objectMap := make(map[string]interface{})
64	if adr.ArmDisasterRecoveryProperties != nil {
65		objectMap["properties"] = adr.ArmDisasterRecoveryProperties
66	}
67	return json.Marshal(objectMap)
68}
69
70// UnmarshalJSON is the custom unmarshaler for ArmDisasterRecovery struct.
71func (adr *ArmDisasterRecovery) UnmarshalJSON(body []byte) error {
72	var m map[string]*json.RawMessage
73	err := json.Unmarshal(body, &m)
74	if err != nil {
75		return err
76	}
77	for k, v := range m {
78		switch k {
79		case "properties":
80			if v != nil {
81				var armDisasterRecoveryProperties ArmDisasterRecoveryProperties
82				err = json.Unmarshal(*v, &armDisasterRecoveryProperties)
83				if err != nil {
84					return err
85				}
86				adr.ArmDisasterRecoveryProperties = &armDisasterRecoveryProperties
87			}
88		case "id":
89			if v != nil {
90				var ID string
91				err = json.Unmarshal(*v, &ID)
92				if err != nil {
93					return err
94				}
95				adr.ID = &ID
96			}
97		case "name":
98			if v != nil {
99				var name string
100				err = json.Unmarshal(*v, &name)
101				if err != nil {
102					return err
103				}
104				adr.Name = &name
105			}
106		case "type":
107			if v != nil {
108				var typeVar string
109				err = json.Unmarshal(*v, &typeVar)
110				if err != nil {
111					return err
112				}
113				adr.Type = &typeVar
114			}
115		}
116	}
117
118	return nil
119}
120
121// ArmDisasterRecoveryListResult the result of the List Alias(Disaster Recovery configuration) operation.
122type ArmDisasterRecoveryListResult struct {
123	autorest.Response `json:"-"`
124	// Value - List of Alias(Disaster Recovery configurations)
125	Value *[]ArmDisasterRecovery `json:"value,omitempty"`
126	// NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of Alias(Disaster Recovery configuration)
127	NextLink *string `json:"nextLink,omitempty"`
128}
129
130// MarshalJSON is the custom marshaler for ArmDisasterRecoveryListResult.
131func (adrlr ArmDisasterRecoveryListResult) MarshalJSON() ([]byte, error) {
132	objectMap := make(map[string]interface{})
133	if adrlr.Value != nil {
134		objectMap["value"] = adrlr.Value
135	}
136	return json.Marshal(objectMap)
137}
138
139// ArmDisasterRecoveryListResultIterator provides access to a complete listing of ArmDisasterRecovery
140// values.
141type ArmDisasterRecoveryListResultIterator struct {
142	i    int
143	page ArmDisasterRecoveryListResultPage
144}
145
146// NextWithContext advances to the next value.  If there was an error making
147// the request the iterator does not advance and the error is returned.
148func (iter *ArmDisasterRecoveryListResultIterator) NextWithContext(ctx context.Context) (err error) {
149	if tracing.IsEnabled() {
150		ctx = tracing.StartSpan(ctx, fqdn+"/ArmDisasterRecoveryListResultIterator.NextWithContext")
151		defer func() {
152			sc := -1
153			if iter.Response().Response.Response != nil {
154				sc = iter.Response().Response.Response.StatusCode
155			}
156			tracing.EndSpan(ctx, sc, err)
157		}()
158	}
159	iter.i++
160	if iter.i < len(iter.page.Values()) {
161		return nil
162	}
163	err = iter.page.NextWithContext(ctx)
164	if err != nil {
165		iter.i--
166		return err
167	}
168	iter.i = 0
169	return nil
170}
171
172// Next advances to the next value.  If there was an error making
173// the request the iterator does not advance and the error is returned.
174// Deprecated: Use NextWithContext() instead.
175func (iter *ArmDisasterRecoveryListResultIterator) Next() error {
176	return iter.NextWithContext(context.Background())
177}
178
179// NotDone returns true if the enumeration should be started or is not yet complete.
180func (iter ArmDisasterRecoveryListResultIterator) NotDone() bool {
181	return iter.page.NotDone() && iter.i < len(iter.page.Values())
182}
183
184// Response returns the raw server response from the last page request.
185func (iter ArmDisasterRecoveryListResultIterator) Response() ArmDisasterRecoveryListResult {
186	return iter.page.Response()
187}
188
189// Value returns the current value or a zero-initialized value if the
190// iterator has advanced beyond the end of the collection.
191func (iter ArmDisasterRecoveryListResultIterator) Value() ArmDisasterRecovery {
192	if !iter.page.NotDone() {
193		return ArmDisasterRecovery{}
194	}
195	return iter.page.Values()[iter.i]
196}
197
198// Creates a new instance of the ArmDisasterRecoveryListResultIterator type.
199func NewArmDisasterRecoveryListResultIterator(page ArmDisasterRecoveryListResultPage) ArmDisasterRecoveryListResultIterator {
200	return ArmDisasterRecoveryListResultIterator{page: page}
201}
202
203// IsEmpty returns true if the ListResult contains no values.
204func (adrlr ArmDisasterRecoveryListResult) IsEmpty() bool {
205	return adrlr.Value == nil || len(*adrlr.Value) == 0
206}
207
208// hasNextLink returns true if the NextLink is not empty.
209func (adrlr ArmDisasterRecoveryListResult) hasNextLink() bool {
210	return adrlr.NextLink != nil && len(*adrlr.NextLink) != 0
211}
212
213// armDisasterRecoveryListResultPreparer prepares a request to retrieve the next set of results.
214// It returns nil if no more results exist.
215func (adrlr ArmDisasterRecoveryListResult) armDisasterRecoveryListResultPreparer(ctx context.Context) (*http.Request, error) {
216	if !adrlr.hasNextLink() {
217		return nil, nil
218	}
219	return autorest.Prepare((&http.Request{}).WithContext(ctx),
220		autorest.AsJSON(),
221		autorest.AsGet(),
222		autorest.WithBaseURL(to.String(adrlr.NextLink)))
223}
224
225// ArmDisasterRecoveryListResultPage contains a page of ArmDisasterRecovery values.
226type ArmDisasterRecoveryListResultPage struct {
227	fn    func(context.Context, ArmDisasterRecoveryListResult) (ArmDisasterRecoveryListResult, error)
228	adrlr ArmDisasterRecoveryListResult
229}
230
231// NextWithContext advances to the next page of values.  If there was an error making
232// the request the page does not advance and the error is returned.
233func (page *ArmDisasterRecoveryListResultPage) NextWithContext(ctx context.Context) (err error) {
234	if tracing.IsEnabled() {
235		ctx = tracing.StartSpan(ctx, fqdn+"/ArmDisasterRecoveryListResultPage.NextWithContext")
236		defer func() {
237			sc := -1
238			if page.Response().Response.Response != nil {
239				sc = page.Response().Response.Response.StatusCode
240			}
241			tracing.EndSpan(ctx, sc, err)
242		}()
243	}
244	for {
245		next, err := page.fn(ctx, page.adrlr)
246		if err != nil {
247			return err
248		}
249		page.adrlr = next
250		if !next.hasNextLink() || !next.IsEmpty() {
251			break
252		}
253	}
254	return nil
255}
256
257// Next advances to the next page of values.  If there was an error making
258// the request the page does not advance and the error is returned.
259// Deprecated: Use NextWithContext() instead.
260func (page *ArmDisasterRecoveryListResultPage) Next() error {
261	return page.NextWithContext(context.Background())
262}
263
264// NotDone returns true if the page enumeration should be started or is not yet complete.
265func (page ArmDisasterRecoveryListResultPage) NotDone() bool {
266	return !page.adrlr.IsEmpty()
267}
268
269// Response returns the raw server response from the last page request.
270func (page ArmDisasterRecoveryListResultPage) Response() ArmDisasterRecoveryListResult {
271	return page.adrlr
272}
273
274// Values returns the slice of values for the current page or nil if there are no values.
275func (page ArmDisasterRecoveryListResultPage) Values() []ArmDisasterRecovery {
276	if page.adrlr.IsEmpty() {
277		return nil
278	}
279	return *page.adrlr.Value
280}
281
282// Creates a new instance of the ArmDisasterRecoveryListResultPage type.
283func NewArmDisasterRecoveryListResultPage(cur ArmDisasterRecoveryListResult, getNextPage func(context.Context, ArmDisasterRecoveryListResult) (ArmDisasterRecoveryListResult, error)) ArmDisasterRecoveryListResultPage {
284	return ArmDisasterRecoveryListResultPage{
285		fn:    getNextPage,
286		adrlr: cur,
287	}
288}
289
290// ArmDisasterRecoveryProperties properties required to the Create Or Update Alias(Disaster Recovery
291// configurations)
292type ArmDisasterRecoveryProperties struct {
293	// ProvisioningState - READ-ONLY; Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: 'Accepted', 'Succeeded', 'Failed'
294	ProvisioningState ProvisioningStateDR `json:"provisioningState,omitempty"`
295	// PartnerNamespace - ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing
296	PartnerNamespace *string `json:"partnerNamespace,omitempty"`
297	// AlternateName - Alternate name specified when alias and namespace names are same.
298	AlternateName *string `json:"alternateName,omitempty"`
299	// Role - READ-ONLY; role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: 'Primary', 'PrimaryNotReplicating', 'Secondary'
300	Role RoleDisasterRecovery `json:"role,omitempty"`
301	// PendingReplicationOperationsCount - READ-ONLY; Number of entities pending to be replicated.
302	PendingReplicationOperationsCount *int64 `json:"pendingReplicationOperationsCount,omitempty"`
303}
304
305// MarshalJSON is the custom marshaler for ArmDisasterRecoveryProperties.
306func (adr ArmDisasterRecoveryProperties) MarshalJSON() ([]byte, error) {
307	objectMap := make(map[string]interface{})
308	if adr.PartnerNamespace != nil {
309		objectMap["partnerNamespace"] = adr.PartnerNamespace
310	}
311	if adr.AlternateName != nil {
312		objectMap["alternateName"] = adr.AlternateName
313	}
314	return json.Marshal(objectMap)
315}
316
317// AuthorizationRule single item in a List or Get AuthorizationRule operation
318type AuthorizationRule struct {
319	autorest.Response `json:"-"`
320	// AuthorizationRuleProperties - Properties supplied to create or update AuthorizationRule
321	*AuthorizationRuleProperties `json:"properties,omitempty"`
322	// ID - READ-ONLY; Resource ID.
323	ID *string `json:"id,omitempty"`
324	// Name - READ-ONLY; Resource name.
325	Name *string `json:"name,omitempty"`
326	// Type - READ-ONLY; Resource type.
327	Type *string `json:"type,omitempty"`
328}
329
330// MarshalJSON is the custom marshaler for AuthorizationRule.
331func (ar AuthorizationRule) MarshalJSON() ([]byte, error) {
332	objectMap := make(map[string]interface{})
333	if ar.AuthorizationRuleProperties != nil {
334		objectMap["properties"] = ar.AuthorizationRuleProperties
335	}
336	return json.Marshal(objectMap)
337}
338
339// UnmarshalJSON is the custom unmarshaler for AuthorizationRule struct.
340func (ar *AuthorizationRule) UnmarshalJSON(body []byte) error {
341	var m map[string]*json.RawMessage
342	err := json.Unmarshal(body, &m)
343	if err != nil {
344		return err
345	}
346	for k, v := range m {
347		switch k {
348		case "properties":
349			if v != nil {
350				var authorizationRuleProperties AuthorizationRuleProperties
351				err = json.Unmarshal(*v, &authorizationRuleProperties)
352				if err != nil {
353					return err
354				}
355				ar.AuthorizationRuleProperties = &authorizationRuleProperties
356			}
357		case "id":
358			if v != nil {
359				var ID string
360				err = json.Unmarshal(*v, &ID)
361				if err != nil {
362					return err
363				}
364				ar.ID = &ID
365			}
366		case "name":
367			if v != nil {
368				var name string
369				err = json.Unmarshal(*v, &name)
370				if err != nil {
371					return err
372				}
373				ar.Name = &name
374			}
375		case "type":
376			if v != nil {
377				var typeVar string
378				err = json.Unmarshal(*v, &typeVar)
379				if err != nil {
380					return err
381				}
382				ar.Type = &typeVar
383			}
384		}
385	}
386
387	return nil
388}
389
390// AuthorizationRuleListResult the response from the List namespace operation.
391type AuthorizationRuleListResult struct {
392	autorest.Response `json:"-"`
393	// Value - Result of the List Authorization Rules operation.
394	Value *[]AuthorizationRule `json:"value,omitempty"`
395	// NextLink - Link to the next set of results. Not empty if Value contains an incomplete list of Authorization Rules
396	NextLink *string `json:"nextLink,omitempty"`
397}
398
399// AuthorizationRuleListResultIterator provides access to a complete listing of AuthorizationRule values.
400type AuthorizationRuleListResultIterator struct {
401	i    int
402	page AuthorizationRuleListResultPage
403}
404
405// NextWithContext advances to the next value.  If there was an error making
406// the request the iterator does not advance and the error is returned.
407func (iter *AuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
408	if tracing.IsEnabled() {
409		ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationRuleListResultIterator.NextWithContext")
410		defer func() {
411			sc := -1
412			if iter.Response().Response.Response != nil {
413				sc = iter.Response().Response.Response.StatusCode
414			}
415			tracing.EndSpan(ctx, sc, err)
416		}()
417	}
418	iter.i++
419	if iter.i < len(iter.page.Values()) {
420		return nil
421	}
422	err = iter.page.NextWithContext(ctx)
423	if err != nil {
424		iter.i--
425		return err
426	}
427	iter.i = 0
428	return nil
429}
430
431// Next advances to the next value.  If there was an error making
432// the request the iterator does not advance and the error is returned.
433// Deprecated: Use NextWithContext() instead.
434func (iter *AuthorizationRuleListResultIterator) Next() error {
435	return iter.NextWithContext(context.Background())
436}
437
438// NotDone returns true if the enumeration should be started or is not yet complete.
439func (iter AuthorizationRuleListResultIterator) NotDone() bool {
440	return iter.page.NotDone() && iter.i < len(iter.page.Values())
441}
442
443// Response returns the raw server response from the last page request.
444func (iter AuthorizationRuleListResultIterator) Response() AuthorizationRuleListResult {
445	return iter.page.Response()
446}
447
448// Value returns the current value or a zero-initialized value if the
449// iterator has advanced beyond the end of the collection.
450func (iter AuthorizationRuleListResultIterator) Value() AuthorizationRule {
451	if !iter.page.NotDone() {
452		return AuthorizationRule{}
453	}
454	return iter.page.Values()[iter.i]
455}
456
457// Creates a new instance of the AuthorizationRuleListResultIterator type.
458func NewAuthorizationRuleListResultIterator(page AuthorizationRuleListResultPage) AuthorizationRuleListResultIterator {
459	return AuthorizationRuleListResultIterator{page: page}
460}
461
462// IsEmpty returns true if the ListResult contains no values.
463func (arlr AuthorizationRuleListResult) IsEmpty() bool {
464	return arlr.Value == nil || len(*arlr.Value) == 0
465}
466
467// hasNextLink returns true if the NextLink is not empty.
468func (arlr AuthorizationRuleListResult) hasNextLink() bool {
469	return arlr.NextLink != nil && len(*arlr.NextLink) != 0
470}
471
472// authorizationRuleListResultPreparer prepares a request to retrieve the next set of results.
473// It returns nil if no more results exist.
474func (arlr AuthorizationRuleListResult) authorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
475	if !arlr.hasNextLink() {
476		return nil, nil
477	}
478	return autorest.Prepare((&http.Request{}).WithContext(ctx),
479		autorest.AsJSON(),
480		autorest.AsGet(),
481		autorest.WithBaseURL(to.String(arlr.NextLink)))
482}
483
484// AuthorizationRuleListResultPage contains a page of AuthorizationRule values.
485type AuthorizationRuleListResultPage struct {
486	fn   func(context.Context, AuthorizationRuleListResult) (AuthorizationRuleListResult, error)
487	arlr AuthorizationRuleListResult
488}
489
490// NextWithContext advances to the next page of values.  If there was an error making
491// the request the page does not advance and the error is returned.
492func (page *AuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
493	if tracing.IsEnabled() {
494		ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationRuleListResultPage.NextWithContext")
495		defer func() {
496			sc := -1
497			if page.Response().Response.Response != nil {
498				sc = page.Response().Response.Response.StatusCode
499			}
500			tracing.EndSpan(ctx, sc, err)
501		}()
502	}
503	for {
504		next, err := page.fn(ctx, page.arlr)
505		if err != nil {
506			return err
507		}
508		page.arlr = next
509		if !next.hasNextLink() || !next.IsEmpty() {
510			break
511		}
512	}
513	return nil
514}
515
516// Next advances to the next page of values.  If there was an error making
517// the request the page does not advance and the error is returned.
518// Deprecated: Use NextWithContext() instead.
519func (page *AuthorizationRuleListResultPage) Next() error {
520	return page.NextWithContext(context.Background())
521}
522
523// NotDone returns true if the page enumeration should be started or is not yet complete.
524func (page AuthorizationRuleListResultPage) NotDone() bool {
525	return !page.arlr.IsEmpty()
526}
527
528// Response returns the raw server response from the last page request.
529func (page AuthorizationRuleListResultPage) Response() AuthorizationRuleListResult {
530	return page.arlr
531}
532
533// Values returns the slice of values for the current page or nil if there are no values.
534func (page AuthorizationRuleListResultPage) Values() []AuthorizationRule {
535	if page.arlr.IsEmpty() {
536		return nil
537	}
538	return *page.arlr.Value
539}
540
541// Creates a new instance of the AuthorizationRuleListResultPage type.
542func NewAuthorizationRuleListResultPage(cur AuthorizationRuleListResult, getNextPage func(context.Context, AuthorizationRuleListResult) (AuthorizationRuleListResult, error)) AuthorizationRuleListResultPage {
543	return AuthorizationRuleListResultPage{
544		fn:   getNextPage,
545		arlr: cur,
546	}
547}
548
549// AuthorizationRuleProperties properties supplied to create or update AuthorizationRule
550type AuthorizationRuleProperties struct {
551	// Rights - The rights associated with the rule.
552	Rights *[]AccessRights `json:"rights,omitempty"`
553}
554
555// CaptureDescription properties to configure capture description for eventhub
556type CaptureDescription struct {
557	// Enabled - A value that indicates whether capture description is enabled.
558	Enabled *bool `json:"enabled,omitempty"`
559	// Encoding - Enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be deprecated in New API Version. Possible values include: 'Avro', 'AvroDeflate'
560	Encoding EncodingCaptureDescription `json:"encoding,omitempty"`
561	// IntervalInSeconds - The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds
562	IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"`
563	// SizeLimitInBytes - The size window defines the amount of data built up in your Event Hub before an capture operation, value should be between 10485760 to 524288000 bytes
564	SizeLimitInBytes *int32 `json:"sizeLimitInBytes,omitempty"`
565	// Destination - Properties of Destination where capture will be stored. (Storage Account, Blob Names)
566	Destination *Destination `json:"destination,omitempty"`
567	// SkipEmptyArchives - A value that indicates whether to Skip Empty Archives
568	SkipEmptyArchives *bool `json:"skipEmptyArchives,omitempty"`
569}
570
571// CheckNameAvailabilityParameter parameter supplied to check Namespace name availability operation
572type CheckNameAvailabilityParameter struct {
573	// Name - Name to check the namespace name availability
574	Name *string `json:"name,omitempty"`
575}
576
577// CheckNameAvailabilityResult the Result of the CheckNameAvailability operation
578type CheckNameAvailabilityResult struct {
579	autorest.Response `json:"-"`
580	// Message - READ-ONLY; The detailed info regarding the reason associated with the Namespace.
581	Message *string `json:"message,omitempty"`
582	// NameAvailable - Value indicating Namespace is availability, true if the Namespace is available; otherwise, false.
583	NameAvailable *bool `json:"nameAvailable,omitempty"`
584	// Reason - The reason for unavailability of a Namespace. Possible values include: 'None', 'InvalidName', 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown', 'TooManyNamespaceInCurrentSubscription'
585	Reason UnavailableReason `json:"reason,omitempty"`
586}
587
588// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult.
589func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) {
590	objectMap := make(map[string]interface{})
591	if cnar.NameAvailable != nil {
592		objectMap["nameAvailable"] = cnar.NameAvailable
593	}
594	if cnar.Reason != "" {
595		objectMap["reason"] = cnar.Reason
596	}
597	return json.Marshal(objectMap)
598}
599
600// ConsumerGroup single item in List or Get Consumer group operation
601type ConsumerGroup struct {
602	autorest.Response `json:"-"`
603	// ConsumerGroupProperties - Single item in List or Get Consumer group operation
604	*ConsumerGroupProperties `json:"properties,omitempty"`
605	// ID - READ-ONLY; Resource ID.
606	ID *string `json:"id,omitempty"`
607	// Name - READ-ONLY; Resource name.
608	Name *string `json:"name,omitempty"`
609	// Type - READ-ONLY; Resource type.
610	Type *string `json:"type,omitempty"`
611}
612
613// MarshalJSON is the custom marshaler for ConsumerGroup.
614func (cg ConsumerGroup) MarshalJSON() ([]byte, error) {
615	objectMap := make(map[string]interface{})
616	if cg.ConsumerGroupProperties != nil {
617		objectMap["properties"] = cg.ConsumerGroupProperties
618	}
619	return json.Marshal(objectMap)
620}
621
622// UnmarshalJSON is the custom unmarshaler for ConsumerGroup struct.
623func (cg *ConsumerGroup) UnmarshalJSON(body []byte) error {
624	var m map[string]*json.RawMessage
625	err := json.Unmarshal(body, &m)
626	if err != nil {
627		return err
628	}
629	for k, v := range m {
630		switch k {
631		case "properties":
632			if v != nil {
633				var consumerGroupProperties ConsumerGroupProperties
634				err = json.Unmarshal(*v, &consumerGroupProperties)
635				if err != nil {
636					return err
637				}
638				cg.ConsumerGroupProperties = &consumerGroupProperties
639			}
640		case "id":
641			if v != nil {
642				var ID string
643				err = json.Unmarshal(*v, &ID)
644				if err != nil {
645					return err
646				}
647				cg.ID = &ID
648			}
649		case "name":
650			if v != nil {
651				var name string
652				err = json.Unmarshal(*v, &name)
653				if err != nil {
654					return err
655				}
656				cg.Name = &name
657			}
658		case "type":
659			if v != nil {
660				var typeVar string
661				err = json.Unmarshal(*v, &typeVar)
662				if err != nil {
663					return err
664				}
665				cg.Type = &typeVar
666			}
667		}
668	}
669
670	return nil
671}
672
673// ConsumerGroupListResult the result to the List Consumer Group operation.
674type ConsumerGroupListResult struct {
675	autorest.Response `json:"-"`
676	// Value - Result of the List Consumer Group operation.
677	Value *[]ConsumerGroup `json:"value,omitempty"`
678	// NextLink - Link to the next set of results. Not empty if Value contains incomplete list of Consumer Group
679	NextLink *string `json:"nextLink,omitempty"`
680}
681
682// ConsumerGroupListResultIterator provides access to a complete listing of ConsumerGroup values.
683type ConsumerGroupListResultIterator struct {
684	i    int
685	page ConsumerGroupListResultPage
686}
687
688// NextWithContext advances to the next value.  If there was an error making
689// the request the iterator does not advance and the error is returned.
690func (iter *ConsumerGroupListResultIterator) NextWithContext(ctx context.Context) (err error) {
691	if tracing.IsEnabled() {
692		ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerGroupListResultIterator.NextWithContext")
693		defer func() {
694			sc := -1
695			if iter.Response().Response.Response != nil {
696				sc = iter.Response().Response.Response.StatusCode
697			}
698			tracing.EndSpan(ctx, sc, err)
699		}()
700	}
701	iter.i++
702	if iter.i < len(iter.page.Values()) {
703		return nil
704	}
705	err = iter.page.NextWithContext(ctx)
706	if err != nil {
707		iter.i--
708		return err
709	}
710	iter.i = 0
711	return nil
712}
713
714// Next advances to the next value.  If there was an error making
715// the request the iterator does not advance and the error is returned.
716// Deprecated: Use NextWithContext() instead.
717func (iter *ConsumerGroupListResultIterator) Next() error {
718	return iter.NextWithContext(context.Background())
719}
720
721// NotDone returns true if the enumeration should be started or is not yet complete.
722func (iter ConsumerGroupListResultIterator) NotDone() bool {
723	return iter.page.NotDone() && iter.i < len(iter.page.Values())
724}
725
726// Response returns the raw server response from the last page request.
727func (iter ConsumerGroupListResultIterator) Response() ConsumerGroupListResult {
728	return iter.page.Response()
729}
730
731// Value returns the current value or a zero-initialized value if the
732// iterator has advanced beyond the end of the collection.
733func (iter ConsumerGroupListResultIterator) Value() ConsumerGroup {
734	if !iter.page.NotDone() {
735		return ConsumerGroup{}
736	}
737	return iter.page.Values()[iter.i]
738}
739
740// Creates a new instance of the ConsumerGroupListResultIterator type.
741func NewConsumerGroupListResultIterator(page ConsumerGroupListResultPage) ConsumerGroupListResultIterator {
742	return ConsumerGroupListResultIterator{page: page}
743}
744
745// IsEmpty returns true if the ListResult contains no values.
746func (cglr ConsumerGroupListResult) IsEmpty() bool {
747	return cglr.Value == nil || len(*cglr.Value) == 0
748}
749
750// hasNextLink returns true if the NextLink is not empty.
751func (cglr ConsumerGroupListResult) hasNextLink() bool {
752	return cglr.NextLink != nil && len(*cglr.NextLink) != 0
753}
754
755// consumerGroupListResultPreparer prepares a request to retrieve the next set of results.
756// It returns nil if no more results exist.
757func (cglr ConsumerGroupListResult) consumerGroupListResultPreparer(ctx context.Context) (*http.Request, error) {
758	if !cglr.hasNextLink() {
759		return nil, nil
760	}
761	return autorest.Prepare((&http.Request{}).WithContext(ctx),
762		autorest.AsJSON(),
763		autorest.AsGet(),
764		autorest.WithBaseURL(to.String(cglr.NextLink)))
765}
766
767// ConsumerGroupListResultPage contains a page of ConsumerGroup values.
768type ConsumerGroupListResultPage struct {
769	fn   func(context.Context, ConsumerGroupListResult) (ConsumerGroupListResult, error)
770	cglr ConsumerGroupListResult
771}
772
773// NextWithContext advances to the next page of values.  If there was an error making
774// the request the page does not advance and the error is returned.
775func (page *ConsumerGroupListResultPage) NextWithContext(ctx context.Context) (err error) {
776	if tracing.IsEnabled() {
777		ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerGroupListResultPage.NextWithContext")
778		defer func() {
779			sc := -1
780			if page.Response().Response.Response != nil {
781				sc = page.Response().Response.Response.StatusCode
782			}
783			tracing.EndSpan(ctx, sc, err)
784		}()
785	}
786	for {
787		next, err := page.fn(ctx, page.cglr)
788		if err != nil {
789			return err
790		}
791		page.cglr = next
792		if !next.hasNextLink() || !next.IsEmpty() {
793			break
794		}
795	}
796	return nil
797}
798
799// Next advances to the next page of values.  If there was an error making
800// the request the page does not advance and the error is returned.
801// Deprecated: Use NextWithContext() instead.
802func (page *ConsumerGroupListResultPage) Next() error {
803	return page.NextWithContext(context.Background())
804}
805
806// NotDone returns true if the page enumeration should be started or is not yet complete.
807func (page ConsumerGroupListResultPage) NotDone() bool {
808	return !page.cglr.IsEmpty()
809}
810
811// Response returns the raw server response from the last page request.
812func (page ConsumerGroupListResultPage) Response() ConsumerGroupListResult {
813	return page.cglr
814}
815
816// Values returns the slice of values for the current page or nil if there are no values.
817func (page ConsumerGroupListResultPage) Values() []ConsumerGroup {
818	if page.cglr.IsEmpty() {
819		return nil
820	}
821	return *page.cglr.Value
822}
823
824// Creates a new instance of the ConsumerGroupListResultPage type.
825func NewConsumerGroupListResultPage(cur ConsumerGroupListResult, getNextPage func(context.Context, ConsumerGroupListResult) (ConsumerGroupListResult, error)) ConsumerGroupListResultPage {
826	return ConsumerGroupListResultPage{
827		fn:   getNextPage,
828		cglr: cur,
829	}
830}
831
832// ConsumerGroupProperties single item in List or Get Consumer group operation
833type ConsumerGroupProperties struct {
834	// CreatedAt - READ-ONLY; Exact time the message was created.
835	CreatedAt *date.Time `json:"createdAt,omitempty"`
836	// UpdatedAt - READ-ONLY; The exact time the message was updated.
837	UpdatedAt *date.Time `json:"updatedAt,omitempty"`
838	// UserMetadata - User Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored.
839	UserMetadata *string `json:"userMetadata,omitempty"`
840}
841
842// MarshalJSON is the custom marshaler for ConsumerGroupProperties.
843func (cg ConsumerGroupProperties) MarshalJSON() ([]byte, error) {
844	objectMap := make(map[string]interface{})
845	if cg.UserMetadata != nil {
846		objectMap["userMetadata"] = cg.UserMetadata
847	}
848	return json.Marshal(objectMap)
849}
850
851// Destination capture storage details for capture description
852type Destination struct {
853	// Name - Name for capture destination
854	Name *string `json:"name,omitempty"`
855	// DestinationProperties - Properties describing the storage account, blob container and archive name format for capture destination
856	*DestinationProperties `json:"properties,omitempty"`
857}
858
859// MarshalJSON is the custom marshaler for Destination.
860func (d Destination) MarshalJSON() ([]byte, error) {
861	objectMap := make(map[string]interface{})
862	if d.Name != nil {
863		objectMap["name"] = d.Name
864	}
865	if d.DestinationProperties != nil {
866		objectMap["properties"] = d.DestinationProperties
867	}
868	return json.Marshal(objectMap)
869}
870
871// UnmarshalJSON is the custom unmarshaler for Destination struct.
872func (d *Destination) UnmarshalJSON(body []byte) error {
873	var m map[string]*json.RawMessage
874	err := json.Unmarshal(body, &m)
875	if err != nil {
876		return err
877	}
878	for k, v := range m {
879		switch k {
880		case "name":
881			if v != nil {
882				var name string
883				err = json.Unmarshal(*v, &name)
884				if err != nil {
885					return err
886				}
887				d.Name = &name
888			}
889		case "properties":
890			if v != nil {
891				var destinationProperties DestinationProperties
892				err = json.Unmarshal(*v, &destinationProperties)
893				if err != nil {
894					return err
895				}
896				d.DestinationProperties = &destinationProperties
897			}
898		}
899	}
900
901	return nil
902}
903
904// DestinationProperties properties describing the storage account, blob container and archive name format
905// for capture destination
906type DestinationProperties struct {
907	// StorageAccountResourceID - Resource id of the storage account to be used to create the blobs
908	StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"`
909	// BlobContainer - Blob container Name
910	BlobContainer *string `json:"blobContainer,omitempty"`
911	// ArchiveNameFormat - Blob naming convention for archive, e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order
912	ArchiveNameFormat *string `json:"archiveNameFormat,omitempty"`
913}
914
915// EHNamespace single Namespace item in List or Get Operation
916type EHNamespace struct {
917	autorest.Response `json:"-"`
918	// Sku - Properties of sku resource
919	Sku *Sku `json:"sku,omitempty"`
920	// EHNamespaceProperties - Namespace properties supplied for create namespace operation.
921	*EHNamespaceProperties `json:"properties,omitempty"`
922	// Location - Resource location.
923	Location *string `json:"location,omitempty"`
924	// Tags - Resource tags.
925	Tags map[string]*string `json:"tags"`
926	// ID - READ-ONLY; Resource ID.
927	ID *string `json:"id,omitempty"`
928	// Name - READ-ONLY; Resource name.
929	Name *string `json:"name,omitempty"`
930	// Type - READ-ONLY; Resource type.
931	Type *string `json:"type,omitempty"`
932}
933
934// MarshalJSON is the custom marshaler for EHNamespace.
935func (en EHNamespace) MarshalJSON() ([]byte, error) {
936	objectMap := make(map[string]interface{})
937	if en.Sku != nil {
938		objectMap["sku"] = en.Sku
939	}
940	if en.EHNamespaceProperties != nil {
941		objectMap["properties"] = en.EHNamespaceProperties
942	}
943	if en.Location != nil {
944		objectMap["location"] = en.Location
945	}
946	if en.Tags != nil {
947		objectMap["tags"] = en.Tags
948	}
949	return json.Marshal(objectMap)
950}
951
952// UnmarshalJSON is the custom unmarshaler for EHNamespace struct.
953func (en *EHNamespace) UnmarshalJSON(body []byte) error {
954	var m map[string]*json.RawMessage
955	err := json.Unmarshal(body, &m)
956	if err != nil {
957		return err
958	}
959	for k, v := range m {
960		switch k {
961		case "sku":
962			if v != nil {
963				var sku Sku
964				err = json.Unmarshal(*v, &sku)
965				if err != nil {
966					return err
967				}
968				en.Sku = &sku
969			}
970		case "properties":
971			if v != nil {
972				var eHNamespaceProperties EHNamespaceProperties
973				err = json.Unmarshal(*v, &eHNamespaceProperties)
974				if err != nil {
975					return err
976				}
977				en.EHNamespaceProperties = &eHNamespaceProperties
978			}
979		case "location":
980			if v != nil {
981				var location string
982				err = json.Unmarshal(*v, &location)
983				if err != nil {
984					return err
985				}
986				en.Location = &location
987			}
988		case "tags":
989			if v != nil {
990				var tags map[string]*string
991				err = json.Unmarshal(*v, &tags)
992				if err != nil {
993					return err
994				}
995				en.Tags = tags
996			}
997		case "id":
998			if v != nil {
999				var ID string
1000				err = json.Unmarshal(*v, &ID)
1001				if err != nil {
1002					return err
1003				}
1004				en.ID = &ID
1005			}
1006		case "name":
1007			if v != nil {
1008				var name string
1009				err = json.Unmarshal(*v, &name)
1010				if err != nil {
1011					return err
1012				}
1013				en.Name = &name
1014			}
1015		case "type":
1016			if v != nil {
1017				var typeVar string
1018				err = json.Unmarshal(*v, &typeVar)
1019				if err != nil {
1020					return err
1021				}
1022				en.Type = &typeVar
1023			}
1024		}
1025	}
1026
1027	return nil
1028}
1029
1030// EHNamespaceListResult the response of the List Namespace operation
1031type EHNamespaceListResult struct {
1032	autorest.Response `json:"-"`
1033	// Value - Result of the List Namespace operation
1034	Value *[]EHNamespace `json:"value,omitempty"`
1035	// NextLink - Link to the next set of results. Not empty if Value contains incomplete list of namespaces.
1036	NextLink *string `json:"nextLink,omitempty"`
1037}
1038
1039// EHNamespaceListResultIterator provides access to a complete listing of EHNamespace values.
1040type EHNamespaceListResultIterator struct {
1041	i    int
1042	page EHNamespaceListResultPage
1043}
1044
1045// NextWithContext advances to the next value.  If there was an error making
1046// the request the iterator does not advance and the error is returned.
1047func (iter *EHNamespaceListResultIterator) NextWithContext(ctx context.Context) (err error) {
1048	if tracing.IsEnabled() {
1049		ctx = tracing.StartSpan(ctx, fqdn+"/EHNamespaceListResultIterator.NextWithContext")
1050		defer func() {
1051			sc := -1
1052			if iter.Response().Response.Response != nil {
1053				sc = iter.Response().Response.Response.StatusCode
1054			}
1055			tracing.EndSpan(ctx, sc, err)
1056		}()
1057	}
1058	iter.i++
1059	if iter.i < len(iter.page.Values()) {
1060		return nil
1061	}
1062	err = iter.page.NextWithContext(ctx)
1063	if err != nil {
1064		iter.i--
1065		return err
1066	}
1067	iter.i = 0
1068	return nil
1069}
1070
1071// Next advances to the next value.  If there was an error making
1072// the request the iterator does not advance and the error is returned.
1073// Deprecated: Use NextWithContext() instead.
1074func (iter *EHNamespaceListResultIterator) Next() error {
1075	return iter.NextWithContext(context.Background())
1076}
1077
1078// NotDone returns true if the enumeration should be started or is not yet complete.
1079func (iter EHNamespaceListResultIterator) NotDone() bool {
1080	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1081}
1082
1083// Response returns the raw server response from the last page request.
1084func (iter EHNamespaceListResultIterator) Response() EHNamespaceListResult {
1085	return iter.page.Response()
1086}
1087
1088// Value returns the current value or a zero-initialized value if the
1089// iterator has advanced beyond the end of the collection.
1090func (iter EHNamespaceListResultIterator) Value() EHNamespace {
1091	if !iter.page.NotDone() {
1092		return EHNamespace{}
1093	}
1094	return iter.page.Values()[iter.i]
1095}
1096
1097// Creates a new instance of the EHNamespaceListResultIterator type.
1098func NewEHNamespaceListResultIterator(page EHNamespaceListResultPage) EHNamespaceListResultIterator {
1099	return EHNamespaceListResultIterator{page: page}
1100}
1101
1102// IsEmpty returns true if the ListResult contains no values.
1103func (enlr EHNamespaceListResult) IsEmpty() bool {
1104	return enlr.Value == nil || len(*enlr.Value) == 0
1105}
1106
1107// hasNextLink returns true if the NextLink is not empty.
1108func (enlr EHNamespaceListResult) hasNextLink() bool {
1109	return enlr.NextLink != nil && len(*enlr.NextLink) != 0
1110}
1111
1112// eHNamespaceListResultPreparer prepares a request to retrieve the next set of results.
1113// It returns nil if no more results exist.
1114func (enlr EHNamespaceListResult) eHNamespaceListResultPreparer(ctx context.Context) (*http.Request, error) {
1115	if !enlr.hasNextLink() {
1116		return nil, nil
1117	}
1118	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1119		autorest.AsJSON(),
1120		autorest.AsGet(),
1121		autorest.WithBaseURL(to.String(enlr.NextLink)))
1122}
1123
1124// EHNamespaceListResultPage contains a page of EHNamespace values.
1125type EHNamespaceListResultPage struct {
1126	fn   func(context.Context, EHNamespaceListResult) (EHNamespaceListResult, error)
1127	enlr EHNamespaceListResult
1128}
1129
1130// NextWithContext advances to the next page of values.  If there was an error making
1131// the request the page does not advance and the error is returned.
1132func (page *EHNamespaceListResultPage) NextWithContext(ctx context.Context) (err error) {
1133	if tracing.IsEnabled() {
1134		ctx = tracing.StartSpan(ctx, fqdn+"/EHNamespaceListResultPage.NextWithContext")
1135		defer func() {
1136			sc := -1
1137			if page.Response().Response.Response != nil {
1138				sc = page.Response().Response.Response.StatusCode
1139			}
1140			tracing.EndSpan(ctx, sc, err)
1141		}()
1142	}
1143	for {
1144		next, err := page.fn(ctx, page.enlr)
1145		if err != nil {
1146			return err
1147		}
1148		page.enlr = next
1149		if !next.hasNextLink() || !next.IsEmpty() {
1150			break
1151		}
1152	}
1153	return nil
1154}
1155
1156// Next advances to the next page of values.  If there was an error making
1157// the request the page does not advance and the error is returned.
1158// Deprecated: Use NextWithContext() instead.
1159func (page *EHNamespaceListResultPage) Next() error {
1160	return page.NextWithContext(context.Background())
1161}
1162
1163// NotDone returns true if the page enumeration should be started or is not yet complete.
1164func (page EHNamespaceListResultPage) NotDone() bool {
1165	return !page.enlr.IsEmpty()
1166}
1167
1168// Response returns the raw server response from the last page request.
1169func (page EHNamespaceListResultPage) Response() EHNamespaceListResult {
1170	return page.enlr
1171}
1172
1173// Values returns the slice of values for the current page or nil if there are no values.
1174func (page EHNamespaceListResultPage) Values() []EHNamespace {
1175	if page.enlr.IsEmpty() {
1176		return nil
1177	}
1178	return *page.enlr.Value
1179}
1180
1181// Creates a new instance of the EHNamespaceListResultPage type.
1182func NewEHNamespaceListResultPage(cur EHNamespaceListResult, getNextPage func(context.Context, EHNamespaceListResult) (EHNamespaceListResult, error)) EHNamespaceListResultPage {
1183	return EHNamespaceListResultPage{
1184		fn:   getNextPage,
1185		enlr: cur,
1186	}
1187}
1188
1189// EHNamespaceProperties namespace properties supplied for create namespace operation.
1190type EHNamespaceProperties struct {
1191	// ProvisioningState - READ-ONLY; Provisioning state of the Namespace.
1192	ProvisioningState *string `json:"provisioningState,omitempty"`
1193	// CreatedAt - READ-ONLY; The time the Namespace was created.
1194	CreatedAt *date.Time `json:"createdAt,omitempty"`
1195	// UpdatedAt - READ-ONLY; The time the Namespace was updated.
1196	UpdatedAt *date.Time `json:"updatedAt,omitempty"`
1197	// ServiceBusEndpoint - READ-ONLY; Endpoint you can use to perform Service Bus operations.
1198	ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"`
1199	// MetricID - READ-ONLY; Identifier for Azure Insights metrics.
1200	MetricID *string `json:"metricId,omitempty"`
1201	// IsAutoInflateEnabled - Value that indicates whether AutoInflate is enabled for eventhub namespace.
1202	IsAutoInflateEnabled *bool `json:"isAutoInflateEnabled,omitempty"`
1203	// MaximumThroughputUnits - Upper limit of throughput units when AutoInflate is enabled, value should be within 0 to 20 throughput units. ( '0' if AutoInflateEnabled = true)
1204	MaximumThroughputUnits *int32 `json:"maximumThroughputUnits,omitempty"`
1205	// KafkaEnabled - Value that indicates whether Kafka is enabled for eventhub namespace.
1206	KafkaEnabled *bool `json:"kafkaEnabled,omitempty"`
1207}
1208
1209// MarshalJSON is the custom marshaler for EHNamespaceProperties.
1210func (en EHNamespaceProperties) MarshalJSON() ([]byte, error) {
1211	objectMap := make(map[string]interface{})
1212	if en.IsAutoInflateEnabled != nil {
1213		objectMap["isAutoInflateEnabled"] = en.IsAutoInflateEnabled
1214	}
1215	if en.MaximumThroughputUnits != nil {
1216		objectMap["maximumThroughputUnits"] = en.MaximumThroughputUnits
1217	}
1218	if en.KafkaEnabled != nil {
1219		objectMap["kafkaEnabled"] = en.KafkaEnabled
1220	}
1221	return json.Marshal(objectMap)
1222}
1223
1224// ErrorResponse error response indicates Event Hub service is not able to process the incoming request.
1225// The reason is provided in the error message.
1226type ErrorResponse struct {
1227	// Code - Error code.
1228	Code *string `json:"code,omitempty"`
1229	// Message - Error message indicating why the operation failed.
1230	Message *string `json:"message,omitempty"`
1231}
1232
1233// ListResult the result of the List EventHubs operation.
1234type ListResult struct {
1235	autorest.Response `json:"-"`
1236	// Value - Result of the List EventHubs operation.
1237	Value *[]Model `json:"value,omitempty"`
1238	// NextLink - Link to the next set of results. Not empty if Value contains incomplete list of EventHubs.
1239	NextLink *string `json:"nextLink,omitempty"`
1240}
1241
1242// ListResultIterator provides access to a complete listing of Model values.
1243type ListResultIterator struct {
1244	i    int
1245	page ListResultPage
1246}
1247
1248// NextWithContext advances to the next value.  If there was an error making
1249// the request the iterator does not advance and the error is returned.
1250func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {
1251	if tracing.IsEnabled() {
1252		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext")
1253		defer func() {
1254			sc := -1
1255			if iter.Response().Response.Response != nil {
1256				sc = iter.Response().Response.Response.StatusCode
1257			}
1258			tracing.EndSpan(ctx, sc, err)
1259		}()
1260	}
1261	iter.i++
1262	if iter.i < len(iter.page.Values()) {
1263		return nil
1264	}
1265	err = iter.page.NextWithContext(ctx)
1266	if err != nil {
1267		iter.i--
1268		return err
1269	}
1270	iter.i = 0
1271	return nil
1272}
1273
1274// Next advances to the next value.  If there was an error making
1275// the request the iterator does not advance and the error is returned.
1276// Deprecated: Use NextWithContext() instead.
1277func (iter *ListResultIterator) Next() error {
1278	return iter.NextWithContext(context.Background())
1279}
1280
1281// NotDone returns true if the enumeration should be started or is not yet complete.
1282func (iter ListResultIterator) NotDone() bool {
1283	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1284}
1285
1286// Response returns the raw server response from the last page request.
1287func (iter ListResultIterator) Response() ListResult {
1288	return iter.page.Response()
1289}
1290
1291// Value returns the current value or a zero-initialized value if the
1292// iterator has advanced beyond the end of the collection.
1293func (iter ListResultIterator) Value() Model {
1294	if !iter.page.NotDone() {
1295		return Model{}
1296	}
1297	return iter.page.Values()[iter.i]
1298}
1299
1300// Creates a new instance of the ListResultIterator type.
1301func NewListResultIterator(page ListResultPage) ListResultIterator {
1302	return ListResultIterator{page: page}
1303}
1304
1305// IsEmpty returns true if the ListResult contains no values.
1306func (lr ListResult) IsEmpty() bool {
1307	return lr.Value == nil || len(*lr.Value) == 0
1308}
1309
1310// hasNextLink returns true if the NextLink is not empty.
1311func (lr ListResult) hasNextLink() bool {
1312	return lr.NextLink != nil && len(*lr.NextLink) != 0
1313}
1314
1315// listResultPreparer prepares a request to retrieve the next set of results.
1316// It returns nil if no more results exist.
1317func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {
1318	if !lr.hasNextLink() {
1319		return nil, nil
1320	}
1321	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1322		autorest.AsJSON(),
1323		autorest.AsGet(),
1324		autorest.WithBaseURL(to.String(lr.NextLink)))
1325}
1326
1327// ListResultPage contains a page of Model values.
1328type ListResultPage struct {
1329	fn func(context.Context, ListResult) (ListResult, error)
1330	lr ListResult
1331}
1332
1333// NextWithContext advances to the next page of values.  If there was an error making
1334// the request the page does not advance and the error is returned.
1335func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {
1336	if tracing.IsEnabled() {
1337		ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext")
1338		defer func() {
1339			sc := -1
1340			if page.Response().Response.Response != nil {
1341				sc = page.Response().Response.Response.StatusCode
1342			}
1343			tracing.EndSpan(ctx, sc, err)
1344		}()
1345	}
1346	for {
1347		next, err := page.fn(ctx, page.lr)
1348		if err != nil {
1349			return err
1350		}
1351		page.lr = next
1352		if !next.hasNextLink() || !next.IsEmpty() {
1353			break
1354		}
1355	}
1356	return nil
1357}
1358
1359// Next advances to the next page of values.  If there was an error making
1360// the request the page does not advance and the error is returned.
1361// Deprecated: Use NextWithContext() instead.
1362func (page *ListResultPage) Next() error {
1363	return page.NextWithContext(context.Background())
1364}
1365
1366// NotDone returns true if the page enumeration should be started or is not yet complete.
1367func (page ListResultPage) NotDone() bool {
1368	return !page.lr.IsEmpty()
1369}
1370
1371// Response returns the raw server response from the last page request.
1372func (page ListResultPage) Response() ListResult {
1373	return page.lr
1374}
1375
1376// Values returns the slice of values for the current page or nil if there are no values.
1377func (page ListResultPage) Values() []Model {
1378	if page.lr.IsEmpty() {
1379		return nil
1380	}
1381	return *page.lr.Value
1382}
1383
1384// Creates a new instance of the ListResultPage type.
1385func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {
1386	return ListResultPage{
1387		fn: getNextPage,
1388		lr: cur,
1389	}
1390}
1391
1392// MessagingPlan messaging Plan for the namespace
1393type MessagingPlan struct {
1394	autorest.Response        `json:"-"`
1395	*MessagingPlanProperties `json:"properties,omitempty"`
1396	// Location - Resource location.
1397	Location *string `json:"location,omitempty"`
1398	// Tags - Resource tags.
1399	Tags map[string]*string `json:"tags"`
1400	// ID - READ-ONLY; Resource ID.
1401	ID *string `json:"id,omitempty"`
1402	// Name - READ-ONLY; Resource name.
1403	Name *string `json:"name,omitempty"`
1404	// Type - READ-ONLY; Resource type.
1405	Type *string `json:"type,omitempty"`
1406}
1407
1408// MarshalJSON is the custom marshaler for MessagingPlan.
1409func (mp MessagingPlan) MarshalJSON() ([]byte, error) {
1410	objectMap := make(map[string]interface{})
1411	if mp.MessagingPlanProperties != nil {
1412		objectMap["properties"] = mp.MessagingPlanProperties
1413	}
1414	if mp.Location != nil {
1415		objectMap["location"] = mp.Location
1416	}
1417	if mp.Tags != nil {
1418		objectMap["tags"] = mp.Tags
1419	}
1420	return json.Marshal(objectMap)
1421}
1422
1423// UnmarshalJSON is the custom unmarshaler for MessagingPlan struct.
1424func (mp *MessagingPlan) UnmarshalJSON(body []byte) error {
1425	var m map[string]*json.RawMessage
1426	err := json.Unmarshal(body, &m)
1427	if err != nil {
1428		return err
1429	}
1430	for k, v := range m {
1431		switch k {
1432		case "properties":
1433			if v != nil {
1434				var messagingPlanProperties MessagingPlanProperties
1435				err = json.Unmarshal(*v, &messagingPlanProperties)
1436				if err != nil {
1437					return err
1438				}
1439				mp.MessagingPlanProperties = &messagingPlanProperties
1440			}
1441		case "location":
1442			if v != nil {
1443				var location string
1444				err = json.Unmarshal(*v, &location)
1445				if err != nil {
1446					return err
1447				}
1448				mp.Location = &location
1449			}
1450		case "tags":
1451			if v != nil {
1452				var tags map[string]*string
1453				err = json.Unmarshal(*v, &tags)
1454				if err != nil {
1455					return err
1456				}
1457				mp.Tags = tags
1458			}
1459		case "id":
1460			if v != nil {
1461				var ID string
1462				err = json.Unmarshal(*v, &ID)
1463				if err != nil {
1464					return err
1465				}
1466				mp.ID = &ID
1467			}
1468		case "name":
1469			if v != nil {
1470				var name string
1471				err = json.Unmarshal(*v, &name)
1472				if err != nil {
1473					return err
1474				}
1475				mp.Name = &name
1476			}
1477		case "type":
1478			if v != nil {
1479				var typeVar string
1480				err = json.Unmarshal(*v, &typeVar)
1481				if err != nil {
1482					return err
1483				}
1484				mp.Type = &typeVar
1485			}
1486		}
1487	}
1488
1489	return nil
1490}
1491
1492// MessagingPlanProperties ...
1493type MessagingPlanProperties struct {
1494	// Sku - READ-ONLY; Sku type
1495	Sku *int32 `json:"sku,omitempty"`
1496	// SelectedEventHubUnit - READ-ONLY; Selected event hub unit
1497	SelectedEventHubUnit *int32 `json:"selectedEventHubUnit,omitempty"`
1498	// UpdatedAt - READ-ONLY; The exact time the messaging plan was updated.
1499	UpdatedAt *date.Time `json:"updatedAt,omitempty"`
1500	// Revision - READ-ONLY; revision number
1501	Revision *int64 `json:"revision,omitempty"`
1502}
1503
1504// MarshalJSON is the custom marshaler for MessagingPlanProperties.
1505func (mp MessagingPlanProperties) MarshalJSON() ([]byte, error) {
1506	objectMap := make(map[string]interface{})
1507	return json.Marshal(objectMap)
1508}
1509
1510// MessagingRegions messaging Region
1511type MessagingRegions struct {
1512	// Properties - Properties of Messaging Region
1513	Properties *MessagingRegionsProperties `json:"properties,omitempty"`
1514	// Location - Resource location.
1515	Location *string `json:"location,omitempty"`
1516	// Tags - Resource tags.
1517	Tags map[string]*string `json:"tags"`
1518	// ID - READ-ONLY; Resource ID.
1519	ID *string `json:"id,omitempty"`
1520	// Name - READ-ONLY; Resource name.
1521	Name *string `json:"name,omitempty"`
1522	// Type - READ-ONLY; Resource type.
1523	Type *string `json:"type,omitempty"`
1524}
1525
1526// MarshalJSON is the custom marshaler for MessagingRegions.
1527func (mr MessagingRegions) MarshalJSON() ([]byte, error) {
1528	objectMap := make(map[string]interface{})
1529	if mr.Properties != nil {
1530		objectMap["properties"] = mr.Properties
1531	}
1532	if mr.Location != nil {
1533		objectMap["location"] = mr.Location
1534	}
1535	if mr.Tags != nil {
1536		objectMap["tags"] = mr.Tags
1537	}
1538	return json.Marshal(objectMap)
1539}
1540
1541// MessagingRegionsListResult the response of the List MessagingRegions operation.
1542type MessagingRegionsListResult struct {
1543	autorest.Response `json:"-"`
1544	// Value - Result of the List MessagingRegions type.
1545	Value *[]MessagingRegions `json:"value,omitempty"`
1546	// NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of MessagingRegions.
1547	NextLink *string `json:"nextLink,omitempty"`
1548}
1549
1550// MarshalJSON is the custom marshaler for MessagingRegionsListResult.
1551func (mrlr MessagingRegionsListResult) MarshalJSON() ([]byte, error) {
1552	objectMap := make(map[string]interface{})
1553	if mrlr.Value != nil {
1554		objectMap["value"] = mrlr.Value
1555	}
1556	return json.Marshal(objectMap)
1557}
1558
1559// MessagingRegionsListResultIterator provides access to a complete listing of MessagingRegions values.
1560type MessagingRegionsListResultIterator struct {
1561	i    int
1562	page MessagingRegionsListResultPage
1563}
1564
1565// NextWithContext advances to the next value.  If there was an error making
1566// the request the iterator does not advance and the error is returned.
1567func (iter *MessagingRegionsListResultIterator) NextWithContext(ctx context.Context) (err error) {
1568	if tracing.IsEnabled() {
1569		ctx = tracing.StartSpan(ctx, fqdn+"/MessagingRegionsListResultIterator.NextWithContext")
1570		defer func() {
1571			sc := -1
1572			if iter.Response().Response.Response != nil {
1573				sc = iter.Response().Response.Response.StatusCode
1574			}
1575			tracing.EndSpan(ctx, sc, err)
1576		}()
1577	}
1578	iter.i++
1579	if iter.i < len(iter.page.Values()) {
1580		return nil
1581	}
1582	err = iter.page.NextWithContext(ctx)
1583	if err != nil {
1584		iter.i--
1585		return err
1586	}
1587	iter.i = 0
1588	return nil
1589}
1590
1591// Next advances to the next value.  If there was an error making
1592// the request the iterator does not advance and the error is returned.
1593// Deprecated: Use NextWithContext() instead.
1594func (iter *MessagingRegionsListResultIterator) Next() error {
1595	return iter.NextWithContext(context.Background())
1596}
1597
1598// NotDone returns true if the enumeration should be started or is not yet complete.
1599func (iter MessagingRegionsListResultIterator) NotDone() bool {
1600	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1601}
1602
1603// Response returns the raw server response from the last page request.
1604func (iter MessagingRegionsListResultIterator) Response() MessagingRegionsListResult {
1605	return iter.page.Response()
1606}
1607
1608// Value returns the current value or a zero-initialized value if the
1609// iterator has advanced beyond the end of the collection.
1610func (iter MessagingRegionsListResultIterator) Value() MessagingRegions {
1611	if !iter.page.NotDone() {
1612		return MessagingRegions{}
1613	}
1614	return iter.page.Values()[iter.i]
1615}
1616
1617// Creates a new instance of the MessagingRegionsListResultIterator type.
1618func NewMessagingRegionsListResultIterator(page MessagingRegionsListResultPage) MessagingRegionsListResultIterator {
1619	return MessagingRegionsListResultIterator{page: page}
1620}
1621
1622// IsEmpty returns true if the ListResult contains no values.
1623func (mrlr MessagingRegionsListResult) IsEmpty() bool {
1624	return mrlr.Value == nil || len(*mrlr.Value) == 0
1625}
1626
1627// hasNextLink returns true if the NextLink is not empty.
1628func (mrlr MessagingRegionsListResult) hasNextLink() bool {
1629	return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0
1630}
1631
1632// messagingRegionsListResultPreparer prepares a request to retrieve the next set of results.
1633// It returns nil if no more results exist.
1634func (mrlr MessagingRegionsListResult) messagingRegionsListResultPreparer(ctx context.Context) (*http.Request, error) {
1635	if !mrlr.hasNextLink() {
1636		return nil, nil
1637	}
1638	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1639		autorest.AsJSON(),
1640		autorest.AsGet(),
1641		autorest.WithBaseURL(to.String(mrlr.NextLink)))
1642}
1643
1644// MessagingRegionsListResultPage contains a page of MessagingRegions values.
1645type MessagingRegionsListResultPage struct {
1646	fn   func(context.Context, MessagingRegionsListResult) (MessagingRegionsListResult, error)
1647	mrlr MessagingRegionsListResult
1648}
1649
1650// NextWithContext advances to the next page of values.  If there was an error making
1651// the request the page does not advance and the error is returned.
1652func (page *MessagingRegionsListResultPage) NextWithContext(ctx context.Context) (err error) {
1653	if tracing.IsEnabled() {
1654		ctx = tracing.StartSpan(ctx, fqdn+"/MessagingRegionsListResultPage.NextWithContext")
1655		defer func() {
1656			sc := -1
1657			if page.Response().Response.Response != nil {
1658				sc = page.Response().Response.Response.StatusCode
1659			}
1660			tracing.EndSpan(ctx, sc, err)
1661		}()
1662	}
1663	for {
1664		next, err := page.fn(ctx, page.mrlr)
1665		if err != nil {
1666			return err
1667		}
1668		page.mrlr = next
1669		if !next.hasNextLink() || !next.IsEmpty() {
1670			break
1671		}
1672	}
1673	return nil
1674}
1675
1676// Next advances to the next page of values.  If there was an error making
1677// the request the page does not advance and the error is returned.
1678// Deprecated: Use NextWithContext() instead.
1679func (page *MessagingRegionsListResultPage) Next() error {
1680	return page.NextWithContext(context.Background())
1681}
1682
1683// NotDone returns true if the page enumeration should be started or is not yet complete.
1684func (page MessagingRegionsListResultPage) NotDone() bool {
1685	return !page.mrlr.IsEmpty()
1686}
1687
1688// Response returns the raw server response from the last page request.
1689func (page MessagingRegionsListResultPage) Response() MessagingRegionsListResult {
1690	return page.mrlr
1691}
1692
1693// Values returns the slice of values for the current page or nil if there are no values.
1694func (page MessagingRegionsListResultPage) Values() []MessagingRegions {
1695	if page.mrlr.IsEmpty() {
1696		return nil
1697	}
1698	return *page.mrlr.Value
1699}
1700
1701// Creates a new instance of the MessagingRegionsListResultPage type.
1702func NewMessagingRegionsListResultPage(cur MessagingRegionsListResult, getNextPage func(context.Context, MessagingRegionsListResult) (MessagingRegionsListResult, error)) MessagingRegionsListResultPage {
1703	return MessagingRegionsListResultPage{
1704		fn:   getNextPage,
1705		mrlr: cur,
1706	}
1707}
1708
1709// MessagingRegionsProperties properties of Messaging Region
1710type MessagingRegionsProperties struct {
1711	// Code - READ-ONLY; Region code
1712	Code *string `json:"code,omitempty"`
1713	// FullName - READ-ONLY; Full name of the region
1714	FullName *string `json:"fullName,omitempty"`
1715}
1716
1717// MarshalJSON is the custom marshaler for MessagingRegionsProperties.
1718func (mr MessagingRegionsProperties) MarshalJSON() ([]byte, error) {
1719	objectMap := make(map[string]interface{})
1720	return json.Marshal(objectMap)
1721}
1722
1723// Model single item in List or Get Event Hub operation
1724type Model struct {
1725	autorest.Response `json:"-"`
1726	// Properties - Properties supplied to the Create Or Update Event Hub operation.
1727	*Properties `json:"properties,omitempty"`
1728	// ID - READ-ONLY; Resource ID.
1729	ID *string `json:"id,omitempty"`
1730	// Name - READ-ONLY; Resource name.
1731	Name *string `json:"name,omitempty"`
1732	// Type - READ-ONLY; Resource type.
1733	Type *string `json:"type,omitempty"`
1734}
1735
1736// MarshalJSON is the custom marshaler for Model.
1737func (mVar Model) MarshalJSON() ([]byte, error) {
1738	objectMap := make(map[string]interface{})
1739	if mVar.Properties != nil {
1740		objectMap["properties"] = mVar.Properties
1741	}
1742	return json.Marshal(objectMap)
1743}
1744
1745// UnmarshalJSON is the custom unmarshaler for Model struct.
1746func (mVar *Model) UnmarshalJSON(body []byte) error {
1747	var m map[string]*json.RawMessage
1748	err := json.Unmarshal(body, &m)
1749	if err != nil {
1750		return err
1751	}
1752	for k, v := range m {
1753		switch k {
1754		case "properties":
1755			if v != nil {
1756				var properties Properties
1757				err = json.Unmarshal(*v, &properties)
1758				if err != nil {
1759					return err
1760				}
1761				mVar.Properties = &properties
1762			}
1763		case "id":
1764			if v != nil {
1765				var ID string
1766				err = json.Unmarshal(*v, &ID)
1767				if err != nil {
1768					return err
1769				}
1770				mVar.ID = &ID
1771			}
1772		case "name":
1773			if v != nil {
1774				var name string
1775				err = json.Unmarshal(*v, &name)
1776				if err != nil {
1777					return err
1778				}
1779				mVar.Name = &name
1780			}
1781		case "type":
1782			if v != nil {
1783				var typeVar string
1784				err = json.Unmarshal(*v, &typeVar)
1785				if err != nil {
1786					return err
1787				}
1788				mVar.Type = &typeVar
1789			}
1790		}
1791	}
1792
1793	return nil
1794}
1795
1796// NamespacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
1797// long-running operation.
1798type NamespacesCreateOrUpdateFuture struct {
1799	azure.FutureAPI
1800	// Result returns the result of the asynchronous operation.
1801	// If the operation has not completed it will return an error.
1802	Result func(NamespacesClient) (EHNamespace, error)
1803}
1804
1805// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1806func (future *NamespacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1807	var azFuture azure.Future
1808	if err := json.Unmarshal(body, &azFuture); err != nil {
1809		return err
1810	}
1811	future.FutureAPI = &azFuture
1812	future.Result = future.result
1813	return nil
1814}
1815
1816// result is the default implementation for NamespacesCreateOrUpdateFuture.Result.
1817func (future *NamespacesCreateOrUpdateFuture) result(client NamespacesClient) (en EHNamespace, err error) {
1818	var done bool
1819	done, err = future.DoneWithContext(context.Background(), client)
1820	if err != nil {
1821		err = autorest.NewErrorWithError(err, "eventhub.NamespacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1822		return
1823	}
1824	if !done {
1825		en.Response.Response = future.Response()
1826		err = azure.NewAsyncOpIncompleteError("eventhub.NamespacesCreateOrUpdateFuture")
1827		return
1828	}
1829	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1830	if en.Response.Response, err = future.GetResult(sender); err == nil && en.Response.Response.StatusCode != http.StatusNoContent {
1831		en, err = client.CreateOrUpdateResponder(en.Response.Response)
1832		if err != nil {
1833			err = autorest.NewErrorWithError(err, "eventhub.NamespacesCreateOrUpdateFuture", "Result", en.Response.Response, "Failure responding to request")
1834		}
1835	}
1836	return
1837}
1838
1839// NamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1840// operation.
1841type NamespacesDeleteFuture struct {
1842	azure.FutureAPI
1843	// Result returns the result of the asynchronous operation.
1844	// If the operation has not completed it will return an error.
1845	Result func(NamespacesClient) (autorest.Response, error)
1846}
1847
1848// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1849func (future *NamespacesDeleteFuture) UnmarshalJSON(body []byte) error {
1850	var azFuture azure.Future
1851	if err := json.Unmarshal(body, &azFuture); err != nil {
1852		return err
1853	}
1854	future.FutureAPI = &azFuture
1855	future.Result = future.result
1856	return nil
1857}
1858
1859// result is the default implementation for NamespacesDeleteFuture.Result.
1860func (future *NamespacesDeleteFuture) result(client NamespacesClient) (ar autorest.Response, err error) {
1861	var done bool
1862	done, err = future.DoneWithContext(context.Background(), client)
1863	if err != nil {
1864		err = autorest.NewErrorWithError(err, "eventhub.NamespacesDeleteFuture", "Result", future.Response(), "Polling failure")
1865		return
1866	}
1867	if !done {
1868		ar.Response = future.Response()
1869		err = azure.NewAsyncOpIncompleteError("eventhub.NamespacesDeleteFuture")
1870		return
1871	}
1872	ar.Response = future.Response()
1873	return
1874}
1875
1876// NetworkRuleSet description of NetworkRuleSet resource.
1877type NetworkRuleSet struct {
1878	autorest.Response `json:"-"`
1879	// NetworkRuleSetProperties - NetworkRuleSet properties
1880	*NetworkRuleSetProperties `json:"properties,omitempty"`
1881	// ID - READ-ONLY; Resource ID.
1882	ID *string `json:"id,omitempty"`
1883	// Name - READ-ONLY; Resource name.
1884	Name *string `json:"name,omitempty"`
1885	// Type - READ-ONLY; Resource type.
1886	Type *string `json:"type,omitempty"`
1887}
1888
1889// MarshalJSON is the custom marshaler for NetworkRuleSet.
1890func (nrs NetworkRuleSet) MarshalJSON() ([]byte, error) {
1891	objectMap := make(map[string]interface{})
1892	if nrs.NetworkRuleSetProperties != nil {
1893		objectMap["properties"] = nrs.NetworkRuleSetProperties
1894	}
1895	return json.Marshal(objectMap)
1896}
1897
1898// UnmarshalJSON is the custom unmarshaler for NetworkRuleSet struct.
1899func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error {
1900	var m map[string]*json.RawMessage
1901	err := json.Unmarshal(body, &m)
1902	if err != nil {
1903		return err
1904	}
1905	for k, v := range m {
1906		switch k {
1907		case "properties":
1908			if v != nil {
1909				var networkRuleSetProperties NetworkRuleSetProperties
1910				err = json.Unmarshal(*v, &networkRuleSetProperties)
1911				if err != nil {
1912					return err
1913				}
1914				nrs.NetworkRuleSetProperties = &networkRuleSetProperties
1915			}
1916		case "id":
1917			if v != nil {
1918				var ID string
1919				err = json.Unmarshal(*v, &ID)
1920				if err != nil {
1921					return err
1922				}
1923				nrs.ID = &ID
1924			}
1925		case "name":
1926			if v != nil {
1927				var name string
1928				err = json.Unmarshal(*v, &name)
1929				if err != nil {
1930					return err
1931				}
1932				nrs.Name = &name
1933			}
1934		case "type":
1935			if v != nil {
1936				var typeVar string
1937				err = json.Unmarshal(*v, &typeVar)
1938				if err != nil {
1939					return err
1940				}
1941				nrs.Type = &typeVar
1942			}
1943		}
1944	}
1945
1946	return nil
1947}
1948
1949// NetworkRuleSetListResult the response of the List NetworkRuleSet operation
1950type NetworkRuleSetListResult struct {
1951	autorest.Response `json:"-"`
1952	// Value - Result of the List NetworkRuleSet operation.
1953	Value *[]NetworkRuleSet `json:"value,omitempty"`
1954	// NextLink - Link to the next set of results. Not empty if Value contains incomplete list of NetworkRuleSet.
1955	NextLink *string `json:"nextLink,omitempty"`
1956}
1957
1958// NetworkRuleSetListResultIterator provides access to a complete listing of NetworkRuleSet values.
1959type NetworkRuleSetListResultIterator struct {
1960	i    int
1961	page NetworkRuleSetListResultPage
1962}
1963
1964// NextWithContext advances to the next value.  If there was an error making
1965// the request the iterator does not advance and the error is returned.
1966func (iter *NetworkRuleSetListResultIterator) NextWithContext(ctx context.Context) (err error) {
1967	if tracing.IsEnabled() {
1968		ctx = tracing.StartSpan(ctx, fqdn+"/NetworkRuleSetListResultIterator.NextWithContext")
1969		defer func() {
1970			sc := -1
1971			if iter.Response().Response.Response != nil {
1972				sc = iter.Response().Response.Response.StatusCode
1973			}
1974			tracing.EndSpan(ctx, sc, err)
1975		}()
1976	}
1977	iter.i++
1978	if iter.i < len(iter.page.Values()) {
1979		return nil
1980	}
1981	err = iter.page.NextWithContext(ctx)
1982	if err != nil {
1983		iter.i--
1984		return err
1985	}
1986	iter.i = 0
1987	return nil
1988}
1989
1990// Next advances to the next value.  If there was an error making
1991// the request the iterator does not advance and the error is returned.
1992// Deprecated: Use NextWithContext() instead.
1993func (iter *NetworkRuleSetListResultIterator) Next() error {
1994	return iter.NextWithContext(context.Background())
1995}
1996
1997// NotDone returns true if the enumeration should be started or is not yet complete.
1998func (iter NetworkRuleSetListResultIterator) NotDone() bool {
1999	return iter.page.NotDone() && iter.i < len(iter.page.Values())
2000}
2001
2002// Response returns the raw server response from the last page request.
2003func (iter NetworkRuleSetListResultIterator) Response() NetworkRuleSetListResult {
2004	return iter.page.Response()
2005}
2006
2007// Value returns the current value or a zero-initialized value if the
2008// iterator has advanced beyond the end of the collection.
2009func (iter NetworkRuleSetListResultIterator) Value() NetworkRuleSet {
2010	if !iter.page.NotDone() {
2011		return NetworkRuleSet{}
2012	}
2013	return iter.page.Values()[iter.i]
2014}
2015
2016// Creates a new instance of the NetworkRuleSetListResultIterator type.
2017func NewNetworkRuleSetListResultIterator(page NetworkRuleSetListResultPage) NetworkRuleSetListResultIterator {
2018	return NetworkRuleSetListResultIterator{page: page}
2019}
2020
2021// IsEmpty returns true if the ListResult contains no values.
2022func (nrslr NetworkRuleSetListResult) IsEmpty() bool {
2023	return nrslr.Value == nil || len(*nrslr.Value) == 0
2024}
2025
2026// hasNextLink returns true if the NextLink is not empty.
2027func (nrslr NetworkRuleSetListResult) hasNextLink() bool {
2028	return nrslr.NextLink != nil && len(*nrslr.NextLink) != 0
2029}
2030
2031// networkRuleSetListResultPreparer prepares a request to retrieve the next set of results.
2032// It returns nil if no more results exist.
2033func (nrslr NetworkRuleSetListResult) networkRuleSetListResultPreparer(ctx context.Context) (*http.Request, error) {
2034	if !nrslr.hasNextLink() {
2035		return nil, nil
2036	}
2037	return autorest.Prepare((&http.Request{}).WithContext(ctx),
2038		autorest.AsJSON(),
2039		autorest.AsGet(),
2040		autorest.WithBaseURL(to.String(nrslr.NextLink)))
2041}
2042
2043// NetworkRuleSetListResultPage contains a page of NetworkRuleSet values.
2044type NetworkRuleSetListResultPage struct {
2045	fn    func(context.Context, NetworkRuleSetListResult) (NetworkRuleSetListResult, error)
2046	nrslr NetworkRuleSetListResult
2047}
2048
2049// NextWithContext advances to the next page of values.  If there was an error making
2050// the request the page does not advance and the error is returned.
2051func (page *NetworkRuleSetListResultPage) NextWithContext(ctx context.Context) (err error) {
2052	if tracing.IsEnabled() {
2053		ctx = tracing.StartSpan(ctx, fqdn+"/NetworkRuleSetListResultPage.NextWithContext")
2054		defer func() {
2055			sc := -1
2056			if page.Response().Response.Response != nil {
2057				sc = page.Response().Response.Response.StatusCode
2058			}
2059			tracing.EndSpan(ctx, sc, err)
2060		}()
2061	}
2062	for {
2063		next, err := page.fn(ctx, page.nrslr)
2064		if err != nil {
2065			return err
2066		}
2067		page.nrslr = next
2068		if !next.hasNextLink() || !next.IsEmpty() {
2069			break
2070		}
2071	}
2072	return nil
2073}
2074
2075// Next advances to the next page of values.  If there was an error making
2076// the request the page does not advance and the error is returned.
2077// Deprecated: Use NextWithContext() instead.
2078func (page *NetworkRuleSetListResultPage) Next() error {
2079	return page.NextWithContext(context.Background())
2080}
2081
2082// NotDone returns true if the page enumeration should be started or is not yet complete.
2083func (page NetworkRuleSetListResultPage) NotDone() bool {
2084	return !page.nrslr.IsEmpty()
2085}
2086
2087// Response returns the raw server response from the last page request.
2088func (page NetworkRuleSetListResultPage) Response() NetworkRuleSetListResult {
2089	return page.nrslr
2090}
2091
2092// Values returns the slice of values for the current page or nil if there are no values.
2093func (page NetworkRuleSetListResultPage) Values() []NetworkRuleSet {
2094	if page.nrslr.IsEmpty() {
2095		return nil
2096	}
2097	return *page.nrslr.Value
2098}
2099
2100// Creates a new instance of the NetworkRuleSetListResultPage type.
2101func NewNetworkRuleSetListResultPage(cur NetworkRuleSetListResult, getNextPage func(context.Context, NetworkRuleSetListResult) (NetworkRuleSetListResult, error)) NetworkRuleSetListResultPage {
2102	return NetworkRuleSetListResultPage{
2103		fn:    getNextPage,
2104		nrslr: cur,
2105	}
2106}
2107
2108// NetworkRuleSetProperties networkRuleSet properties
2109type NetworkRuleSetProperties struct {
2110	// DefaultAction - Default Action for Network Rule Set. Possible values include: 'Allow', 'Deny'
2111	DefaultAction DefaultAction `json:"defaultAction,omitempty"`
2112	// VirtualNetworkRules - List VirtualNetwork Rules
2113	VirtualNetworkRules *[]NWRuleSetVirtualNetworkRules `json:"virtualNetworkRules,omitempty"`
2114	// IPRules - List of IpRules
2115	IPRules *[]NWRuleSetIPRules `json:"ipRules,omitempty"`
2116}
2117
2118// NWRuleSetIPRules description of NetWorkRuleSet - IpRules resource.
2119type NWRuleSetIPRules struct {
2120	// IPMask - IP Mask
2121	IPMask *string `json:"ipMask,omitempty"`
2122	// Action - The IP Filter Action. Possible values include: 'NetworkRuleIPActionAllow'
2123	Action NetworkRuleIPAction `json:"action,omitempty"`
2124}
2125
2126// NWRuleSetVirtualNetworkRules description of VirtualNetworkRules - NetworkRules resource.
2127type NWRuleSetVirtualNetworkRules struct {
2128	// Subnet - Subnet properties
2129	Subnet *Subnet `json:"subnet,omitempty"`
2130	// IgnoreMissingVnetServiceEndpoint - Value that indicates whether to ignore missing VNet Service Endpoint
2131	IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"`
2132}
2133
2134// Operation a Event Hub REST API operation
2135type Operation struct {
2136	// Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}
2137	Name *string `json:"name,omitempty"`
2138	// Display - The object that represents the operation.
2139	Display *OperationDisplay `json:"display,omitempty"`
2140}
2141
2142// MarshalJSON is the custom marshaler for Operation.
2143func (o Operation) MarshalJSON() ([]byte, error) {
2144	objectMap := make(map[string]interface{})
2145	if o.Display != nil {
2146		objectMap["display"] = o.Display
2147	}
2148	return json.Marshal(objectMap)
2149}
2150
2151// OperationDisplay the object that represents the operation.
2152type OperationDisplay struct {
2153	// Provider - READ-ONLY; Service provider: Microsoft.EventHub
2154	Provider *string `json:"provider,omitempty"`
2155	// Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc.
2156	Resource *string `json:"resource,omitempty"`
2157	// Operation - READ-ONLY; Operation type: Read, write, delete, etc.
2158	Operation *string `json:"operation,omitempty"`
2159}
2160
2161// MarshalJSON is the custom marshaler for OperationDisplay.
2162func (o OperationDisplay) MarshalJSON() ([]byte, error) {
2163	objectMap := make(map[string]interface{})
2164	return json.Marshal(objectMap)
2165}
2166
2167// OperationListResult result of the request to list Event Hub operations. It contains a list of operations
2168// and a URL link to get the next set of results.
2169type OperationListResult struct {
2170	autorest.Response `json:"-"`
2171	// Value - READ-ONLY; List of Event Hub operations supported by the Microsoft.EventHub resource provider.
2172	Value *[]Operation `json:"value,omitempty"`
2173	// NextLink - READ-ONLY; URL to get the next set of operation list results if there are any.
2174	NextLink *string `json:"nextLink,omitempty"`
2175}
2176
2177// MarshalJSON is the custom marshaler for OperationListResult.
2178func (olr OperationListResult) MarshalJSON() ([]byte, error) {
2179	objectMap := make(map[string]interface{})
2180	return json.Marshal(objectMap)
2181}
2182
2183// OperationListResultIterator provides access to a complete listing of Operation values.
2184type OperationListResultIterator struct {
2185	i    int
2186	page OperationListResultPage
2187}
2188
2189// NextWithContext advances to the next value.  If there was an error making
2190// the request the iterator does not advance and the error is returned.
2191func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
2192	if tracing.IsEnabled() {
2193		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
2194		defer func() {
2195			sc := -1
2196			if iter.Response().Response.Response != nil {
2197				sc = iter.Response().Response.Response.StatusCode
2198			}
2199			tracing.EndSpan(ctx, sc, err)
2200		}()
2201	}
2202	iter.i++
2203	if iter.i < len(iter.page.Values()) {
2204		return nil
2205	}
2206	err = iter.page.NextWithContext(ctx)
2207	if err != nil {
2208		iter.i--
2209		return err
2210	}
2211	iter.i = 0
2212	return nil
2213}
2214
2215// Next advances to the next value.  If there was an error making
2216// the request the iterator does not advance and the error is returned.
2217// Deprecated: Use NextWithContext() instead.
2218func (iter *OperationListResultIterator) Next() error {
2219	return iter.NextWithContext(context.Background())
2220}
2221
2222// NotDone returns true if the enumeration should be started or is not yet complete.
2223func (iter OperationListResultIterator) NotDone() bool {
2224	return iter.page.NotDone() && iter.i < len(iter.page.Values())
2225}
2226
2227// Response returns the raw server response from the last page request.
2228func (iter OperationListResultIterator) Response() OperationListResult {
2229	return iter.page.Response()
2230}
2231
2232// Value returns the current value or a zero-initialized value if the
2233// iterator has advanced beyond the end of the collection.
2234func (iter OperationListResultIterator) Value() Operation {
2235	if !iter.page.NotDone() {
2236		return Operation{}
2237	}
2238	return iter.page.Values()[iter.i]
2239}
2240
2241// Creates a new instance of the OperationListResultIterator type.
2242func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
2243	return OperationListResultIterator{page: page}
2244}
2245
2246// IsEmpty returns true if the ListResult contains no values.
2247func (olr OperationListResult) IsEmpty() bool {
2248	return olr.Value == nil || len(*olr.Value) == 0
2249}
2250
2251// hasNextLink returns true if the NextLink is not empty.
2252func (olr OperationListResult) hasNextLink() bool {
2253	return olr.NextLink != nil && len(*olr.NextLink) != 0
2254}
2255
2256// operationListResultPreparer prepares a request to retrieve the next set of results.
2257// It returns nil if no more results exist.
2258func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
2259	if !olr.hasNextLink() {
2260		return nil, nil
2261	}
2262	return autorest.Prepare((&http.Request{}).WithContext(ctx),
2263		autorest.AsJSON(),
2264		autorest.AsGet(),
2265		autorest.WithBaseURL(to.String(olr.NextLink)))
2266}
2267
2268// OperationListResultPage contains a page of Operation values.
2269type OperationListResultPage struct {
2270	fn  func(context.Context, OperationListResult) (OperationListResult, error)
2271	olr OperationListResult
2272}
2273
2274// NextWithContext advances to the next page of values.  If there was an error making
2275// the request the page does not advance and the error is returned.
2276func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
2277	if tracing.IsEnabled() {
2278		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
2279		defer func() {
2280			sc := -1
2281			if page.Response().Response.Response != nil {
2282				sc = page.Response().Response.Response.StatusCode
2283			}
2284			tracing.EndSpan(ctx, sc, err)
2285		}()
2286	}
2287	for {
2288		next, err := page.fn(ctx, page.olr)
2289		if err != nil {
2290			return err
2291		}
2292		page.olr = next
2293		if !next.hasNextLink() || !next.IsEmpty() {
2294			break
2295		}
2296	}
2297	return nil
2298}
2299
2300// Next advances to the next page of values.  If there was an error making
2301// the request the page does not advance and the error is returned.
2302// Deprecated: Use NextWithContext() instead.
2303func (page *OperationListResultPage) Next() error {
2304	return page.NextWithContext(context.Background())
2305}
2306
2307// NotDone returns true if the page enumeration should be started or is not yet complete.
2308func (page OperationListResultPage) NotDone() bool {
2309	return !page.olr.IsEmpty()
2310}
2311
2312// Response returns the raw server response from the last page request.
2313func (page OperationListResultPage) Response() OperationListResult {
2314	return page.olr
2315}
2316
2317// Values returns the slice of values for the current page or nil if there are no values.
2318func (page OperationListResultPage) Values() []Operation {
2319	if page.olr.IsEmpty() {
2320		return nil
2321	}
2322	return *page.olr.Value
2323}
2324
2325// Creates a new instance of the OperationListResultPage type.
2326func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
2327	return OperationListResultPage{
2328		fn:  getNextPage,
2329		olr: cur,
2330	}
2331}
2332
2333// Properties properties supplied to the Create Or Update Event Hub operation.
2334type Properties struct {
2335	// PartitionIds - READ-ONLY; Current number of shards on the Event Hub.
2336	PartitionIds *[]string `json:"partitionIds,omitempty"`
2337	// CreatedAt - READ-ONLY; Exact time the Event Hub was created.
2338	CreatedAt *date.Time `json:"createdAt,omitempty"`
2339	// UpdatedAt - READ-ONLY; The exact time the message was updated.
2340	UpdatedAt *date.Time `json:"updatedAt,omitempty"`
2341	// MessageRetentionInDays - Number of days to retain the events for this Event Hub, value should be 1 to 7 days
2342	MessageRetentionInDays *int64 `json:"messageRetentionInDays,omitempty"`
2343	// PartitionCount - Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions.
2344	PartitionCount *int64 `json:"partitionCount,omitempty"`
2345	// Status - Enumerates the possible values for the status of the Event Hub. Possible values include: 'Active', 'Disabled', 'Restoring', 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', 'Unknown'
2346	Status EntityStatus `json:"status,omitempty"`
2347	// CaptureDescription - Properties of capture description
2348	CaptureDescription *CaptureDescription `json:"captureDescription,omitempty"`
2349}
2350
2351// MarshalJSON is the custom marshaler for Properties.
2352func (p Properties) MarshalJSON() ([]byte, error) {
2353	objectMap := make(map[string]interface{})
2354	if p.MessageRetentionInDays != nil {
2355		objectMap["messageRetentionInDays"] = p.MessageRetentionInDays
2356	}
2357	if p.PartitionCount != nil {
2358		objectMap["partitionCount"] = p.PartitionCount
2359	}
2360	if p.Status != "" {
2361		objectMap["status"] = p.Status
2362	}
2363	if p.CaptureDescription != nil {
2364		objectMap["captureDescription"] = p.CaptureDescription
2365	}
2366	return json.Marshal(objectMap)
2367}
2368
2369// RegenerateAccessKeyParameters parameters supplied to the Regenerate Authorization Rule operation,
2370// specifies which key needs to be reset.
2371type RegenerateAccessKeyParameters struct {
2372	// KeyType - The access key to regenerate. Possible values include: 'PrimaryKey', 'SecondaryKey'
2373	KeyType KeyType `json:"keyType,omitempty"`
2374	// Key - Optional, if the key value provided, is set for KeyType or autogenerated Key value set for keyType
2375	Key *string `json:"key,omitempty"`
2376}
2377
2378// Resource the resource definition.
2379type Resource struct {
2380	// ID - READ-ONLY; Resource ID.
2381	ID *string `json:"id,omitempty"`
2382	// Name - READ-ONLY; Resource name.
2383	Name *string `json:"name,omitempty"`
2384	// Type - READ-ONLY; Resource type.
2385	Type *string `json:"type,omitempty"`
2386}
2387
2388// MarshalJSON is the custom marshaler for Resource.
2389func (r Resource) MarshalJSON() ([]byte, error) {
2390	objectMap := make(map[string]interface{})
2391	return json.Marshal(objectMap)
2392}
2393
2394// Sku SKU parameters supplied to the create namespace operation
2395type Sku struct {
2396	// Name - Name of this SKU. Possible values include: 'Basic', 'Standard'
2397	Name SkuName `json:"name,omitempty"`
2398	// Tier - The billing tier of this particular SKU. Possible values include: 'SkuTierBasic', 'SkuTierStandard'
2399	Tier SkuTier `json:"tier,omitempty"`
2400	// Capacity - The Event Hubs throughput units, value should be 0 to 20 throughput units.
2401	Capacity *int32 `json:"capacity,omitempty"`
2402}
2403
2404// Subnet properties supplied for Subnet
2405type Subnet struct {
2406	// ID - Resource ID of Virtual Network Subnet
2407	ID *string `json:"id,omitempty"`
2408}
2409
2410// TrackedResource definition of resource.
2411type TrackedResource struct {
2412	// Location - Resource location.
2413	Location *string `json:"location,omitempty"`
2414	// Tags - Resource tags.
2415	Tags map[string]*string `json:"tags"`
2416	// ID - READ-ONLY; Resource ID.
2417	ID *string `json:"id,omitempty"`
2418	// Name - READ-ONLY; Resource name.
2419	Name *string `json:"name,omitempty"`
2420	// Type - READ-ONLY; Resource type.
2421	Type *string `json:"type,omitempty"`
2422}
2423
2424// MarshalJSON is the custom marshaler for TrackedResource.
2425func (tr TrackedResource) MarshalJSON() ([]byte, error) {
2426	objectMap := make(map[string]interface{})
2427	if tr.Location != nil {
2428		objectMap["location"] = tr.Location
2429	}
2430	if tr.Tags != nil {
2431		objectMap["tags"] = tr.Tags
2432	}
2433	return json.Marshal(objectMap)
2434}
2435