1package kusto
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/to"
15	"github.com/Azure/go-autorest/tracing"
16	"net/http"
17)
18
19// The package's fully qualified name.
20const fqdn = "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-01-21/kusto"
21
22// AzureCapacity azure capacity definition.
23type AzureCapacity struct {
24	// ScaleType - Scale type. Possible values include: 'Automatic', 'Manual', 'None'
25	ScaleType AzureScaleType `json:"scaleType,omitempty"`
26	// Minimum - Minimum allowed instances count.
27	Minimum *int32 `json:"minimum,omitempty"`
28	// Maximum - Maximum allowed instances count.
29	Maximum *int32 `json:"maximum,omitempty"`
30	// Default - The default capacity that would be used.
31	Default *int32 `json:"default,omitempty"`
32}
33
34// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag.
35type AzureEntityResource struct {
36	// Etag - READ-ONLY; Resource Etag.
37	Etag *string `json:"etag,omitempty"`
38	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
39	ID *string `json:"id,omitempty"`
40	// Name - READ-ONLY; The name of the resource
41	Name *string `json:"name,omitempty"`
42	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
43	Type *string `json:"type,omitempty"`
44}
45
46// MarshalJSON is the custom marshaler for AzureEntityResource.
47func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
48	objectMap := make(map[string]interface{})
49	return json.Marshal(objectMap)
50}
51
52// AzureResourceSku azure resource SKU definition.
53type AzureResourceSku struct {
54	// ResourceType - Resource Namespace and Type.
55	ResourceType *string `json:"resourceType,omitempty"`
56	// Sku - The SKU details.
57	Sku *AzureSku `json:"sku,omitempty"`
58	// Capacity - The number of instances of the cluster.
59	Capacity *AzureCapacity `json:"capacity,omitempty"`
60}
61
62// AzureSku azure SKU definition.
63type AzureSku struct {
64	// Name - SKU name. Possible values include: 'StandardDS13V21TBPS', 'StandardDS13V22TBPS', 'StandardDS14V23TBPS', 'StandardDS14V24TBPS', 'StandardD13V2', 'StandardD14V2', 'StandardL8s', 'StandardL16s', 'StandardD11V2', 'StandardD12V2', 'StandardL4s', 'DevNoSLAStandardD11V2'
65	Name AzureSkuName `json:"name,omitempty"`
66	// Capacity - The number of instances of the cluster.
67	Capacity *int32 `json:"capacity,omitempty"`
68	// Tier - SKU tier. Possible values include: 'Basic', 'Standard'
69	Tier AzureSkuTier `json:"tier,omitempty"`
70}
71
72// CheckNameResult the result returned from a check name availability request.
73type CheckNameResult struct {
74	autorest.Response `json:"-"`
75	// NameAvailable - Specifies a Boolean value that indicates if the name is available.
76	NameAvailable *bool `json:"nameAvailable,omitempty"`
77	// Name - The name that was checked.
78	Name *string `json:"name,omitempty"`
79	// Message - Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated.
80	Message *string `json:"message,omitempty"`
81	// Reason - Message providing the reason why the given name is invalid. Possible values include: 'Invalid', 'AlreadyExists'
82	Reason Reason `json:"reason,omitempty"`
83}
84
85// CloudError an error response from Kusto.
86type CloudError struct {
87	// Error - An error response from Kusto.
88	Error *CloudErrorBody `json:"error,omitempty"`
89}
90
91// CloudErrorBody an error response from Kusto.
92type CloudErrorBody struct {
93	// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
94	Code *string `json:"code,omitempty"`
95	// Message - A message describing the error, intended to be suitable for displaying in a user interface.
96	Message *string `json:"message,omitempty"`
97	// Target - The target of the particular error. For example, the name of the property in error.
98	Target *string `json:"target,omitempty"`
99	// Details - A list of additional details about the error.
100	Details *[]CloudErrorBody `json:"details,omitempty"`
101}
102
103// Cluster class representing a Kusto cluster.
104type Cluster struct {
105	autorest.Response `json:"-"`
106	// Sku - The SKU of the cluster.
107	Sku *AzureSku `json:"sku,omitempty"`
108	// ClusterProperties - The cluster properties.
109	*ClusterProperties `json:"properties,omitempty"`
110	// Tags - Resource tags.
111	Tags map[string]*string `json:"tags"`
112	// Location - The geo-location where the resource lives
113	Location *string `json:"location,omitempty"`
114	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
115	ID *string `json:"id,omitempty"`
116	// Name - READ-ONLY; The name of the resource
117	Name *string `json:"name,omitempty"`
118	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
119	Type *string `json:"type,omitempty"`
120}
121
122// MarshalJSON is the custom marshaler for Cluster.
123func (c Cluster) MarshalJSON() ([]byte, error) {
124	objectMap := make(map[string]interface{})
125	if c.Sku != nil {
126		objectMap["sku"] = c.Sku
127	}
128	if c.ClusterProperties != nil {
129		objectMap["properties"] = c.ClusterProperties
130	}
131	if c.Tags != nil {
132		objectMap["tags"] = c.Tags
133	}
134	if c.Location != nil {
135		objectMap["location"] = c.Location
136	}
137	return json.Marshal(objectMap)
138}
139
140// UnmarshalJSON is the custom unmarshaler for Cluster struct.
141func (c *Cluster) UnmarshalJSON(body []byte) error {
142	var m map[string]*json.RawMessage
143	err := json.Unmarshal(body, &m)
144	if err != nil {
145		return err
146	}
147	for k, v := range m {
148		switch k {
149		case "sku":
150			if v != nil {
151				var sku AzureSku
152				err = json.Unmarshal(*v, &sku)
153				if err != nil {
154					return err
155				}
156				c.Sku = &sku
157			}
158		case "properties":
159			if v != nil {
160				var clusterProperties ClusterProperties
161				err = json.Unmarshal(*v, &clusterProperties)
162				if err != nil {
163					return err
164				}
165				c.ClusterProperties = &clusterProperties
166			}
167		case "tags":
168			if v != nil {
169				var tags map[string]*string
170				err = json.Unmarshal(*v, &tags)
171				if err != nil {
172					return err
173				}
174				c.Tags = tags
175			}
176		case "location":
177			if v != nil {
178				var location string
179				err = json.Unmarshal(*v, &location)
180				if err != nil {
181					return err
182				}
183				c.Location = &location
184			}
185		case "id":
186			if v != nil {
187				var ID string
188				err = json.Unmarshal(*v, &ID)
189				if err != nil {
190					return err
191				}
192				c.ID = &ID
193			}
194		case "name":
195			if v != nil {
196				var name string
197				err = json.Unmarshal(*v, &name)
198				if err != nil {
199					return err
200				}
201				c.Name = &name
202			}
203		case "type":
204			if v != nil {
205				var typeVar string
206				err = json.Unmarshal(*v, &typeVar)
207				if err != nil {
208					return err
209				}
210				c.Type = &typeVar
211			}
212		}
213	}
214
215	return nil
216}
217
218// ClusterCheckNameRequest the result returned from a cluster check name availability request.
219type ClusterCheckNameRequest struct {
220	// Name - Cluster name.
221	Name *string `json:"name,omitempty"`
222	// Type - The type of resource, Microsoft.Kusto/clusters.
223	Type *string `json:"type,omitempty"`
224}
225
226// ClusterListResult the list Kusto clusters operation response.
227type ClusterListResult struct {
228	autorest.Response `json:"-"`
229	// Value - The list of Kusto clusters.
230	Value *[]Cluster `json:"value,omitempty"`
231}
232
233// ClusterProperties class representing the Kusto cluster properties.
234type ClusterProperties struct {
235	// State - READ-ONLY; The state of the resource. Possible values include: 'StateCreating', 'StateUnavailable', 'StateRunning', 'StateDeleting', 'StateDeleted', 'StateStopping', 'StateStopped', 'StateStarting', 'StateUpdating'
236	State State `json:"state,omitempty"`
237	// ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed'
238	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
239	// URI - READ-ONLY; The cluster URI.
240	URI *string `json:"uri,omitempty"`
241	// DataIngestionURI - READ-ONLY; The cluster data ingestion URI.
242	DataIngestionURI *string `json:"dataIngestionUri,omitempty"`
243	// TrustedExternalTenants - The cluster's external tenants.
244	TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"`
245}
246
247// MarshalJSON is the custom marshaler for ClusterProperties.
248func (cp ClusterProperties) MarshalJSON() ([]byte, error) {
249	objectMap := make(map[string]interface{})
250	if cp.TrustedExternalTenants != nil {
251		objectMap["trustedExternalTenants"] = cp.TrustedExternalTenants
252	}
253	return json.Marshal(objectMap)
254}
255
256// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
257// operation.
258type ClustersCreateOrUpdateFuture struct {
259	azure.FutureAPI
260	// Result returns the result of the asynchronous operation.
261	// If the operation has not completed it will return an error.
262	Result func(ClustersClient) (Cluster, error)
263}
264
265// UnmarshalJSON is the custom unmarshaller for CreateFuture.
266func (future *ClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
267	var azFuture azure.Future
268	if err := json.Unmarshal(body, &azFuture); err != nil {
269		return err
270	}
271	future.FutureAPI = &azFuture
272	future.Result = future.result
273	return nil
274}
275
276// result is the default implementation for ClustersCreateOrUpdateFuture.Result.
277func (future *ClustersCreateOrUpdateFuture) result(client ClustersClient) (c Cluster, err error) {
278	var done bool
279	done, err = future.DoneWithContext(context.Background(), client)
280	if err != nil {
281		err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
282		return
283	}
284	if !done {
285		c.Response.Response = future.Response()
286		err = azure.NewAsyncOpIncompleteError("kusto.ClustersCreateOrUpdateFuture")
287		return
288	}
289	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
290	if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
291		c, err = client.CreateOrUpdateResponder(c.Response.Response)
292		if err != nil {
293			err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request")
294		}
295	}
296	return
297}
298
299// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
300// operation.
301type ClustersDeleteFuture struct {
302	azure.FutureAPI
303	// Result returns the result of the asynchronous operation.
304	// If the operation has not completed it will return an error.
305	Result func(ClustersClient) (autorest.Response, error)
306}
307
308// UnmarshalJSON is the custom unmarshaller for CreateFuture.
309func (future *ClustersDeleteFuture) UnmarshalJSON(body []byte) error {
310	var azFuture azure.Future
311	if err := json.Unmarshal(body, &azFuture); err != nil {
312		return err
313	}
314	future.FutureAPI = &azFuture
315	future.Result = future.result
316	return nil
317}
318
319// result is the default implementation for ClustersDeleteFuture.Result.
320func (future *ClustersDeleteFuture) result(client ClustersClient) (ar autorest.Response, err error) {
321	var done bool
322	done, err = future.DoneWithContext(context.Background(), client)
323	if err != nil {
324		err = autorest.NewErrorWithError(err, "kusto.ClustersDeleteFuture", "Result", future.Response(), "Polling failure")
325		return
326	}
327	if !done {
328		ar.Response = future.Response()
329		err = azure.NewAsyncOpIncompleteError("kusto.ClustersDeleteFuture")
330		return
331	}
332	ar.Response = future.Response()
333	return
334}
335
336// ClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running
337// operation.
338type ClustersStartFuture struct {
339	azure.FutureAPI
340	// Result returns the result of the asynchronous operation.
341	// If the operation has not completed it will return an error.
342	Result func(ClustersClient) (autorest.Response, error)
343}
344
345// UnmarshalJSON is the custom unmarshaller for CreateFuture.
346func (future *ClustersStartFuture) UnmarshalJSON(body []byte) error {
347	var azFuture azure.Future
348	if err := json.Unmarshal(body, &azFuture); err != nil {
349		return err
350	}
351	future.FutureAPI = &azFuture
352	future.Result = future.result
353	return nil
354}
355
356// result is the default implementation for ClustersStartFuture.Result.
357func (future *ClustersStartFuture) result(client ClustersClient) (ar autorest.Response, err error) {
358	var done bool
359	done, err = future.DoneWithContext(context.Background(), client)
360	if err != nil {
361		err = autorest.NewErrorWithError(err, "kusto.ClustersStartFuture", "Result", future.Response(), "Polling failure")
362		return
363	}
364	if !done {
365		ar.Response = future.Response()
366		err = azure.NewAsyncOpIncompleteError("kusto.ClustersStartFuture")
367		return
368	}
369	ar.Response = future.Response()
370	return
371}
372
373// ClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation.
374type ClustersStopFuture struct {
375	azure.FutureAPI
376	// Result returns the result of the asynchronous operation.
377	// If the operation has not completed it will return an error.
378	Result func(ClustersClient) (autorest.Response, error)
379}
380
381// UnmarshalJSON is the custom unmarshaller for CreateFuture.
382func (future *ClustersStopFuture) UnmarshalJSON(body []byte) error {
383	var azFuture azure.Future
384	if err := json.Unmarshal(body, &azFuture); err != nil {
385		return err
386	}
387	future.FutureAPI = &azFuture
388	future.Result = future.result
389	return nil
390}
391
392// result is the default implementation for ClustersStopFuture.Result.
393func (future *ClustersStopFuture) result(client ClustersClient) (ar autorest.Response, err error) {
394	var done bool
395	done, err = future.DoneWithContext(context.Background(), client)
396	if err != nil {
397		err = autorest.NewErrorWithError(err, "kusto.ClustersStopFuture", "Result", future.Response(), "Polling failure")
398		return
399	}
400	if !done {
401		ar.Response = future.Response()
402		err = azure.NewAsyncOpIncompleteError("kusto.ClustersStopFuture")
403		return
404	}
405	ar.Response = future.Response()
406	return
407}
408
409// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
410// operation.
411type ClustersUpdateFuture struct {
412	azure.FutureAPI
413	// Result returns the result of the asynchronous operation.
414	// If the operation has not completed it will return an error.
415	Result func(ClustersClient) (Cluster, error)
416}
417
418// UnmarshalJSON is the custom unmarshaller for CreateFuture.
419func (future *ClustersUpdateFuture) UnmarshalJSON(body []byte) error {
420	var azFuture azure.Future
421	if err := json.Unmarshal(body, &azFuture); err != nil {
422		return err
423	}
424	future.FutureAPI = &azFuture
425	future.Result = future.result
426	return nil
427}
428
429// result is the default implementation for ClustersUpdateFuture.Result.
430func (future *ClustersUpdateFuture) result(client ClustersClient) (c Cluster, err error) {
431	var done bool
432	done, err = future.DoneWithContext(context.Background(), client)
433	if err != nil {
434		err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", future.Response(), "Polling failure")
435		return
436	}
437	if !done {
438		c.Response.Response = future.Response()
439		err = azure.NewAsyncOpIncompleteError("kusto.ClustersUpdateFuture")
440		return
441	}
442	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
443	if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
444		c, err = client.UpdateResponder(c.Response.Response)
445		if err != nil {
446			err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request")
447		}
448	}
449	return
450}
451
452// ClusterUpdate class representing an update to a Kusto cluster.
453type ClusterUpdate struct {
454	// Tags - Resource tags.
455	Tags map[string]*string `json:"tags"`
456	// Location - Resource location.
457	Location *string `json:"location,omitempty"`
458	// Sku - The SKU of the cluster.
459	Sku *AzureSku `json:"sku,omitempty"`
460	// ClusterProperties - The cluster properties.
461	*ClusterProperties `json:"properties,omitempty"`
462	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
463	ID *string `json:"id,omitempty"`
464	// Name - READ-ONLY; The name of the resource
465	Name *string `json:"name,omitempty"`
466	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
467	Type *string `json:"type,omitempty"`
468}
469
470// MarshalJSON is the custom marshaler for ClusterUpdate.
471func (cu ClusterUpdate) MarshalJSON() ([]byte, error) {
472	objectMap := make(map[string]interface{})
473	if cu.Tags != nil {
474		objectMap["tags"] = cu.Tags
475	}
476	if cu.Location != nil {
477		objectMap["location"] = cu.Location
478	}
479	if cu.Sku != nil {
480		objectMap["sku"] = cu.Sku
481	}
482	if cu.ClusterProperties != nil {
483		objectMap["properties"] = cu.ClusterProperties
484	}
485	return json.Marshal(objectMap)
486}
487
488// UnmarshalJSON is the custom unmarshaler for ClusterUpdate struct.
489func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error {
490	var m map[string]*json.RawMessage
491	err := json.Unmarshal(body, &m)
492	if err != nil {
493		return err
494	}
495	for k, v := range m {
496		switch k {
497		case "tags":
498			if v != nil {
499				var tags map[string]*string
500				err = json.Unmarshal(*v, &tags)
501				if err != nil {
502					return err
503				}
504				cu.Tags = tags
505			}
506		case "location":
507			if v != nil {
508				var location string
509				err = json.Unmarshal(*v, &location)
510				if err != nil {
511					return err
512				}
513				cu.Location = &location
514			}
515		case "sku":
516			if v != nil {
517				var sku AzureSku
518				err = json.Unmarshal(*v, &sku)
519				if err != nil {
520					return err
521				}
522				cu.Sku = &sku
523			}
524		case "properties":
525			if v != nil {
526				var clusterProperties ClusterProperties
527				err = json.Unmarshal(*v, &clusterProperties)
528				if err != nil {
529					return err
530				}
531				cu.ClusterProperties = &clusterProperties
532			}
533		case "id":
534			if v != nil {
535				var ID string
536				err = json.Unmarshal(*v, &ID)
537				if err != nil {
538					return err
539				}
540				cu.ID = &ID
541			}
542		case "name":
543			if v != nil {
544				var name string
545				err = json.Unmarshal(*v, &name)
546				if err != nil {
547					return err
548				}
549				cu.Name = &name
550			}
551		case "type":
552			if v != nil {
553				var typeVar string
554				err = json.Unmarshal(*v, &typeVar)
555				if err != nil {
556					return err
557				}
558				cu.Type = &typeVar
559			}
560		}
561	}
562
563	return nil
564}
565
566// Database class representing a Kusto database.
567type Database struct {
568	autorest.Response `json:"-"`
569	// Location - Resource location.
570	Location *string `json:"location,omitempty"`
571	// DatabaseProperties - The database properties.
572	*DatabaseProperties `json:"properties,omitempty"`
573	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
574	ID *string `json:"id,omitempty"`
575	// Name - READ-ONLY; The name of the resource
576	Name *string `json:"name,omitempty"`
577	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
578	Type *string `json:"type,omitempty"`
579}
580
581// MarshalJSON is the custom marshaler for Database.
582func (d Database) MarshalJSON() ([]byte, error) {
583	objectMap := make(map[string]interface{})
584	if d.Location != nil {
585		objectMap["location"] = d.Location
586	}
587	if d.DatabaseProperties != nil {
588		objectMap["properties"] = d.DatabaseProperties
589	}
590	return json.Marshal(objectMap)
591}
592
593// UnmarshalJSON is the custom unmarshaler for Database struct.
594func (d *Database) UnmarshalJSON(body []byte) error {
595	var m map[string]*json.RawMessage
596	err := json.Unmarshal(body, &m)
597	if err != nil {
598		return err
599	}
600	for k, v := range m {
601		switch k {
602		case "location":
603			if v != nil {
604				var location string
605				err = json.Unmarshal(*v, &location)
606				if err != nil {
607					return err
608				}
609				d.Location = &location
610			}
611		case "properties":
612			if v != nil {
613				var databaseProperties DatabaseProperties
614				err = json.Unmarshal(*v, &databaseProperties)
615				if err != nil {
616					return err
617				}
618				d.DatabaseProperties = &databaseProperties
619			}
620		case "id":
621			if v != nil {
622				var ID string
623				err = json.Unmarshal(*v, &ID)
624				if err != nil {
625					return err
626				}
627				d.ID = &ID
628			}
629		case "name":
630			if v != nil {
631				var name string
632				err = json.Unmarshal(*v, &name)
633				if err != nil {
634					return err
635				}
636				d.Name = &name
637			}
638		case "type":
639			if v != nil {
640				var typeVar string
641				err = json.Unmarshal(*v, &typeVar)
642				if err != nil {
643					return err
644				}
645				d.Type = &typeVar
646			}
647		}
648	}
649
650	return nil
651}
652
653// DatabaseCheckNameRequest the result returned from a database check name availability request.
654type DatabaseCheckNameRequest struct {
655	// Name - Database name.
656	Name *string `json:"name,omitempty"`
657	// Type - The type of resource, Microsoft.Kusto/clusters/databases.
658	Type *string `json:"type,omitempty"`
659}
660
661// DatabaseListResult the list Kusto databases operation response.
662type DatabaseListResult struct {
663	autorest.Response `json:"-"`
664	// Value - The list of Kusto databases.
665	Value *[]Database `json:"value,omitempty"`
666}
667
668// DatabasePrincipal a class representing database principal entity.
669type DatabasePrincipal struct {
670	// Role - Database principal role. Possible values include: 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer'
671	Role DatabasePrincipalRole `json:"role,omitempty"`
672	// Name - Database principal name.
673	Name *string `json:"name,omitempty"`
674	// Type - Database principal type. Possible values include: 'DatabasePrincipalTypeApp', 'DatabasePrincipalTypeGroup', 'DatabasePrincipalTypeUser'
675	Type DatabasePrincipalType `json:"type,omitempty"`
676	// Fqn - Database principal fully qualified name.
677	Fqn *string `json:"fqn,omitempty"`
678	// Email - Database principal email if exists.
679	Email *string `json:"email,omitempty"`
680	// AppID - Application id - relevant only for application principal type.
681	AppID *string `json:"appId,omitempty"`
682}
683
684// DatabasePrincipalListRequest the list Kusto database principals operation request.
685type DatabasePrincipalListRequest struct {
686	// Value - The list of Kusto database principals.
687	Value *[]DatabasePrincipal `json:"value,omitempty"`
688}
689
690// DatabasePrincipalListResult the list Kusto database principals operation response.
691type DatabasePrincipalListResult struct {
692	autorest.Response `json:"-"`
693	// Value - The list of Kusto database principals.
694	Value *[]DatabasePrincipal `json:"value,omitempty"`
695}
696
697// DatabaseProperties class representing the Kusto database properties.
698type DatabaseProperties struct {
699	// ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed'
700	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
701	// SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan.
702	SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"`
703	// HotCachePeriod - The time the data that should be kept in cache for fast queries in TimeSpan.
704	HotCachePeriod *string `json:"hotCachePeriod,omitempty"`
705	// Statistics - The statistics of the database.
706	Statistics *DatabaseStatistics `json:"statistics,omitempty"`
707}
708
709// MarshalJSON is the custom marshaler for DatabaseProperties.
710func (dp DatabaseProperties) MarshalJSON() ([]byte, error) {
711	objectMap := make(map[string]interface{})
712	if dp.SoftDeletePeriod != nil {
713		objectMap["softDeletePeriod"] = dp.SoftDeletePeriod
714	}
715	if dp.HotCachePeriod != nil {
716		objectMap["hotCachePeriod"] = dp.HotCachePeriod
717	}
718	if dp.Statistics != nil {
719		objectMap["statistics"] = dp.Statistics
720	}
721	return json.Marshal(objectMap)
722}
723
724// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
725// operation.
726type DatabasesCreateOrUpdateFuture struct {
727	azure.FutureAPI
728	// Result returns the result of the asynchronous operation.
729	// If the operation has not completed it will return an error.
730	Result func(DatabasesClient) (Database, error)
731}
732
733// UnmarshalJSON is the custom unmarshaller for CreateFuture.
734func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
735	var azFuture azure.Future
736	if err := json.Unmarshal(body, &azFuture); err != nil {
737		return err
738	}
739	future.FutureAPI = &azFuture
740	future.Result = future.result
741	return nil
742}
743
744// result is the default implementation for DatabasesCreateOrUpdateFuture.Result.
745func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) {
746	var done bool
747	done, err = future.DoneWithContext(context.Background(), client)
748	if err != nil {
749		err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
750		return
751	}
752	if !done {
753		d.Response.Response = future.Response()
754		err = azure.NewAsyncOpIncompleteError("kusto.DatabasesCreateOrUpdateFuture")
755		return
756	}
757	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
758	if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
759		d, err = client.CreateOrUpdateResponder(d.Response.Response)
760		if err != nil {
761			err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request")
762		}
763	}
764	return
765}
766
767// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
768// operation.
769type DatabasesDeleteFuture struct {
770	azure.FutureAPI
771	// Result returns the result of the asynchronous operation.
772	// If the operation has not completed it will return an error.
773	Result func(DatabasesClient) (autorest.Response, error)
774}
775
776// UnmarshalJSON is the custom unmarshaller for CreateFuture.
777func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error {
778	var azFuture azure.Future
779	if err := json.Unmarshal(body, &azFuture); err != nil {
780		return err
781	}
782	future.FutureAPI = &azFuture
783	future.Result = future.result
784	return nil
785}
786
787// result is the default implementation for DatabasesDeleteFuture.Result.
788func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) {
789	var done bool
790	done, err = future.DoneWithContext(context.Background(), client)
791	if err != nil {
792		err = autorest.NewErrorWithError(err, "kusto.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure")
793		return
794	}
795	if !done {
796		ar.Response = future.Response()
797		err = azure.NewAsyncOpIncompleteError("kusto.DatabasesDeleteFuture")
798		return
799	}
800	ar.Response = future.Response()
801	return
802}
803
804// DatabaseStatistics a class that contains database statistics information.
805type DatabaseStatistics struct {
806	// Size - The database size - the total size of compressed data and index in bytes.
807	Size *float64 `json:"size,omitempty"`
808}
809
810// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
811// operation.
812type DatabasesUpdateFuture struct {
813	azure.FutureAPI
814	// Result returns the result of the asynchronous operation.
815	// If the operation has not completed it will return an error.
816	Result func(DatabasesClient) (Database, error)
817}
818
819// UnmarshalJSON is the custom unmarshaller for CreateFuture.
820func (future *DatabasesUpdateFuture) UnmarshalJSON(body []byte) error {
821	var azFuture azure.Future
822	if err := json.Unmarshal(body, &azFuture); err != nil {
823		return err
824	}
825	future.FutureAPI = &azFuture
826	future.Result = future.result
827	return nil
828}
829
830// result is the default implementation for DatabasesUpdateFuture.Result.
831func (future *DatabasesUpdateFuture) result(client DatabasesClient) (d Database, err error) {
832	var done bool
833	done, err = future.DoneWithContext(context.Background(), client)
834	if err != nil {
835		err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure")
836		return
837	}
838	if !done {
839		d.Response.Response = future.Response()
840		err = azure.NewAsyncOpIncompleteError("kusto.DatabasesUpdateFuture")
841		return
842	}
843	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
844	if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
845		d, err = client.UpdateResponder(d.Response.Response)
846		if err != nil {
847			err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request")
848		}
849	}
850	return
851}
852
853// DatabaseUpdate class representing an update to a Kusto database.
854type DatabaseUpdate struct {
855	// Location - Resource location.
856	Location *string `json:"location,omitempty"`
857	// DatabaseProperties - The properties of the updated database.
858	*DatabaseProperties `json:"properties,omitempty"`
859	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
860	ID *string `json:"id,omitempty"`
861	// Name - READ-ONLY; The name of the resource
862	Name *string `json:"name,omitempty"`
863	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
864	Type *string `json:"type,omitempty"`
865}
866
867// MarshalJSON is the custom marshaler for DatabaseUpdate.
868func (du DatabaseUpdate) MarshalJSON() ([]byte, error) {
869	objectMap := make(map[string]interface{})
870	if du.Location != nil {
871		objectMap["location"] = du.Location
872	}
873	if du.DatabaseProperties != nil {
874		objectMap["properties"] = du.DatabaseProperties
875	}
876	return json.Marshal(objectMap)
877}
878
879// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct.
880func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error {
881	var m map[string]*json.RawMessage
882	err := json.Unmarshal(body, &m)
883	if err != nil {
884		return err
885	}
886	for k, v := range m {
887		switch k {
888		case "location":
889			if v != nil {
890				var location string
891				err = json.Unmarshal(*v, &location)
892				if err != nil {
893					return err
894				}
895				du.Location = &location
896			}
897		case "properties":
898			if v != nil {
899				var databaseProperties DatabaseProperties
900				err = json.Unmarshal(*v, &databaseProperties)
901				if err != nil {
902					return err
903				}
904				du.DatabaseProperties = &databaseProperties
905			}
906		case "id":
907			if v != nil {
908				var ID string
909				err = json.Unmarshal(*v, &ID)
910				if err != nil {
911					return err
912				}
913				du.ID = &ID
914			}
915		case "name":
916			if v != nil {
917				var name string
918				err = json.Unmarshal(*v, &name)
919				if err != nil {
920					return err
921				}
922				du.Name = &name
923			}
924		case "type":
925			if v != nil {
926				var typeVar string
927				err = json.Unmarshal(*v, &typeVar)
928				if err != nil {
929					return err
930				}
931				du.Type = &typeVar
932			}
933		}
934	}
935
936	return nil
937}
938
939// BasicDataConnection class representing an data connection.
940type BasicDataConnection interface {
941	AsEventHubDataConnection() (*EventHubDataConnection, bool)
942	AsEventGridDataConnection() (*EventGridDataConnection, bool)
943	AsDataConnection() (*DataConnection, bool)
944}
945
946// DataConnection class representing an data connection.
947type DataConnection struct {
948	autorest.Response `json:"-"`
949	// Location - Resource location.
950	Location *string `json:"location,omitempty"`
951	// Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid'
952	Kind Kind `json:"kind,omitempty"`
953	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
954	ID *string `json:"id,omitempty"`
955	// Name - READ-ONLY; The name of the resource
956	Name *string `json:"name,omitempty"`
957	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
958	Type *string `json:"type,omitempty"`
959}
960
961func unmarshalBasicDataConnection(body []byte) (BasicDataConnection, error) {
962	var m map[string]interface{}
963	err := json.Unmarshal(body, &m)
964	if err != nil {
965		return nil, err
966	}
967
968	switch m["kind"] {
969	case string(KindEventHub):
970		var ehdc EventHubDataConnection
971		err := json.Unmarshal(body, &ehdc)
972		return ehdc, err
973	case string(KindEventGrid):
974		var egdc EventGridDataConnection
975		err := json.Unmarshal(body, &egdc)
976		return egdc, err
977	default:
978		var dc DataConnection
979		err := json.Unmarshal(body, &dc)
980		return dc, err
981	}
982}
983func unmarshalBasicDataConnectionArray(body []byte) ([]BasicDataConnection, error) {
984	var rawMessages []*json.RawMessage
985	err := json.Unmarshal(body, &rawMessages)
986	if err != nil {
987		return nil, err
988	}
989
990	dcArray := make([]BasicDataConnection, len(rawMessages))
991
992	for index, rawMessage := range rawMessages {
993		dc, err := unmarshalBasicDataConnection(*rawMessage)
994		if err != nil {
995			return nil, err
996		}
997		dcArray[index] = dc
998	}
999	return dcArray, nil
1000}
1001
1002// MarshalJSON is the custom marshaler for DataConnection.
1003func (dc DataConnection) MarshalJSON() ([]byte, error) {
1004	dc.Kind = KindDataConnection
1005	objectMap := make(map[string]interface{})
1006	if dc.Location != nil {
1007		objectMap["location"] = dc.Location
1008	}
1009	if dc.Kind != "" {
1010		objectMap["kind"] = dc.Kind
1011	}
1012	return json.Marshal(objectMap)
1013}
1014
1015// AsEventHubDataConnection is the BasicDataConnection implementation for DataConnection.
1016func (dc DataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) {
1017	return nil, false
1018}
1019
1020// AsEventGridDataConnection is the BasicDataConnection implementation for DataConnection.
1021func (dc DataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) {
1022	return nil, false
1023}
1024
1025// AsDataConnection is the BasicDataConnection implementation for DataConnection.
1026func (dc DataConnection) AsDataConnection() (*DataConnection, bool) {
1027	return &dc, true
1028}
1029
1030// AsBasicDataConnection is the BasicDataConnection implementation for DataConnection.
1031func (dc DataConnection) AsBasicDataConnection() (BasicDataConnection, bool) {
1032	return &dc, true
1033}
1034
1035// DataConnectionCheckNameRequest the result returned from a data connections check name availability
1036// request.
1037type DataConnectionCheckNameRequest struct {
1038	// Name - Data Connection name.
1039	Name *string `json:"name,omitempty"`
1040	// Type - The type of resource, Microsoft.Kusto/clusters/databases/dataConnections.
1041	Type *string `json:"type,omitempty"`
1042}
1043
1044// DataConnectionListResult the list Kusto data connections operation response.
1045type DataConnectionListResult struct {
1046	autorest.Response `json:"-"`
1047	// Value - The list of Kusto data connections.
1048	Value *[]BasicDataConnection `json:"value,omitempty"`
1049}
1050
1051// UnmarshalJSON is the custom unmarshaler for DataConnectionListResult struct.
1052func (dclr *DataConnectionListResult) UnmarshalJSON(body []byte) error {
1053	var m map[string]*json.RawMessage
1054	err := json.Unmarshal(body, &m)
1055	if err != nil {
1056		return err
1057	}
1058	for k, v := range m {
1059		switch k {
1060		case "value":
1061			if v != nil {
1062				value, err := unmarshalBasicDataConnectionArray(*v)
1063				if err != nil {
1064					return err
1065				}
1066				dclr.Value = &value
1067			}
1068		}
1069	}
1070
1071	return nil
1072}
1073
1074// DataConnectionModel ...
1075type DataConnectionModel struct {
1076	autorest.Response `json:"-"`
1077	Value             BasicDataConnection `json:"value,omitempty"`
1078}
1079
1080// UnmarshalJSON is the custom unmarshaler for DataConnectionModel struct.
1081func (dcm *DataConnectionModel) UnmarshalJSON(body []byte) error {
1082	dc, err := unmarshalBasicDataConnection(body)
1083	if err != nil {
1084		return err
1085	}
1086	dcm.Value = dc
1087
1088	return nil
1089}
1090
1091// DataConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
1092// long-running operation.
1093type DataConnectionsCreateOrUpdateFuture struct {
1094	azure.FutureAPI
1095	// Result returns the result of the asynchronous operation.
1096	// If the operation has not completed it will return an error.
1097	Result func(DataConnectionsClient) (DataConnectionModel, error)
1098}
1099
1100// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1101func (future *DataConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1102	var azFuture azure.Future
1103	if err := json.Unmarshal(body, &azFuture); err != nil {
1104		return err
1105	}
1106	future.FutureAPI = &azFuture
1107	future.Result = future.result
1108	return nil
1109}
1110
1111// result is the default implementation for DataConnectionsCreateOrUpdateFuture.Result.
1112func (future *DataConnectionsCreateOrUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) {
1113	var done bool
1114	done, err = future.DoneWithContext(context.Background(), client)
1115	if err != nil {
1116		err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1117		return
1118	}
1119	if !done {
1120		dcm.Response.Response = future.Response()
1121		err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsCreateOrUpdateFuture")
1122		return
1123	}
1124	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1125	if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent {
1126		dcm, err = client.CreateOrUpdateResponder(dcm.Response.Response)
1127		if err != nil {
1128			err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request")
1129		}
1130	}
1131	return
1132}
1133
1134// DataConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1135// operation.
1136type DataConnectionsDeleteFuture struct {
1137	azure.FutureAPI
1138	// Result returns the result of the asynchronous operation.
1139	// If the operation has not completed it will return an error.
1140	Result func(DataConnectionsClient) (autorest.Response, error)
1141}
1142
1143// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1144func (future *DataConnectionsDeleteFuture) UnmarshalJSON(body []byte) error {
1145	var azFuture azure.Future
1146	if err := json.Unmarshal(body, &azFuture); err != nil {
1147		return err
1148	}
1149	future.FutureAPI = &azFuture
1150	future.Result = future.result
1151	return nil
1152}
1153
1154// result is the default implementation for DataConnectionsDeleteFuture.Result.
1155func (future *DataConnectionsDeleteFuture) result(client DataConnectionsClient) (ar autorest.Response, err error) {
1156	var done bool
1157	done, err = future.DoneWithContext(context.Background(), client)
1158	if err != nil {
1159		err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDeleteFuture", "Result", future.Response(), "Polling failure")
1160		return
1161	}
1162	if !done {
1163		ar.Response = future.Response()
1164		err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsDeleteFuture")
1165		return
1166	}
1167	ar.Response = future.Response()
1168	return
1169}
1170
1171// DataConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1172// operation.
1173type DataConnectionsUpdateFuture struct {
1174	azure.FutureAPI
1175	// Result returns the result of the asynchronous operation.
1176	// If the operation has not completed it will return an error.
1177	Result func(DataConnectionsClient) (DataConnectionModel, error)
1178}
1179
1180// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1181func (future *DataConnectionsUpdateFuture) UnmarshalJSON(body []byte) error {
1182	var azFuture azure.Future
1183	if err := json.Unmarshal(body, &azFuture); err != nil {
1184		return err
1185	}
1186	future.FutureAPI = &azFuture
1187	future.Result = future.result
1188	return nil
1189}
1190
1191// result is the default implementation for DataConnectionsUpdateFuture.Result.
1192func (future *DataConnectionsUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) {
1193	var done bool
1194	done, err = future.DoneWithContext(context.Background(), client)
1195	if err != nil {
1196		err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", future.Response(), "Polling failure")
1197		return
1198	}
1199	if !done {
1200		dcm.Response.Response = future.Response()
1201		err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsUpdateFuture")
1202		return
1203	}
1204	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1205	if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent {
1206		dcm, err = client.UpdateResponder(dcm.Response.Response)
1207		if err != nil {
1208			err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request")
1209		}
1210	}
1211	return
1212}
1213
1214// DataConnectionValidation class representing an data connection validation.
1215type DataConnectionValidation struct {
1216	// DataConnectionName - The name of the data connection.
1217	DataConnectionName *string `json:"dataConnectionName,omitempty"`
1218	// Properties - The data connection properties to validate.
1219	Properties BasicDataConnection `json:"properties,omitempty"`
1220}
1221
1222// UnmarshalJSON is the custom unmarshaler for DataConnectionValidation struct.
1223func (dcv *DataConnectionValidation) UnmarshalJSON(body []byte) error {
1224	var m map[string]*json.RawMessage
1225	err := json.Unmarshal(body, &m)
1226	if err != nil {
1227		return err
1228	}
1229	for k, v := range m {
1230		switch k {
1231		case "dataConnectionName":
1232			if v != nil {
1233				var dataConnectionName string
1234				err = json.Unmarshal(*v, &dataConnectionName)
1235				if err != nil {
1236					return err
1237				}
1238				dcv.DataConnectionName = &dataConnectionName
1239			}
1240		case "properties":
1241			if v != nil {
1242				properties, err := unmarshalBasicDataConnection(*v)
1243				if err != nil {
1244					return err
1245				}
1246				dcv.Properties = properties
1247			}
1248		}
1249	}
1250
1251	return nil
1252}
1253
1254// DataConnectionValidationListResult the list Kusto data connection validation result.
1255type DataConnectionValidationListResult struct {
1256	autorest.Response `json:"-"`
1257	// Value - The list of Kusto data connection validation errors.
1258	Value *[]DataConnectionValidationResult `json:"value,omitempty"`
1259}
1260
1261// DataConnectionValidationResult the result returned from a data connection validation request.
1262type DataConnectionValidationResult struct {
1263	// ErrorMessage - A message which indicates a problem in data connection validation.
1264	ErrorMessage *string `json:"errorMessage,omitempty"`
1265}
1266
1267// EventGridConnectionProperties class representing the Kusto event grid connection properties.
1268type EventGridConnectionProperties struct {
1269	// StorageAccountResourceID - The resource ID of the storage account where the data resides.
1270	StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"`
1271	// EventHubResourceID - The resource ID where the event grid is configured to send events.
1272	EventHubResourceID *string `json:"eventHubResourceId,omitempty"`
1273	// ConsumerGroup - The event hub consumer group.
1274	ConsumerGroup *string `json:"consumerGroup,omitempty"`
1275	// TableName - The table where the data should be ingested. Optionally the table information can be added to each message.
1276	TableName *string `json:"tableName,omitempty"`
1277	// MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.
1278	MappingRuleName *string `json:"mappingRuleName,omitempty"`
1279	// DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'
1280	DataFormat DataFormat `json:"dataFormat,omitempty"`
1281}
1282
1283// EventGridDataConnection class representing an Event Grid data connection.
1284type EventGridDataConnection struct {
1285	// EventGridConnectionProperties - The properties of the Event Grid data connection.
1286	*EventGridConnectionProperties `json:"properties,omitempty"`
1287	// Location - Resource location.
1288	Location *string `json:"location,omitempty"`
1289	// Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid'
1290	Kind Kind `json:"kind,omitempty"`
1291	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1292	ID *string `json:"id,omitempty"`
1293	// Name - READ-ONLY; The name of the resource
1294	Name *string `json:"name,omitempty"`
1295	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1296	Type *string `json:"type,omitempty"`
1297}
1298
1299// MarshalJSON is the custom marshaler for EventGridDataConnection.
1300func (egdc EventGridDataConnection) MarshalJSON() ([]byte, error) {
1301	egdc.Kind = KindEventGrid
1302	objectMap := make(map[string]interface{})
1303	if egdc.EventGridConnectionProperties != nil {
1304		objectMap["properties"] = egdc.EventGridConnectionProperties
1305	}
1306	if egdc.Location != nil {
1307		objectMap["location"] = egdc.Location
1308	}
1309	if egdc.Kind != "" {
1310		objectMap["kind"] = egdc.Kind
1311	}
1312	return json.Marshal(objectMap)
1313}
1314
1315// AsEventHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection.
1316func (egdc EventGridDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) {
1317	return nil, false
1318}
1319
1320// AsEventGridDataConnection is the BasicDataConnection implementation for EventGridDataConnection.
1321func (egdc EventGridDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) {
1322	return &egdc, true
1323}
1324
1325// AsDataConnection is the BasicDataConnection implementation for EventGridDataConnection.
1326func (egdc EventGridDataConnection) AsDataConnection() (*DataConnection, bool) {
1327	return nil, false
1328}
1329
1330// AsBasicDataConnection is the BasicDataConnection implementation for EventGridDataConnection.
1331func (egdc EventGridDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) {
1332	return &egdc, true
1333}
1334
1335// UnmarshalJSON is the custom unmarshaler for EventGridDataConnection struct.
1336func (egdc *EventGridDataConnection) UnmarshalJSON(body []byte) error {
1337	var m map[string]*json.RawMessage
1338	err := json.Unmarshal(body, &m)
1339	if err != nil {
1340		return err
1341	}
1342	for k, v := range m {
1343		switch k {
1344		case "properties":
1345			if v != nil {
1346				var eventGridConnectionProperties EventGridConnectionProperties
1347				err = json.Unmarshal(*v, &eventGridConnectionProperties)
1348				if err != nil {
1349					return err
1350				}
1351				egdc.EventGridConnectionProperties = &eventGridConnectionProperties
1352			}
1353		case "location":
1354			if v != nil {
1355				var location string
1356				err = json.Unmarshal(*v, &location)
1357				if err != nil {
1358					return err
1359				}
1360				egdc.Location = &location
1361			}
1362		case "kind":
1363			if v != nil {
1364				var kind Kind
1365				err = json.Unmarshal(*v, &kind)
1366				if err != nil {
1367					return err
1368				}
1369				egdc.Kind = kind
1370			}
1371		case "id":
1372			if v != nil {
1373				var ID string
1374				err = json.Unmarshal(*v, &ID)
1375				if err != nil {
1376					return err
1377				}
1378				egdc.ID = &ID
1379			}
1380		case "name":
1381			if v != nil {
1382				var name string
1383				err = json.Unmarshal(*v, &name)
1384				if err != nil {
1385					return err
1386				}
1387				egdc.Name = &name
1388			}
1389		case "type":
1390			if v != nil {
1391				var typeVar string
1392				err = json.Unmarshal(*v, &typeVar)
1393				if err != nil {
1394					return err
1395				}
1396				egdc.Type = &typeVar
1397			}
1398		}
1399	}
1400
1401	return nil
1402}
1403
1404// EventHubConnectionProperties class representing the Kusto event hub connection properties.
1405type EventHubConnectionProperties struct {
1406	// EventHubResourceID - The resource ID of the event hub to be used to create a data connection.
1407	EventHubResourceID *string `json:"eventHubResourceId,omitempty"`
1408	// ConsumerGroup - The event hub consumer group.
1409	ConsumerGroup *string `json:"consumerGroup,omitempty"`
1410	// TableName - The table where the data should be ingested. Optionally the table information can be added to each message.
1411	TableName *string `json:"tableName,omitempty"`
1412	// MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.
1413	MappingRuleName *string `json:"mappingRuleName,omitempty"`
1414	// DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'
1415	DataFormat DataFormat `json:"dataFormat,omitempty"`
1416}
1417
1418// EventHubDataConnection class representing an event hub data connection.
1419type EventHubDataConnection struct {
1420	// EventHubConnectionProperties - The Event Hub data connection properties to validate.
1421	*EventHubConnectionProperties `json:"properties,omitempty"`
1422	// Location - Resource location.
1423	Location *string `json:"location,omitempty"`
1424	// Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid'
1425	Kind Kind `json:"kind,omitempty"`
1426	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1427	ID *string `json:"id,omitempty"`
1428	// Name - READ-ONLY; The name of the resource
1429	Name *string `json:"name,omitempty"`
1430	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1431	Type *string `json:"type,omitempty"`
1432}
1433
1434// MarshalJSON is the custom marshaler for EventHubDataConnection.
1435func (ehdc EventHubDataConnection) MarshalJSON() ([]byte, error) {
1436	ehdc.Kind = KindEventHub
1437	objectMap := make(map[string]interface{})
1438	if ehdc.EventHubConnectionProperties != nil {
1439		objectMap["properties"] = ehdc.EventHubConnectionProperties
1440	}
1441	if ehdc.Location != nil {
1442		objectMap["location"] = ehdc.Location
1443	}
1444	if ehdc.Kind != "" {
1445		objectMap["kind"] = ehdc.Kind
1446	}
1447	return json.Marshal(objectMap)
1448}
1449
1450// AsEventHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection.
1451func (ehdc EventHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) {
1452	return &ehdc, true
1453}
1454
1455// AsEventGridDataConnection is the BasicDataConnection implementation for EventHubDataConnection.
1456func (ehdc EventHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) {
1457	return nil, false
1458}
1459
1460// AsDataConnection is the BasicDataConnection implementation for EventHubDataConnection.
1461func (ehdc EventHubDataConnection) AsDataConnection() (*DataConnection, bool) {
1462	return nil, false
1463}
1464
1465// AsBasicDataConnection is the BasicDataConnection implementation for EventHubDataConnection.
1466func (ehdc EventHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) {
1467	return &ehdc, true
1468}
1469
1470// UnmarshalJSON is the custom unmarshaler for EventHubDataConnection struct.
1471func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error {
1472	var m map[string]*json.RawMessage
1473	err := json.Unmarshal(body, &m)
1474	if err != nil {
1475		return err
1476	}
1477	for k, v := range m {
1478		switch k {
1479		case "properties":
1480			if v != nil {
1481				var eventHubConnectionProperties EventHubConnectionProperties
1482				err = json.Unmarshal(*v, &eventHubConnectionProperties)
1483				if err != nil {
1484					return err
1485				}
1486				ehdc.EventHubConnectionProperties = &eventHubConnectionProperties
1487			}
1488		case "location":
1489			if v != nil {
1490				var location string
1491				err = json.Unmarshal(*v, &location)
1492				if err != nil {
1493					return err
1494				}
1495				ehdc.Location = &location
1496			}
1497		case "kind":
1498			if v != nil {
1499				var kind Kind
1500				err = json.Unmarshal(*v, &kind)
1501				if err != nil {
1502					return err
1503				}
1504				ehdc.Kind = kind
1505			}
1506		case "id":
1507			if v != nil {
1508				var ID string
1509				err = json.Unmarshal(*v, &ID)
1510				if err != nil {
1511					return err
1512				}
1513				ehdc.ID = &ID
1514			}
1515		case "name":
1516			if v != nil {
1517				var name string
1518				err = json.Unmarshal(*v, &name)
1519				if err != nil {
1520					return err
1521				}
1522				ehdc.Name = &name
1523			}
1524		case "type":
1525			if v != nil {
1526				var typeVar string
1527				err = json.Unmarshal(*v, &typeVar)
1528				if err != nil {
1529					return err
1530				}
1531				ehdc.Type = &typeVar
1532			}
1533		}
1534	}
1535
1536	return nil
1537}
1538
1539// ListResourceSkusResult list of available SKUs for an existing Kusto Cluster.
1540type ListResourceSkusResult struct {
1541	autorest.Response `json:"-"`
1542	// Value - The collection of available SKUs for an existing resource.
1543	Value *[]AzureResourceSku `json:"value,omitempty"`
1544}
1545
1546// ListSkusResult list of available SKUs for a new Kusto Cluster.
1547type ListSkusResult struct {
1548	autorest.Response `json:"-"`
1549	// Value - The collection of available SKUs for new resources.
1550	Value *[]AzureSku `json:"value,omitempty"`
1551}
1552
1553// Operation ...
1554type Operation struct {
1555	// Name - This is of the format {provider}/{resource}/{operation}.
1556	Name       *string           `json:"name,omitempty"`
1557	Display    *OperationDisplay `json:"display,omitempty"`
1558	Origin     *string           `json:"origin,omitempty"`
1559	Properties interface{}       `json:"properties,omitempty"`
1560}
1561
1562// OperationDisplay ...
1563type OperationDisplay struct {
1564	Provider *string `json:"provider,omitempty"`
1565	// Operation - For example: read, write, delete.
1566	Operation   *string `json:"operation,omitempty"`
1567	Resource    *string `json:"resource,omitempty"`
1568	Description *string `json:"description,omitempty"`
1569}
1570
1571// OperationListResult ...
1572type OperationListResult struct {
1573	autorest.Response `json:"-"`
1574	Value             *[]Operation `json:"value,omitempty"`
1575	NextLink          *string      `json:"nextLink,omitempty"`
1576}
1577
1578// OperationListResultIterator provides access to a complete listing of Operation values.
1579type OperationListResultIterator struct {
1580	i    int
1581	page OperationListResultPage
1582}
1583
1584// NextWithContext advances to the next value.  If there was an error making
1585// the request the iterator does not advance and the error is returned.
1586func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1587	if tracing.IsEnabled() {
1588		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
1589		defer func() {
1590			sc := -1
1591			if iter.Response().Response.Response != nil {
1592				sc = iter.Response().Response.Response.StatusCode
1593			}
1594			tracing.EndSpan(ctx, sc, err)
1595		}()
1596	}
1597	iter.i++
1598	if iter.i < len(iter.page.Values()) {
1599		return nil
1600	}
1601	err = iter.page.NextWithContext(ctx)
1602	if err != nil {
1603		iter.i--
1604		return err
1605	}
1606	iter.i = 0
1607	return nil
1608}
1609
1610// Next advances to the next value.  If there was an error making
1611// the request the iterator does not advance and the error is returned.
1612// Deprecated: Use NextWithContext() instead.
1613func (iter *OperationListResultIterator) Next() error {
1614	return iter.NextWithContext(context.Background())
1615}
1616
1617// NotDone returns true if the enumeration should be started or is not yet complete.
1618func (iter OperationListResultIterator) NotDone() bool {
1619	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1620}
1621
1622// Response returns the raw server response from the last page request.
1623func (iter OperationListResultIterator) Response() OperationListResult {
1624	return iter.page.Response()
1625}
1626
1627// Value returns the current value or a zero-initialized value if the
1628// iterator has advanced beyond the end of the collection.
1629func (iter OperationListResultIterator) Value() Operation {
1630	if !iter.page.NotDone() {
1631		return Operation{}
1632	}
1633	return iter.page.Values()[iter.i]
1634}
1635
1636// Creates a new instance of the OperationListResultIterator type.
1637func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
1638	return OperationListResultIterator{page: page}
1639}
1640
1641// IsEmpty returns true if the ListResult contains no values.
1642func (olr OperationListResult) IsEmpty() bool {
1643	return olr.Value == nil || len(*olr.Value) == 0
1644}
1645
1646// hasNextLink returns true if the NextLink is not empty.
1647func (olr OperationListResult) hasNextLink() bool {
1648	return olr.NextLink != nil && len(*olr.NextLink) != 0
1649}
1650
1651// operationListResultPreparer prepares a request to retrieve the next set of results.
1652// It returns nil if no more results exist.
1653func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
1654	if !olr.hasNextLink() {
1655		return nil, nil
1656	}
1657	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1658		autorest.AsJSON(),
1659		autorest.AsGet(),
1660		autorest.WithBaseURL(to.String(olr.NextLink)))
1661}
1662
1663// OperationListResultPage contains a page of Operation values.
1664type OperationListResultPage struct {
1665	fn  func(context.Context, OperationListResult) (OperationListResult, error)
1666	olr OperationListResult
1667}
1668
1669// NextWithContext advances to the next page of values.  If there was an error making
1670// the request the page does not advance and the error is returned.
1671func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
1672	if tracing.IsEnabled() {
1673		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
1674		defer func() {
1675			sc := -1
1676			if page.Response().Response.Response != nil {
1677				sc = page.Response().Response.Response.StatusCode
1678			}
1679			tracing.EndSpan(ctx, sc, err)
1680		}()
1681	}
1682	for {
1683		next, err := page.fn(ctx, page.olr)
1684		if err != nil {
1685			return err
1686		}
1687		page.olr = next
1688		if !next.hasNextLink() || !next.IsEmpty() {
1689			break
1690		}
1691	}
1692	return nil
1693}
1694
1695// Next advances to the next page of values.  If there was an error making
1696// the request the page does not advance and the error is returned.
1697// Deprecated: Use NextWithContext() instead.
1698func (page *OperationListResultPage) Next() error {
1699	return page.NextWithContext(context.Background())
1700}
1701
1702// NotDone returns true if the page enumeration should be started or is not yet complete.
1703func (page OperationListResultPage) NotDone() bool {
1704	return !page.olr.IsEmpty()
1705}
1706
1707// Response returns the raw server response from the last page request.
1708func (page OperationListResultPage) Response() OperationListResult {
1709	return page.olr
1710}
1711
1712// Values returns the slice of values for the current page or nil if there are no values.
1713func (page OperationListResultPage) Values() []Operation {
1714	if page.olr.IsEmpty() {
1715		return nil
1716	}
1717	return *page.olr.Value
1718}
1719
1720// Creates a new instance of the OperationListResultPage type.
1721func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1722	return OperationListResultPage{
1723		fn:  getNextPage,
1724		olr: cur,
1725	}
1726}
1727
1728// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not
1729// have tags and a location
1730type ProxyResource struct {
1731	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1732	ID *string `json:"id,omitempty"`
1733	// Name - READ-ONLY; The name of the resource
1734	Name *string `json:"name,omitempty"`
1735	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1736	Type *string `json:"type,omitempty"`
1737}
1738
1739// MarshalJSON is the custom marshaler for ProxyResource.
1740func (pr ProxyResource) MarshalJSON() ([]byte, error) {
1741	objectMap := make(map[string]interface{})
1742	return json.Marshal(objectMap)
1743}
1744
1745// Resource common fields that are returned in the response for all Azure Resource Manager resources
1746type Resource struct {
1747	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1748	ID *string `json:"id,omitempty"`
1749	// Name - READ-ONLY; The name of the resource
1750	Name *string `json:"name,omitempty"`
1751	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1752	Type *string `json:"type,omitempty"`
1753}
1754
1755// MarshalJSON is the custom marshaler for Resource.
1756func (r Resource) MarshalJSON() ([]byte, error) {
1757	objectMap := make(map[string]interface{})
1758	return json.Marshal(objectMap)
1759}
1760
1761// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource
1762// which has 'tags' and a 'location'
1763type TrackedResource struct {
1764	// Tags - Resource tags.
1765	Tags map[string]*string `json:"tags"`
1766	// Location - The geo-location where the resource lives
1767	Location *string `json:"location,omitempty"`
1768	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1769	ID *string `json:"id,omitempty"`
1770	// Name - READ-ONLY; The name of the resource
1771	Name *string `json:"name,omitempty"`
1772	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1773	Type *string `json:"type,omitempty"`
1774}
1775
1776// MarshalJSON is the custom marshaler for TrackedResource.
1777func (tr TrackedResource) MarshalJSON() ([]byte, error) {
1778	objectMap := make(map[string]interface{})
1779	if tr.Tags != nil {
1780		objectMap["tags"] = tr.Tags
1781	}
1782	if tr.Location != nil {
1783		objectMap["location"] = tr.Location
1784	}
1785	return json.Marshal(objectMap)
1786}
1787
1788// TrustedExternalTenant represents a tenant ID that is trusted by the cluster.
1789type TrustedExternalTenant struct {
1790	// Value - GUID representing an external tenant.
1791	Value *string `json:"value,omitempty"`
1792}
1793